1
- #/usr/bin/env bash
1
+ #! /usr/bin/env bash
2
2
3
3
set -e
4
4
5
5
if [ -n " $DEBUG " ]; then
6
- set -x
6
+ set -x
7
7
fi
8
8
9
9
basedir=" $( cd -P " $( dirname " $0 " ) " && pwd ) "
@@ -19,89 +19,93 @@ if [ -z "$1" ]; then
19
19
fi
20
20
21
21
php_version=" $1 "
22
- php_series="$(echo $php_version | cut -d '.' -f1,2)"
23
22
24
23
echo " -----> Packaging PHP $php_version "
25
24
26
25
tempdir=$( mktmpdir php)
27
- cd $tempdir
26
+ cd " $tempdir "
28
27
29
28
echo " -----> Downloading dependency zlib ${zlib_version} "
30
29
curl -LO " ${PHP_BASE_URL} /zlib/zlib-${zlib_version} .tar.gz"
31
- tar -xzvf "zlib-${zlib_version}.tar.gz"
30
+ tar -xzf " zlib-${zlib_version} .tar.gz"
32
31
33
32
echo " -----> Downloading dependency libonig ${libonig_version} "
34
- libzip_flag=""
35
33
mkdir /app/vendor/libonig -p
36
34
curl -L -o - " ${PHP_BASE_URL} /package/libonig-${libonig_version} .tgz" | tar -C /app/vendor/libonig -xvz
37
35
export C_INCLUDE_PATH=" $C_INCLUDE_PATH :/app/vendor/libonig/include"
38
36
export PKG_CONFIG_PATH=" /app/vendor/libonig/lib/pkgconfig:$PKG_CONFIG_PATH "
39
37
38
+ echo " -----> Downloading dependency WebP library ${webp_version} "
39
+ mkdir -p " /app/vendor/libwebp"
40
+ curl " ${PHP_BASE_URL} /package/libwebp-${webp_version} .tgz" | tar xz -C /app/vendor/libwebp
41
+
40
42
echo " -----> Downloading PHP $php_version "
41
43
curl -LO " https://php.net/distributions/php-${php_version} .tar.gz"
42
- tar -xzvf "php-${php_version}.tar.gz"
44
+ tar -xzf " php-${php_version} .tar.gz"
43
45
44
46
install_zend_optimizer=" :"
45
47
install_zend_optimizer=$( cat << SH
46
48
echo "zend_extension=opcache.so" > /app/vendor/php/etc/conf.d/opcache.ini
47
49
SH
48
50
)
49
51
50
- WITH_CURL_CONFIGURE=""
52
+ WITH_CURL_CONFIGURE=" --with-curl=/usr "
51
53
if [ -d ' /app/.apt/usr' ] ; then
52
54
WITH_CURL_CONFIGURE=" --with-curl=/app/.apt/usr"
53
55
fi
54
56
55
- mkdir -p "/app/vendor/libwebp" \
56
- && curl "${PHP_BASE_URL}/package/libwebp-${webp_version}.tgz" | tar xzv -C /app/vendor/libwebp
57
-
58
57
export WEBP_LIBS=" -L/app/vendor/libwebp/lib -lwebp"
59
58
export WEBP_CFLAGS=" -I/app/vendor/libwebp/include"
60
59
61
- ENABLE_GD_CONFIGURE="--enable-gd --with-jpeg --with-freetype --with-webp"
62
-
63
- mkdir -p "/app/vendor/php/etc/conf.d" \
64
- && pushd zlib-${zlib_version} >/dev/null && ./configure --prefix=/app/vendor/php/zlib && make && make install && popd > /dev/null \
65
- && pushd php-${php_version} >/dev/null \
66
- && ./configure --prefix=/app/vendor/php \
67
- --with-config-file-path=/app/vendor/php/etc \
68
- --with-config-file-scan-dir=/app/vendor/php/etc/conf.d \
69
- --enable-intl \
70
- ${ENABLE_GD_CONFIGURE} \
71
- --enable-exif \
72
- --with-mysqli \
73
- --with-pdo-mysql \
74
- --with-pdo-sqlite \
75
- --with-pdo-pgsql=/usr/bin/pg_config \
76
- --with-pgsql \
77
- --enable-shmop \
78
- --with-zip \
79
- ${WITH_CURL_CONFIGURE} \
80
- ${libzip_flag} \
81
- --with-zlib=/app/vendor/php/zlib \
82
- --with-bz2 \
83
- --with-openssl \
84
- --enable-soap \
85
- --enable-xmlreader \
86
- --with-curl=/usr \
87
- --with-xsl \
88
- --enable-fpm \
89
- --enable-mbstring \
90
- --enable-pcntl \
91
- --enable-sockets \
92
- --enable-bcmath \
93
- --with-readline \
94
- --with-password-argon2 \
95
- --disable-debug \
96
- && echo ${php_version} | grep ^5.3 && sed -i '/^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile || true \
97
- && make -j 8 \
98
- && make install \
99
- && popd > /dev/null \
100
- && eval $install_zend_optimizer
60
+ mkdir -p " /app/vendor/php/etc/conf.d"
61
+
62
+ echo " -----> Compile ZLib v${zlib_version} "
63
+ pushd " zlib-${zlib_version} " > /dev/null
64
+ ./configure --prefix=/app/vendor/php/zlib
65
+ make
66
+ make install
67
+ popd > /dev/null
68
+
69
+ echo " -----> Compile PHP v${php_version} "
70
+ pushd " php-${php_version} " > /dev/null
71
+ ./configure --prefix=/app/vendor/php \
72
+ --with-config-file-path=/app/vendor/php/etc \
73
+ --with-config-file-scan-dir=/app/vendor/php/etc/conf.d \
74
+ --enable-intl \
75
+ --enable-gd --with-jpeg --with-freetype --with-webp \
76
+ --enable-exif \
77
+ --with-mysqli \
78
+ --with-pdo-mysql \
79
+ --with-pdo-sqlite \
80
+ --with-pdo-pgsql=/usr/bin/pg_config \
81
+ --with-pgsql \
82
+ --enable-shmop \
83
+ --with-zip \
84
+ ${WITH_CURL_CONFIGURE} \
85
+ --with-zlib=/app/vendor/php/zlib \
86
+ --with-bz2 \
87
+ --with-openssl \
88
+ --enable-soap \
89
+ --enable-xmlreader \
90
+ --with-xsl \
91
+ --enable-fpm \
92
+ --enable-mbstring \
93
+ --enable-pcntl \
94
+ --enable-sockets \
95
+ --enable-bcmath \
96
+ --with-readline \
97
+ --with-password-argon2 \
98
+ --disable-debug
99
+ echo " ${php_version} " | grep ^5.3 && sed -i ' /^BUILD_/ s/\$(CC)/\$(CXX)/g' Makefile || true
100
+ make -j 8
101
+ make install
102
+ popd > /dev/null
103
+
104
+ eval " $install_zend_optimizer "
101
105
102
106
mkdir package
103
107
pushd /app/vendor/php > /dev/null
104
- tar zcvf "${tempdir}/package/php-${php_version}.tgz" .
108
+ tar zcf " ${tempdir} /package/php-${php_version} .tgz" .
105
109
popd > /dev/null
106
110
107
111
echo " -----> Moving package to Swift"
0 commit comments