forked from rcrowley/debra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
php.sh
48 lines (40 loc) · 1.33 KB
/
php.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
ARCH=amd64
PHP=http://us3.php.net/distributions
set -e
apt-get -y install libssl-dev libreadline5-dev zlib1g-dev
apt-get -y install libxml2-dev libexpat1-dev libcurl4-openssl-dev libicu-dev
for VERSION in 5.2.12 5.3.1; do
DESTDIR=/tmp/php-$VERSION-$$
V=$(echo $VERSION | sed -r 's/^([0-9]+\.[0-9]+).*$/\1/')
debra create $DESTDIR
if [ 5.3 = $V ]; then
MYSQL=""
else
MYSQL=", libmysqlclient16"
apt-get -y install libmysqlclient16-dev
fi
cat <<EOF >$DESTDIR/DEBIAN/control
Package: opt-php-$VERSION
Version: $VERSION-1
Section: devel
Priority: optional
Essential: no
Architecture: amd64
Depends: libc6, libssl0.9.8, libreadline5, zlib1g, libxml2, libexpat1, libcurl3, libicu40$MYSQL
Maintainer: Richard Crowley <[email protected]>
Description: Standalone PHP $VERSION.
EOF
# Install PHP itself.
if [ 5.3 = $V ]; then
MYSQL="--with-mysql=mysqlnd --with-mysqli=mysqlnd"
else
MYSQL="--with-mysql --with-mysqli"
fi
mkdir -p $DESTDIR/opt
sourceinstall $PHP/php-$VERSION.tar.bz2 \
-f "--enable-cli --enable-cgi --enable-fastcgi --with-openssl --with-curl --with-zlib $MYSQL --enable-pdo --with-pdo-mysql --enable-pcntl --enable-sqlite-utf8 --with-libxml-dir=/usr --with-pear" \
-p $DESTDIR/opt/php-$VERSION
# Build a Debian package.
debra build $DESTDIR opt-php-${VERSION}_${VERSION}-1_$ARCH.deb
debra destroy $DESTDIR
done