Skip to content

Instantly share code, notes, and snippets.

@filhodanuvem
Created December 6, 2012 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save filhodanuvem/4224219 to your computer and use it in GitHub Desktop.
Save filhodanuvem/4224219 to your computer and use it in GitHub Desktop.
Multiple PHP versions set-up by Derick Rethans
#!/bin/sh
VERSION=$1
DEBUG=$2
ZTS=$3
THIRTYTWO=$4
POSTFIX=
EXTRA_FLAGS=
if (test "${DEBUG}" = "nodebug"); then
POSTFIX="$POSTFIX-nodebug"
else
EXTRA_FLAGS="$EXTRA_FLAGS --enable-debug"
fi
if (test "${ZTS}" = "zts"); then
EXTRA_FLAGS="$EXTRA_FLAGS --enable-maintainer-zts"
POSTFIX="$POSTFIX-zts"
fi
if (test "${THIRTYTWO}" = "32bit"); then
export CFLAGS="-m32"
POSTFIX="$POSTFIX-32bit"
fi
SCRUBBED=`echo $VERSION | sed 's/[0-9.]*//'`
if (test "${SCRUBBED}" = "dev"); then
BRANCH=`echo ${VERSION} | sed 's/dev//' | sed 's/\./_/g'`
PHP_DIR=/home/derick/dev/php/php-src/branches/PHP_${BRANCH}
cd $PHP_DIR
else
TAG=`echo ${VERSION} | sed 's/\./_/g'`
PHP_DIR=/home/derick/dev/php/php-src/tags/php_${TAG}
cd $PHP_DIR
svn up --set-depth=infinity
fi
echo "Building ${VERSION}${POSTFIX} with ($EXTRA_FLAGS)"
make clean
rm -rf configure
./vcsclean
./buildconf --force
if (test "${THIRTYTWO}" = "32bit"); then
OPTIONS="--disable-all"
else
OPTIONS="--with-gd --with-jpeg-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr \
--with-mysql=/usr --enable-bcmath --with-gmp --with-readline \
--with-openssl --with-curl --without-esmtp \
--with-mysqli --enable-pcntl \
--enable-memory-limit --with-mcrypt --with-t1lib \
--enable-debug --with-iconv --enable-wddx --with-pdo-pgsql \
--enable-spl --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
--with-ctype --with-bz2 --enable-mbstring --with-mime-magic \
--with-xmlrpc --with-zlib --disable-zend-memory-manager --with-esmtp \
--with-xsl --enable-exif --enable-soap --enable-ftp"
fi
./configure \
--prefix=/usr/local/php/${VERSION}${POSTFIX} ${EXTRA_FLAGS} ${OPTIONS}
make -j 5
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment