Permalink
Browse files

Commit basic create-php-workdir script

  • Loading branch information...
0 parents commit 88a7515b6596ef82ceb9d2badb929e5a9a79faa4 @johannes committed Apr 4, 2012
Showing with 81 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +25 −0 README
  3. +53 −0 create-php-workdir
@@ -0,0 +1,3 @@
+build
+php-*
+usr
25 README
@@ -0,0 +1,25 @@
+create-php-workdir
+------------------
+
+A simple, ugly, faulty script to create PHP working dirs. Prerquirements:
+ - git-new-workdir in $PATH
+ - A clone of the PHP source tree in `pwd`/php-src
+
+If this script is then invoked like
+
+ $ ./create-php-workdir
+
+it will use git-new-workdir to create a directory called php-5.3 to hold
+the source of the PHP-5.3 branch and run buildconf in there.
+
+Then it will create a bunch of build dirs:
+ build/5.3/debug-notsrm
+ build/5.3/debug-tsrm
+ build/5.3/nodebug-notsrm
+ build/5.3/nodebug-tsrm
+
+Which contain configure and config.nice files ready to build different
+configurations of PHP.
+
+Mind that the script does only little error checking and such so be careful.
+
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+if test $# -lt 1 || test $# -gt 1
+then
+ echo "Usage: $0 <BRANCH>"
+ echo
+ echo "This will create a php-<BRANCH> source directory using "
+ echo "php-src's PHP-<BRANCH> branch and a bunch of build dirs "
+ echo "with configure and config.nice scripts."
+ echo "Note: buildconf will be run, so you might want to set PHP_AUTOCONF"
+ exit 128
+fi
+
+MASTER_DIR=`pwd`/php-src
+GIT_NEW_WORKDIR=git-new-workdir
+DEFAULT_OPTIONS="--with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gd --with-zlib --with-openssl --enable-soap"
+BRANCH=$1
+
+git_dir=$(cd "$MASTER_DIR" 2>/dev/null &&
+ git rev-parse --git-dir 2>/dev/null &&
+ git fetch origin) ||
+ die "Not a git repository: \"$MASTER_DIR\""
+
+
+if test -f php-$BRANCH
+then
+ echo php-$BRANCH exists
+ exit 127
+fi
+
+$GIT_NEW_WORKDIR $MASTER_DIR ./php-$BRANCH PHP-$BRANCH
+(cd ./php-$BRANCH; ./buildconf)
+mkdir build/$BRANCH
+
+echo ""
+
+for i in debug-notsrm debug-tsrm nodebug-notsrm nodebug-tsrm
+do
+ echo "Creating build dir for $i in build/$BRANCH/$i"
+ mkdir build/$BRANCH/$i
+ configline=" --prefix=`pwd`/usr/$BRANCH/$i $DEFAULT_OPTIONS"
+ if test "$i" == "debug-notsrm" || test "$i" == "debug-tsrm"; then configline="$configline --enable-debug"; fi
+ if test "$i" == "debug-tsrm" || test "$i" == "nodebug-tstm"; then configline="$configline --enable-maintainer-zts"; fi
+ echo "`pwd`/php-$BRANCH/configure $configline \"\$@\"" > build/$BRANCH/$i/configure
+ chmod a+x build/$BRANCH/$i/configure
+
+ echo "#!/bin/sh" > build/$BRANCH/$i/config.nice
+ echo "./configure" >> build/$BRANCH/$i/config.nice
+ chmod a+x build/$BRANCH/$i/config.nice
+done
+
+
+

0 comments on commit 88a7515

Please sign in to comment.