summaryrefslogtreecommitdiff
path: root/buildscripts/phing/bin
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/phing/bin')
-rwxr-xr-xbuildscripts/phing/bin/phing87
-rw-r--r--buildscripts/phing/bin/phing.bat58
-rwxr-xr-xbuildscripts/phing/bin/phing.php56
3 files changed, 201 insertions, 0 deletions
diff --git a/buildscripts/phing/bin/phing b/buildscripts/phing/bin/phing
new file mode 100755
index 00000000..bbc6eefe
--- /dev/null
+++ b/buildscripts/phing/bin/phing
@@ -0,0 +1,87 @@
+#!/bin/sh
+# Shell wrapper for Phing
+# $Id$
+#
+# This script will do the following:
+# - check for PHP_COMMAND env, if found, use it.
+# - if not found assume php is on the path
+# - check for PHING_HOME evn, if found use it
+# - if not look for it
+# - check for PHP_CLASSPATH, if found use it
+# - if not found set it using PHING_HOME/classes
+
+
+# Put all args in quotes
+phing_exec_debug=false
+phing_exec_args=
+for arg in "$@" ; do
+ phing_exec_args="$phing_exec_args \"$arg\""
+done
+
+if [ -z "$PHING_HOME" ] ; then
+
+ # echo "WARNING: PHING_HOME environment not set. Attempting to guess."
+
+ # try to find PHING
+ if [ -d /opt/phing ] ; then
+ PHING_HOME=/opt/phing
+ fi
+
+ if [ -d "${HOME}/opt/phing" ] ; then
+ PHING_HOME="${HOME}/opt/phing"
+ fi
+
+ if [ -d "/usr/local/phing" ] ; then
+ PHING_HOME="/usr/local/phing"
+ fi
+
+ if [ -d "${HOME}/usr/phing" ] ; then
+ PHING_HOME="${HOME}/usr/phing"
+ fi
+
+ ## resolve links - $0 may be a link to phing's home
+ PRG="$0"
+ progname=`basename "$0"`
+ saveddir=`pwd`
+
+ # need this for relative symlinks
+ dirname_prg=`dirname "$PRG"`
+ cd "$dirname_prg"
+
+ while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+ done
+
+ PHING_HOME=`dirname "$PRG"`/..
+
+ cd "$saveddir"
+
+ # make it fully qualified
+ PHING_HOME=`cd "$PHING_HOME" && pwd`
+
+ # make it available in PHP via getenv("PHING_HOME")
+ export PHING_HOME
+fi
+
+if (test -z "$PHP_COMMAND") ; then
+ # echo "WARNING: PHP_COMMAND environment not set. (Assuming php on PATH)"
+ PHP_COMMAND=php
+ export PHP_COMMAND
+fi
+
+if (test -z "$PHP_CLASSPATH") ; then
+ PHP_CLASSPATH=$PHING_HOME/classes
+ export PHP_CLASSPATH
+fi
+
+phing_exec_cmd="exec $PHP_COMMAND -d html_errors=off -qC \"$PHING_HOME/bin/phing.php\" -logger phing.listener.AnsiColorLogger $phing_exec_args"
+if $phing_exec_debug ; then
+ echo $phing_exec_cmd
+fi
+eval $phing_exec_cmd \ No newline at end of file
diff --git a/buildscripts/phing/bin/phing.bat b/buildscripts/phing/bin/phing.bat
new file mode 100644
index 00000000..ea310470
--- /dev/null
+++ b/buildscripts/phing/bin/phing.bat
@@ -0,0 +1,58 @@
+@echo off
+
+rem *********************************************************************
+rem ** the phing build script for Windows based systems
+rem ** $Id$
+rem *********************************************************************
+
+rem This script will do the following:
+rem - check for PHP_COMMAND env, if found, use it.
+rem - if not found detect php, if found use it, otherwise err and terminate
+rem - check for PHING_HOME evn, if found use it
+rem - if not found error and leave
+rem - check for PHP_CLASSPATH, if found use it
+rem - if not found set it using PHING_HOME/classes
+
+if "%OS%"=="Windows_NT" @setlocal
+
+rem %~dp0 is expanded pathname of the current script under NT
+set DEFAULT_PHING_HOME=%~dp0..
+
+goto init
+goto cleanup
+
+:init
+
+if "%PHING_HOME%" == "" set PHING_HOME=%DEFAULT_PHING_HOME%
+set DEFAULT_PHING_HOME=
+
+if "%PHP_COMMAND%" == "" goto no_phpcommand
+if "%PHP_CLASSPATH%" == "" goto set_classpath
+
+goto run
+goto cleanup
+
+:run
+"%PHP_COMMAND%" -d html_errors=off -qC "%PHING_HOME%\bin\phing.php" %*
+goto cleanup
+
+:no_phpcommand
+REM echo ------------------------------------------------------------------------
+REM echo WARNING: Set environment var PHP_COMMAND to the location of your php.exe
+REM echo executable (e.g. C:\PHP\php.exe). (Assuming php.exe on Path)
+REM echo ------------------------------------------------------------------------
+set PHP_COMMAND=php.exe
+goto init
+
+:err_home
+echo ERROR: Environment var PHING_HOME not set. Please point this
+echo variable to your local phing installation!
+goto cleanup
+
+:set_classpath
+set PHP_CLASSPATH=%PHING_HOME%\classes
+goto init
+
+:cleanup
+if "%OS%"=="Windows_NT" @endlocal
+REM pause
diff --git a/buildscripts/phing/bin/phing.php b/buildscripts/phing/bin/phing.php
new file mode 100755
index 00000000..3b70887a
--- /dev/null
+++ b/buildscripts/phing/bin/phing.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * This is the Phing command line launcher. It starts up the system evironment
+ * tests for all important paths and properties and kicks of the main command-
+ * line entry point of phing located in phing.Phing
+ * @version $Id$
+ */
+
+// Set any INI options for PHP
+// ---------------------------
+
+/* set classpath */
+if (getenv('PHP_CLASSPATH')) {
+ if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', getenv('PHP_CLASSPATH') . PATH_SEPARATOR . get_include_path()); }
+ ini_set('include_path', PHP_CLASSPATH);
+} else {
+ if (!defined('PHP_CLASSPATH')) { define('PHP_CLASSPATH', get_include_path()); }
+}
+
+require_once 'phing/Phing.php';
+
+try {
+
+ /* Setup Phing environment */
+ Phing::startup();
+
+ // Set phing.home property to the value from environment
+ // (this may be NULL, but that's not a big problem.)
+ Phing::setProperty('phing.home', getenv('PHING_HOME'));
+
+ // Grab and clean up the CLI arguments
+ $args = isset($argv) ? $argv : $_SERVER['argv']; // $_SERVER['argv'] seems to not work (sometimes?) when argv is registered
+ array_shift($args); // 1st arg is script name, so drop it
+
+ // Invoke the commandline entry point
+ Phing::fire($args);
+
+ // Invoke any shutdown routines.
+ Phing::shutdown();
+
+} catch (ConfigurationException $x) {
+
+ Phing::printMessage($x);
+ exit(-1); // This was convention previously for configuration errors.
+
+} catch (Exception $x) {
+
+ // Assume the message was already printed as part of the build and
+ // exit with non-0 error code.
+
+ exit(1);
+
+}
+
+?>