Skip to content

Commit 2af47ff

Browse files
committed
Import of my PHP building script
0 parents  commit 2af47ff

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed

build

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#!/bin/bash
2+
3+
VERSION=$1
4+
DEBUG=$2
5+
ZTS=$3
6+
THIRTYTWO=$4
7+
POSTFIX=
8+
EXTRA_FLAGS=
9+
export -n PHP_AUTOCONF
10+
11+
if (test "${DEBUG}" = "nodebug"); then
12+
POSTFIX="$POSTFIX-nodebug"
13+
else
14+
EXTRA_FLAGS="$EXTRA_FLAGS --enable-debug"
15+
fi
16+
17+
if (test "${ZTS}" = "zts"); then
18+
EXTRA_FLAGS="$EXTRA_FLAGS --enable-maintainer-zts"
19+
POSTFIX="$POSTFIX-zts"
20+
fi
21+
22+
sudo apt install -y make autoconf gcc bison locate vim pkg-config libbz2-dev libjpeg-dev g++ libreadline-dev libmcrypt-dev re2c libsqlite3-dev
23+
24+
SCRUBBED=`echo $VERSION | sed 's/[0-9.]*//'`
25+
NUMBERS=`echo $VERSION | sed -r 's/[^0-9.]+//'`
26+
MINI_VERSION=`echo $VERSION | sed 's/^\([0-9]\.[0-9]\).*/\1/'`
27+
echo $NUMBERS
28+
echo $MINI_VERSION
29+
30+
if (test "${THIRTYTWO}" = "32bit"); then
31+
export CFLAGS="-m32"
32+
POSTFIX="$POSTFIX-32bit"
33+
export PKG_CONFIG_PATH="/usr/lib/i386-linux-gnu/pkgconfig"
34+
sudo apt install -y libxml2-dev:i386 libicu-dev:i386 libz-dev:i386 libssl-dev:i386 libssl1.1:i386 libssl1.0.2:i386 libxslt1-dev:i386 libsasl2-dev:i386 libonig-dev:i386
35+
else
36+
sudo apt install -y libxml2-dev libpng-dev libicu-dev libz-dev libssl-dev libssl1.1 libssl1.0.2 libxslt1-dev libsasl2-dev libonig-dev
37+
38+
if (test "${MINI_VERSION}" = "5.6"); then
39+
sudo apt install -y libssl1.0-dev
40+
fi
41+
fi
42+
43+
if (test "${SCRUBBED}" = "master"); then
44+
PHP_DIR=/home/derick/dev/php/php-src-git/master
45+
BRANCH=master
46+
47+
cd /home/derick/dev/php/php-src.git
48+
git checkout ${BRANCH} || exit 5
49+
else
50+
if (test "${SCRUBBED}" = "dev"); then
51+
BRANCH=`echo ${VERSION} | sed 's/dev//'`
52+
BRANCH=PHP-${BRANCH}
53+
54+
cd /home/derick/dev/php/php-src.git
55+
git checkout ${BRANCH} || exit 5
56+
else
57+
TAG=`echo ${VERSION}`
58+
BRANCH=php-${TAG}
59+
60+
BUILDDIR="/tmp/php-build-cache/tmp-${VERSION}${POSTFIX}"
61+
rm -rf "${BUILDDIR}/php-${VERSION}"
62+
mkdir -p ${BUILDDIR}
63+
cd ${BUILDDIR}
64+
65+
if [[ ! -s /tmp/php-build-cache/php-${VERSION}.tar.bz2 ]]; then
66+
if (test "${MINI_VERSION}" = "5.3"); then
67+
wget http://museum.php.net/php5/php-${VERSION}.tar.bz2 -O /tmp/php-build-cache/php-${VERSION}.tar.bz2
68+
elif (test "${MINI_VERSION}" = "5.4"); then
69+
wget http://museum.php.net/php5/php-${VERSION}.tar.bz2 -O /tmp/php-build-cache/php-${VERSION}.tar.bz2
70+
elif (test "${MINI_VERSION}" = "5.5"); then
71+
wget http://museum.php.net/php5/php-${VERSION}.tar.bz2 -O /tmp/php-build-cache/php-${VERSION}.tar.bz2
72+
# elif (test "${MINI_VERSION}" = "5.6"); then
73+
# wget http://museum.php.net/php5/php-${VERSION}.tar.bz2 -O /tmp/php-build-cache/php-${VERSION}.tar.bz2
74+
else
75+
wget http://uk1.php.net/distributions/php-${VERSION}.tar.bz2 -O /tmp/php-build-cache/php-${VERSION}.tar.bz2
76+
fi
77+
fi
78+
79+
tar -xjf /tmp/php-build-cache/php-${VERSION}.tar.bz2
80+
cd php-${VERSION}
81+
82+
if [[ -f /home/derick/dev/php/patches/${MINI_VERSION}.diff.txt ]]; then
83+
echo "Patching for ${MINI_VERSION}"
84+
patch -p0 < /home/derick/dev/php/patches/${MINI_VERSION}.diff.txt
85+
fi
86+
fi
87+
fi
88+
89+
echo "Building ${VERSION}${POSTFIX} with ($EXTRA_FLAGS)"
90+
91+
if (test "${THIRTYTWO}" = "32bit"); then
92+
OPTIONS="--disable-all --with-pear --with-iconv --enable-posix --with-posix --enable-spl \
93+
--enable-tokenizer --enable-phar --with-phar --enable-json --enable-sockets \
94+
--with-zlib --enable-filter --with-openssl --enable-hash --enable-opcache \
95+
--with-libxml --enable-xml --enable-dom --enable-mbstring --enable-pdo --enable-xmlwriter"
96+
else
97+
OPTIONS="--with-gettext --with-gd --with-jpeg-dir=/usr --without-freetype-dir \
98+
--with-mysql=mysqlnd --enable-bcmath --with-readline \
99+
--with-openssl --without-esmtp --with-curl \
100+
--with-mysqli --enable-pcntl --enable-sockets \
101+
--enable-memory-limit --with-mcrypt --with-libxml \
102+
--with-iconv --enable-wddx --enable-calendar \
103+
--enable-spl --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
104+
--with-ctype --with-bz2 --enable-mbstring --with-mime-magic \
105+
--with-xmlrpc --with-zlib --disable-zend-memory-manager --with-esmtp \
106+
--with-xsl --enable-exif --enable-soap --enable-ftp --enable-intl --enable-opcache\
107+
--enable-fpm"
108+
if (test "${MINI_VERSION}" = "5.3"); then
109+
export PHP_AUTOCONF=autoconf2.59
110+
OPTIONS="$OPTIONS --without-openssl \
111+
--without-xmlrpc --disable-dom --without-xsl --disable-wddx --disable-simplexml --disable-soap --without-curl \
112+
--enable-xml --disable-xmlreader --disable-xmlwriter --disable-intl --without-mysqli --without-mysql --without-pdo-mysql"
113+
fi
114+
if (test "${MINI_VERSION}" = "5.4"); then
115+
OPTIONS="$OPTIONS --without-openssl"
116+
fi
117+
fi
118+
OPTIONS="$OPTIONS --with-pear"
119+
120+
set +x
121+
122+
make clean
123+
rm -rf configure
124+
./vcsclean
125+
./buildconf --force
126+
127+
./configure --prefix=/usr/local/php/${VERSION}${POSTFIX} ${EXTRA_FLAGS} ${OPTIONS} || exit 5
128+
129+
make
130+
make install
131+
132+
if (test "${MINI_VERSION}" = "5.3"); then
133+
ln -fs /home/derick/php.53.default.ini /usr/local/php/${VERSION}${POSTFIX}/lib/php.ini
134+
elif (test "${MINI_VERSION}" = "5.4"); then
135+
ln -fs /home/derick/php.54.default.ini /usr/local/php/${VERSION}${POSTFIX}/lib/php.ini
136+
elif (test "${MINI_VERSION}" = "5.5"); then
137+
ln -fs /home/derick/php.55.default.ini /usr/local/php/${VERSION}${POSTFIX}/lib/php.ini
138+
elif (test "${MINI_VERSION}" = "5.6"); then
139+
ln -fs /home/derick/php.56.default.ini /usr/local/php/${VERSION}${POSTFIX}/lib/php.ini
140+
else
141+
ln -fs /home/derick/php.default.ini /usr/local/php/${VERSION}${POSTFIX}/lib/php.ini
142+
fi
143+
144+
/usr/local/php/${VERSION}${POSTFIX}/bin/pecl install mongodb
145+
/usr/local/php/${VERSION}${POSTFIX}/bin/pecl install xdebug
146+
/usr/local/php/${VERSION}${POSTFIX}/bin/pecl install vld-beta
147+

0 commit comments

Comments
 (0)