Update compile.sh

This commit is contained in:
Shoghi Cervantes 2014-03-29 03:30:02 +01:00
parent c266cb991c
commit cb1b8c6c68

View File

@ -5,14 +5,20 @@ ZEND_VM="GOTO"
ZLIB_VERSION="1.2.8" ZLIB_VERSION="1.2.8"
OPENSSL_VERSION="1.0.0l" OPENSSL_VERSION="1.0.0l"
CURL_VERSION="curl-7_35_0" CURL_VERSION="curl-7_35_0"
LIBEDIT_VERSION="0.3" READLINE_VERSION="6.3"
PTHREADS_VERSION="0.1.0" NCURSES_VERSION="5.9"
PHPNCURSES_VERSION="1.0.2"
PTHREADS_VERSION="2.0.4"
WEAKREF_VERSION="0.2.2"
PHPYAML_VERSION="1.1.1" PHPYAML_VERSION="1.1.1"
YAML_VERSION="0.1.4" YAML_VERSION="0.1.4"
LIBXML_VERSION="2.9.1"
BCOMPILER_VERSION="1.0.2"
echo "[PocketMine] PHP compiler for Linux, MacOS and Android" echo "[PocketMine] PHP compiler for Linux, MacOS and Android"
DIR="$(pwd)" DIR="$(pwd)"
date > "$DIR/install.log" 2>&1 date > "$DIR/install.log" 2>&1
trap "echo \"# \$(eval echo \$BASH_COMMAND)\" >> \"$DIR/install.log\" 2>&1" DEBUG
uname -a >> "$DIR/install.log" 2>&1 uname -a >> "$DIR/install.log" 2>&1
echo "[INFO] Checking dependecies" echo "[INFO] Checking dependecies"
type make >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; read -p "Press [Enter] to continue..."; exit 1; } type make >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"make\""; read -p "Press [Enter] to continue..."; exit 1; }
@ -40,14 +46,16 @@ fi
export CC="gcc" export CC="gcc"
COMPILE_FOR_ANDROID=no COMPILE_FOR_ANDROID=no
RANLIB=ranlib RANLIB=ranlib
HAVE_MYSQLI="--with-mysqli=mysqlnd" HAVE_MYSQLI="--enable-embedded-mysqli --enable-mysqlnd --with-mysqli=mysqlnd"
COMPILE_TARGET="" COMPILE_TARGET=""
COMPILE_OPENSSL="no" COMPILE_OPENSSL="no"
COMPILE_CURL="default" COMPILE_CURL="default"
COMPILE_LIBEDIT="no" COMPILE_FANCY="no"
IS_CROSSCOMPILE="no" IS_CROSSCOMPILE="no"
IS_WINDOWS="no"
DO_OPTIMIZE="no" DO_OPTIMIZE="no"
while getopts "::t:oj:cxff:" OPTION; do DO_STATIC="no"
while getopts "::t:oj:srcxff:" OPTION; do
case $OPTION in case $OPTION in
t) t)
echo "[opt] Set target to $OPTARG" echo "[opt] Set target to $OPTARG"
@ -61,9 +69,9 @@ while getopts "::t:oj:cxff:" OPTION; do
echo "[opt] Will compile OpenSSL" echo "[opt] Will compile OpenSSL"
COMPILE_OPENSSL="yes" COMPILE_OPENSSL="yes"
;; ;;
l) r)
echo "[opt] Will compile libedit" echo "[opt] Will compile readline and ncurses"
COMPILE_LIBEDIT="yes" COMPILE_FANCY="yes"
;; ;;
c) c)
echo "[opt] Will force compile cURL" echo "[opt] Will force compile cURL"
@ -73,6 +81,10 @@ while getopts "::t:oj:cxff:" OPTION; do
echo "[opt] Doing cross-compile" echo "[opt] Doing cross-compile"
IS_CROSSCOMPILE="yes" IS_CROSSCOMPILE="yes"
;; ;;
s)
echo "[opt] Will compile everything statically"
DO_STATIC="yes"
;;
f) f)
echo "[opt] Enabling abusive optimizations..." echo "[opt] Enabling abusive optimizations..."
DO_OPTIMIZE="yes" DO_OPTIMIZE="yes"
@ -94,7 +106,27 @@ while getopts "::t:oj:cxff:" OPTION; do
done done
if [ "$IS_CROSSCOMPILE" == "yes" ]; then if [ "$IS_CROSSCOMPILE" == "yes" ]; then
if [ "$COMPILE_TARGET" == "android" ] || [ "$COMPILE_TARGET" == "android-armv6" ]; then if [ "$COMPILE_TARGET" == "win" ] || [ "$COMPILE_TARGET" == "win32" ]; then
TOOLCHAIN_PREFIX="i686-w64-mingw32"
[ -z "$march" ] && march=i686;
[ -z "$mtune" ] && mtune=pentium4;
CFLAGS="$CFLAGS -mconsole"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX --build=$TOOLCHAIN_PREFIX"
OPENSSL_TARGET="mingw"
IS_WINDOWS="yes"
echo "[INFO] Cross-compiling for Windows 32-bit"
elif [ "$COMPILE_TARGET" == "win64" ]; then
TOOLCHAIN_PREFIX="x86_64-w64-mingw32"
[ -z "$march" ] && march=x86_64;
[ -z "$mtune" ] && mtune=nocona;
CFLAGS="$CFLAGS -mconsole"
export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX --target=$TOOLCHAIN_PREFIX --build=$TOOLCHAIN_PREFIX"
OPENSSL_TARGET="mingw"
IS_WINDOWS="yes"
echo "[INFO] Cross-compiling for Windows 64-bit"
elif [ "$COMPILE_TARGET" == "android" ] || [ "$COMPILE_TARGET" == "android-armv6" ]; then
COMPILE_FOR_ANDROID=yes COMPILE_FOR_ANDROID=yes
[ -z "$march" ] && march=armv6; [ -z "$march" ] && march=armv6;
[ -z "$mtune" ] && mtune=arm1136jf-s; [ -z "$mtune" ] && mtune=arm1136jf-s;
@ -121,6 +153,9 @@ if [ "$IS_CROSSCOMPILE" == "yes" ]; then
[ -z "$march" ] && march=armv6zk; [ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s; [ -z "$mtune" ] && mtune=arm1176jzf-s;
[ -z "$CFLAGS" ] && CFLAGS="-mfloat-abi=hard -mfpu=vfp"; [ -z "$CFLAGS" ] && CFLAGS="-mfloat-abi=hard -mfpu=vfp";
if [ "$DO_OPTIMIZE" == "yes" ]; then
CFLAGS="$CFLAGS -mfloat-abi=hard -mfpu=vfp"
fi
export CC="$TOOLCHAIN_PREFIX-gcc" export CC="$TOOLCHAIN_PREFIX-gcc"
CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX" CONFIGURE_FLAGS="--host=$TOOLCHAIN_PREFIX"
[ -z "$CFLAGS" ] && CFLAGS="-uclibc"; [ -z "$CFLAGS" ] && CFLAGS="-uclibc";
@ -157,9 +192,21 @@ if [ "$IS_CROSSCOMPILE" == "yes" ]; then
CFLAGS="$CFLAGS -mfpu=neon" CFLAGS="$CFLAGS -mfpu=neon"
fi fi
else else
echo "Please supply a proper platform [android android-armv6 android-armv7 rpi mac ios ios-armv6 ios-armv7] to cross-compile" echo "Please supply a proper platform [android android-armv6 android-armv7 rpi mac ios ios-armv6 ios-armv7 win win32 win64] to cross-compile"
exit 1 exit 1
fi fi
elif [ "$COMPILE_TARGET" == "linux" ] || [ "$COMPILE_TARGET" == "linux32" ]; then
[ -z "$march" ] && march=i686;
[ -z "$mtune" ] && mtune=pentium4;
CFLAGS="$CFLAGS -m32";
OPENSSL_TARGET="linux-generic32"
echo "[INFO] Compiling for Linux x86"
elif [ "$COMPILE_TARGET" == "linux64" ]; then
[ -z "$march" ] && march=x86-64;
[ -z "$mtune" ] && mtune=nocona;
CFLAGS="$CFLAGS -m64"
OPENSSL_TARGET="linux-x86_64"
echo "[INFO] Compiling for Linux x86_64"
elif [ "$COMPILE_TARGET" == "rpi" ]; then elif [ "$COMPILE_TARGET" == "rpi" ]; then
[ -z "$march" ] && march=armv6zk; [ -z "$march" ] && march=armv6zk;
[ -z "$mtune" ] && mtune=arm1176jzf-s; [ -z "$mtune" ] && mtune=arm1176jzf-s;
@ -167,9 +214,11 @@ elif [ "$COMPILE_TARGET" == "rpi" ]; then
OPENSSL_TARGET="linux-armv4" OPENSSL_TARGET="linux-armv4"
echo "[INFO] Compiling for Raspberry Pi ARMv6zk hard float" echo "[INFO] Compiling for Raspberry Pi ARMv6zk hard float"
elif [ "$COMPILE_TARGET" == "mac" ] || [ "$COMPILE_TARGET" == "mac32" ]; then elif [ "$COMPILE_TARGET" == "mac" ] || [ "$COMPILE_TARGET" == "mac32" ]; then
[ -z "$march" ] && march=prescott; #[ -z "$march" ] && march=prescott;
#[ -z "$mtune" ] && mtune=generic;
[ -z "$march" ] && march=i686;
[ -z "$mtune" ] && mtune=generic; [ -z "$mtune" ] && mtune=generic;
[ -z "$CFLAGS" ] && CFLAGS="-m32 -arch i386 -fomit-frame-pointer -mmacosx-version-min=10.5"; [ -z "$CFLAGS" ] && CFLAGS="-m32 -arch x86 -fomit-frame-pointer -mmacosx-version-min=10.5";
[ -z "$LDFLAGS" ] && LDFLAGS="-Wl,-rpath,@loader_path/../lib"; [ -z "$LDFLAGS" ] && LDFLAGS="-Wl,-rpath,@loader_path/../lib";
export DYLD_LIBRARY_PATH="@loader_path/../lib" export DYLD_LIBRARY_PATH="@loader_path/../lib"
OPENSSL_TARGET="darwin-i386-cc" OPENSSL_TARGET="darwin-i386-cc"
@ -177,7 +226,7 @@ elif [ "$COMPILE_TARGET" == "mac" ] || [ "$COMPILE_TARGET" == "mac32" ]; then
elif [ "$COMPILE_TARGET" == "mac64" ]; then elif [ "$COMPILE_TARGET" == "mac64" ]; then
[ -z "$march" ] && march=core2; [ -z "$march" ] && march=core2;
[ -z "$mtune" ] && mtune=generic; [ -z "$mtune" ] && mtune=generic;
[ -z "$CFLAGS" ] && CFLAGS="-m64 -arch x86_64 -fomit-frame-pointer -mmacosx-version-min=10.5"; [ -z "$CFLAGS" ] && CFLAGS="-m64 -arch x86-64 -fomit-frame-pointer -mmacosx-version-min=10.5";
[ -z "$LDFLAGS" ] && LDFLAGS="-Wl,-rpath,@loader_path/../lib"; [ -z "$LDFLAGS" ] && LDFLAGS="-Wl,-rpath,@loader_path/../lib";
export DYLD_LIBRARY_PATH="@loader_path/../lib" export DYLD_LIBRARY_PATH="@loader_path/../lib"
OPENSSL_TARGET="darwin64-x86_64-cc" OPENSSL_TARGET="darwin64-x86_64-cc"
@ -199,13 +248,11 @@ elif [ -z "$CFLAGS" ]; then
fi fi
fi fi
cat > test.c <<'CTEST' echo "#include <stdio.h> \
#include <stdio.h> int main(void){ \
int main(void){ printf("Hello world\n"); \
printf("Hello world\n"); return 0; \
return 0; }" > test.c
}
CTEST
type $CC >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"$CC\""; read -p "Press [Enter] to continue..."; exit 1; } type $CC >> "$DIR/install.log" 2>&1 || { echo >&2 "[ERROR] Please install \"$CC\""; read -p "Press [Enter] to continue..."; exit 1; }
@ -233,7 +280,7 @@ fi
rm test.* >> "$DIR/install.log" 2>&1 rm test.* >> "$DIR/install.log" 2>&1
rm test >> "$DIR/install.log" 2>&1 rm test >> "$DIR/install.log" 2>&1
export CFLAGS="-O2 $CFLAGS" export CFLAGS="-O2 -fPIC $CFLAGS"
export LDFLAGS="$LDFLAGS" export LDFLAGS="$LDFLAGS"
rm -r -f install_data/ >> "$DIR/install.log" 2>&1 rm -r -f install_data/ >> "$DIR/install.log" 2>&1
@ -250,33 +297,79 @@ download_file "http://php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror" | ta
mv php-$PHP_VERSION php mv php-$PHP_VERSION php
echo " done!" echo " done!"
if [ "$IS_CROSSCOMPILE" == "yes" ] || [ "$COMPILE_TARGET" == "rpi" ] || [ "$COMPILE_TARGET" == "mac" ] || [ "$COMPILE_LIBEDIT" != "yes" ]; then if [ "$COMPILE_FANCY" == "yes" ]; then
HAVE_LIBEDIT="--without-readline --without-libedit" if [ "$DO_STATIC" == "yes" ]; then
else EXTRA_FLAGS="--without-shared --with-static"
#libedit else
set +e EXTRA_FLAGS="--with-shared --without-static"
echo -n "[libedit] downloading $LIBEDIT_VERSION..." fi
download_file "http://download.sourceforge.net/project/libedit/libedit/libedit-$LIBEDIT_VERSION/libedit-$LIBEDIT_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1 #ncurses
echo -n "[ncurses] downloading $NCURSES_VERSION..."
download_file "http://ftp.gnu.org/gnu/ncurses/ncurses-$NCURSES_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv ncurses-$NCURSES_VERSION ncurses
echo -n " checking..." echo -n " checking..."
cd libedit cd ncurses
./configure --prefix="$DIR/bin/php5" \ ./configure --prefix="$DIR/bin/php5" \
--enable-shared=yes \ --without-ada \
--enable-static=no \ --without-manpages \
--without-progs \
--without-tests \
--with-normal \
--with-pthread \
--without-debug \
$EXTRA_FLAGS \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..."
make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..."
cd ..
rm -r -f ./ncurses
echo " done!"
HAVE_NCURSES="--with-ncurses=$DIR/bin/php5"
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--enable-shared=no --enable-static=yes"
else
EXTRA_FLAGS="--enable-shared=yes --enable-static=no"
fi
#readline
set +e
echo -n "[readline] downloading $READLINE_VERSION..."
download_file "http://ftp.gnu.org/gnu/readline/readline-$READLINE_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
mv readline-$READLINE_VERSION readline
echo -n " checking..."
cd readline
./configure --prefix="$DIR/bin/php5" \
--with-curses="$DIR/bin/php5" \
--enable-multibyte \
$EXTRA_FLAGS \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1 $CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..." echo -n " compiling..."
if make -j $THREADS >> "$DIR/install.log" 2>&1; then if make -j $THREADS >> "$DIR/install.log" 2>&1; then
echo -n " installing..." echo -n " installing..."
make install >> "$DIR/install.log" 2>&1 make install >> "$DIR/install.log" 2>&1
HAVE_LIBEDIT="--without-readline --with-libedit=\"$DIR/bin/php5\"" HAVE_READLINE="--with-readline=$DIR/bin/php5"
else else
echo -n " disabling..." echo -n " disabling..."
HAVE_LIBEDIT="--without-readline --without-libedit" HAVE_READLINE="--without-readline"
fi fi
echo -n " cleaning..." echo -n " cleaning..."
cd .. cd ..
rm -r -f ./libedit rm -r -f ./readline
echo " done!" echo " done!"
set -e set -e
else
HAVE_NCURSES="--without-ncurses"
HAVE_READLINE="--without-readline"
fi
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--static"
else
EXTRA_FLAGS="--shared"
fi fi
#zlib #zlib
@ -286,7 +379,7 @@ mv zlib-$ZLIB_VERSION zlib
echo -n " checking..." echo -n " checking..."
cd zlib cd zlib
RANLIB=$RANLIB ./configure --prefix="$DIR/bin/php5" \ RANLIB=$RANLIB ./configure --prefix="$DIR/bin/php5" \
--shared >> "$DIR/install.log" 2>&1 $EXTRA_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..." echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1 make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..." echo -n " installing..."
@ -294,9 +387,20 @@ make install >> "$DIR/install.log" 2>&1
echo -n " cleaning..." echo -n " cleaning..."
cd .. cd ..
rm -r -f ./zlib rm -r -f ./zlib
if [ "$DO_STATIC" != "yes" ]; then
rm -f "$DIR/bin/php5/lib/libz.a"
fi
echo " done!" echo " done!"
if [ "$COMPILE_OPENSSL" == "yes" ] || [ "$COMPILE_CURL" != "no" ] && [ "$IS_CROSSCOMPILE" != "yes" ]; then if [ "$COMPILE_OPENSSL" == "yes" ] || [ "$COMPILE_CURL" != "no" ] && [ "$IS_CROSSCOMPILE" != "yes" ]; then
#if [ "$DO_STATIC" == "yes" ]; then
# EXTRA_FLAGS=""
#else
# EXTRA_FLAGS="shared no-static"
#fi
EXTRA_FLAGS="shared no-static"
#OpenSSL #OpenSSL
WITH_SSL="--with-ssl=$DIR/bin/php5" WITH_SSL="--with-ssl=$DIR/bin/php5"
WITH_OPENSSL="--with-openssl=$DIR/bin/php5" WITH_OPENSSL="--with-openssl=$DIR/bin/php5"
@ -313,12 +417,11 @@ if [ "$COMPILE_OPENSSL" == "yes" ] || [ "$COMPILE_CURL" != "no" ] && [ "$IS_CROS
zlib-dynamic \ zlib-dynamic \
--with-zlib-lib="$DIR/bin/php5/lib" \ --with-zlib-lib="$DIR/bin/php5/lib" \
--with-zlib-include="$DIR/bin/php5/include" \ --with-zlib-include="$DIR/bin/php5/include" \
shared \ $EXTRA_FLAGS \
no-ssl2 \ no-ssl2 \
no-asm \ no-asm \
no-hw \ no-hw \
no-engines \ no-engines \
no-static \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1 $CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..." echo -n " compiling..."
make depend >> "$DIR/install.log" 2>&1 make depend >> "$DIR/install.log" 2>&1
@ -328,6 +431,9 @@ if [ "$COMPILE_OPENSSL" == "yes" ] || [ "$COMPILE_CURL" != "no" ] && [ "$IS_CROS
echo -n " cleaning..." echo -n " cleaning..."
cd .. cd ..
rm -r -f ./openssh rm -r -f ./openssh
if [ "$DO_STATIC" != "yes" ]; then
rm -f "$DIR/bin/php5/lib/libcrypto.a" "$DIR/bin/php5/lib/libssl.a"
fi
echo " done!" echo " done!"
else else
WITH_SSL="--with-ssl" WITH_SSL="--with-ssl"
@ -340,6 +446,12 @@ fi
if [ "$(uname -s)" == "Darwin" ] && [ "$IS_CROSSCOMPILE" != "yes" ] && [ "$COMPILE_CURL" != "yes" ]; then if [ "$(uname -s)" == "Darwin" ] && [ "$IS_CROSSCOMPILE" != "yes" ] && [ "$COMPILE_CURL" != "yes" ]; then
HAVE_CURL="shared,/usr" HAVE_CURL="shared,/usr"
else else
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--enable-static --disable-shared"
else
EXTRA_FLAGS="--disable-static --enable-shared"
fi
#curl #curl
echo -n "[cURL] downloading $CURL_VERSION..." echo -n "[cURL] downloading $CURL_VERSION..."
download_file "https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1 download_file "https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
@ -371,8 +483,7 @@ else
$WITH_SSL \ $WITH_SSL \
--enable-threaded-resolver \ --enable-threaded-resolver \
--prefix="$DIR/bin/php5" \ --prefix="$DIR/bin/php5" \
--disable-shared \ $EXTRA_FLAGS \
--enable-static \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1 $CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..." echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1 make -j $THREADS >> "$DIR/install.log" 2>&1
@ -385,18 +496,44 @@ else
HAVE_CURL="$DIR/bin/php5" HAVE_CURL="$DIR/bin/php5"
fi fi
# PECL libraries
#pthreads #pthreads
echo -n "[PHP pthreads] downloading $PTHREADS_VERSION..." echo -n "[PHP pthreads] downloading $PTHREADS_VERSION..."
download_file "http://pecl.php.net/get/pthreads-$PTHREADS_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1 download_file "http://pecl.php.net/get/pthreads-$PTHREADS_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads" mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads"
echo " done!" echo " done!"
#WeakRef
echo -n "[PHP WeakRef] downloading $WEAKREF_VERSION..."
download_file "http://pecl.php.net/get/Weakref-$WEAKREF_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
mv Weakref-$WEAKREF_VERSION "$DIR/install_data/php/ext/weakref"
echo " done!"
#PHP YAML #PHP YAML
echo -n "[PHP YAML] downloading $PHPYAML_VERSION..." echo -n "[PHP YAML] downloading $PHPYAML_VERSION..."
download_file "http://pecl.php.net/get/yaml-$PHPYAML_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1 download_file "http://pecl.php.net/get/yaml-$PHPYAML_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
mv yaml-$PHPYAML_VERSION "$DIR/install_data/php/ext/yaml" mv yaml-$PHPYAML_VERSION "$DIR/install_data/php/ext/yaml"
echo " done!" echo " done!"
#bcompiler
#echo -n "[bcompiler] downloading $BCOMPILER_VERSION..."
#download_file "http://pecl.php.net/get/bcompiler-$BCOMPILER_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
#mv bcompiler-$BCOMPILER_VERSION "$DIR/install_data/php/ext/bcompiler"
#echo " done!"
#PHP ncurses
echo -n "[PHP ncurses] downloading $PHPNCURSES_VERSION..."
download_file "http://pecl.php.net/get/ncurses-$PHPNCURSES_VERSION.tgz" | tar -zx >> "$DIR/install.log" 2>&1
mv ncurses-$PHPNCURSES_VERSION "$DIR/install_data/php/ext/ncurses"
echo " done!"
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--disable-shared --enable-static"
else
EXTRA_FLAGS="--enable-shared --disable-static"
fi
#YAML #YAML
echo -n "[YAML] downloading $YAML_VERSION..." echo -n "[YAML] downloading $YAML_VERSION..."
download_file "http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1 download_file "http://pyyaml.org/download/libyaml/yaml-$YAML_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
@ -405,9 +542,9 @@ echo -n " checking..."
cd yaml cd yaml
RANLIB=$RANLIB ./configure \ RANLIB=$RANLIB ./configure \
--prefix="$DIR/bin/php5" \ --prefix="$DIR/bin/php5" \
--disable-static \ $EXTRA_FLAGS \
--enable-shared \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1 $CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
sed -i=".backup" 's/ tests win32/ win32/g' Makefile
echo -n " compiling..." echo -n " compiling..."
make -j $THREADS >> "$DIR/install.log" 2>&1 make -j $THREADS >> "$DIR/install.log" 2>&1
echo -n " installing..." echo -n " installing..."
@ -417,6 +554,33 @@ cd ..
rm -r -f ./yaml rm -r -f ./yaml
echo " done!" echo " done!"
if [ "$DO_STATIC" == "yes" ]; then
EXTRA_FLAGS="--enable-shared=no --enable-static=yes"
else
EXTRA_FLAGS="--enable-shared=yes --enable-static=no"
fi
#libxml2
#echo -n "[libxml2] downloading $LIBXML_VERSION..."
#download_file "ftp://xmlsoft.org/libxml2/libxml2-$LIBXML_VERSION.tar.gz" | tar -zx >> "$DIR/install.log" 2>&1
#mv libxml2-$LIBXML_VERSION yaml
#echo -n " checking..."
#cd libxml2
#RANLIB=$RANLIB ./configure \
#--disable-ipv6 \
#--with-libz="$DIR/bin/php5" \
#--prefix="$DIR/bin/php5" \
#$EXTRA_FLAGS \
#$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
#echo -n " compiling..."
#make -j $THREADS >> "$DIR/install.log" 2>&1
#echo -n " installing..."
#make install >> "$DIR/install.log" 2>&1
#echo -n " cleaning..."
#cd ..
#rm -r -f ./libxml2
#echo " done!"
echo -n "[PHP]" echo -n "[PHP]"
if [ "$DO_OPTIMIZE" != "no" ]; then if [ "$DO_OPTIMIZE" != "no" ]; then
@ -427,21 +591,41 @@ else
fi fi
echo -n " checking..." echo -n " checking..."
cd php cd php
rm -rf ./aclocal.m4 >> "$DIR/install.log" 2>&1 rm -f ./aclocal.m4 >> "$DIR/install.log" 2>&1
rm -rf ./autom4te.cache/ >> "$DIR/install.log" 2>&1 rm -rf ./autom4te.cache/ >> "$DIR/install.log" 2>&1
rm -f ./configure >> "$DIR/install.log" 2>&1 rm -f ./configure >> "$DIR/install.log" 2>&1
./buildconf --force >> "$DIR/install.log" 2>&1 ./buildconf --force >> "$DIR/install.log" 2>&1
if [ "$IS_CROSSCOMPILE" == "yes" ]; then if [ "$IS_CROSSCOMPILE" == "yes" ]; then
sed -i=".backup" 's/pthreads_working=no/pthreads_working=yes/' ./configure sed -i=".backup" 's/pthreads_working=no/pthreads_working=yes/' ./configure
export LIBS="-lpthread -ldl -lresolv" if [ "$IS_WINDOWS" != "yes" ]; then
export LIBS="$LIBS -lpthread -ldl -lresolv"
else
export LIBS="$LIBS -lpthread"
fi
CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-opcache=no" CONFIGURE_FLAGS="$CONFIGURE_FLAGS --enable-opcache=no"
fi fi
RANLIB=$RANLIB ./configure $PHP_OPTIMIZATION--prefix="$DIR/bin/php5" \
if [ "$IS_WINDOWS" != "yes" ]; then
HAVE_PCNTL="--enable-pcntl"
else
HAVE_PCNTL="--disable-pcntl"
cp -f ./win32/build/config.* ./main >> "$DIR/install.log" 2>&1
sed 's:@PREFIX@:$DIR/bin/php5:' ./main/config.w32.h.in > ./wmain/config.w32.h 2>> "$DIR/install.log"
fi
RANLIB=$RANLIB ./configure $PHP_OPTIMIZATION --prefix="$DIR/bin/php5" \
--exec-prefix="$DIR/bin/php5" \ --exec-prefix="$DIR/bin/php5" \
--with-curl="$HAVE_CURL" \ --with-curl="$HAVE_CURL" \
--with-zlib="$DIR/bin/php5" \ --with-zlib="$DIR/bin/php5" \
--with-zlib-dir="$DIR/bin/php5" \
--with-yaml="$DIR/bin/php5" \ --with-yaml="$DIR/bin/php5" \
$HAVE_LIBEDIT \ $HAVE_NCURSES \
$HAVE_READLINE \
--enable-mbstring \
--enable-calendar \
--enable-weakref \
--enable-pthreads \
--enable-pthreads-pedantic \
--disable-libxml \ --disable-libxml \
--disable-xml \ --disable-xml \
--disable-dom \ --disable-dom \
@ -455,21 +639,22 @@ $HAVE_LIBEDIT \
--without-pear \ --without-pear \
--without-iconv \ --without-iconv \
--without-pdo-sqlite \ --without-pdo-sqlite \
--with-pic \
--enable-phar \ --enable-phar \
--enable-ctype \ --enable-ctype \
--enable-sockets \ --enable-sockets \
--enable-shared=no \ --enable-shared=no \
--enable-static=yes \ --enable-static=yes \
--enable-shmop \ --enable-shmop \
--enable-pcntl \
--enable-pthreads \
--enable-maintainer-zts \ --enable-maintainer-zts \
--disable-short-tags \
--enable-zend-signals \ --enable-zend-signals \
$HAVE_PCNTL \
$HAVE_MYSQLI \ $HAVE_MYSQLI \
--enable-embedded-mysqli \
--enable-bcmath \ --enable-bcmath \
--enable-cli \ --enable-cli \
--enable-zip \ --enable-zip \
--enable-ftp \
--with-zend-vm=$ZEND_VM \ --with-zend-vm=$ZEND_VM \
$CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1 $CONFIGURE_FLAGS >> "$DIR/install.log" 2>&1
echo -n " compiling..." echo -n " compiling..."
@ -487,6 +672,12 @@ if [ "$(uname -s)" == "Darwin" ] && [ "$IS_CROSSCOMPILE" != "yes" ]; then
install_name_tool -delete_rpath "$DIR/bin/php5/lib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1 install_name_tool -delete_rpath "$DIR/bin/php5/lib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libz.1.dylib" "@loader_path/../lib/libz.1.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1 install_name_tool -change "$DIR/bin/php5/lib/libz.1.dylib" "@loader_path/../lib/libz.1.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libyaml-0.2.dylib" "@loader_path/../lib/libyaml-0.2.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1 install_name_tool -change "$DIR/bin/php5/lib/libyaml-0.2.dylib" "@loader_path/../lib/libyaml-0.2.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libreadline.$READLINE_VERSION.dylib" "@loader_path/../lib/libreadline.$READLINE_VERSION.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libhistory.$READLINE_VERSION.dylib" "@loader_path/../lib/libhistory.$READLINE_VERSION.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libform.6.0.dylib" "@loader_path/../lib/libform.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libmenu.6.0.dylib" "@loader_path/../lib/libmenu.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libncurses.6.0.dylib" "@loader_path/../lib/libncurses.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libpanel.6.0.dylib" "@loader_path/../lib/libpanel.6.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libssl.1.0.0.dylib" "@loader_path/../lib/libssl.1.0.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1 install_name_tool -change "$DIR/bin/php5/lib/libssl.1.0.0.dylib" "@loader_path/../lib/libssl.1.0.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
install_name_tool -change "$DIR/bin/php5/lib/libcrypto.1.0.0.dylib" "@loader_path/../lib/libcrypto.1.0.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1 install_name_tool -change "$DIR/bin/php5/lib/libcrypto.1.0.0.dylib" "@loader_path/../lib/libcrypto.1.0.0.dylib" "$DIR/bin/php5/bin/php" >> "$DIR/install.log" 2>&1
chmod 0777 "$DIR/bin/php5/lib/libssl.1.0.0.dylib" >> "$DIR/install.log" 2>&1 chmod 0777 "$DIR/bin/php5/lib/libssl.1.0.0.dylib" >> "$DIR/install.log" 2>&1
@ -522,13 +713,12 @@ echo " done!"
cd "$DIR" cd "$DIR"
echo -n "[INFO] Cleaning up..." echo -n "[INFO] Cleaning up..."
rm -r -f install_data/ >> "$DIR/install.log" 2>&1 rm -r -f install_data/ >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/curl >> "$DIR/install.log" 2>&1 rm -f bin/php5/bin/curl* >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/curl-config >> "$DIR/install.log" 2>&1 rm -f bin/php5/bin/curl-config* >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/c_rehash >> "$DIR/install.log" 2>&1 rm -f bin/php5/bin/c_rehash* >> "$DIR/install.log" 2>&1
rm -f bin/php5/bin/openssl >> "$DIR/install.log" 2>&1 rm -f bin/php5/bin/openssl* >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/man >> "$DIR/install.log" 2>&1 rm -r -f bin/php5/man >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/php >> "$DIR/install.log" 2>&1 rm -r -f bin/php5/php >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/share >> "$DIR/install.log" 2>&1
rm -r -f bin/php5/misc >> "$DIR/install.log" 2>&1 rm -r -f bin/php5/misc >> "$DIR/install.log" 2>&1
date >> "$DIR/install.log" 2>&1 date >> "$DIR/install.log" 2>&1
echo " done!" echo " done!"