Skip to content

Commit 91125dd

Browse files
authored
Merge pull request #529 from Scalingo/feat/STORY-2477/scalingo-24-minimal
fix: add APT dependencies to some scripts for scalingo-24-minimal
2 parents d3ab147 + c542e43 commit 91125dd

File tree

2 files changed

+58
-52
lines changed

2 files changed

+58
-52
lines changed

support/get_gmp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ if [ -n "$DEBUG" ]; then
55
set -x
66
fi
77

8+
which m4 2> /dev/null || (apt-get update && apt-get install --yes m4)
9+
810
# The variable is assigned in `buildpack.conf`
911
declare gmp_version
1012
basedir="$( cd -P "$( dirname "$0" )" && pwd )"

support/package_php

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
#/usr/bin/env bash
1+
#!/usr/bin/env bash
22

33
set -e
44

55
if [ -n "$DEBUG" ]; then
6-
set -x
6+
set -x
77
fi
88

99
basedir="$( cd -P "$( dirname "$0" )" && pwd )"
@@ -19,89 +19,93 @@ if [ -z "$1" ]; then
1919
fi
2020

2121
php_version="$1"
22-
php_series="$(echo $php_version | cut -d '.' -f1,2)"
2322

2423
echo "-----> Packaging PHP $php_version"
2524

2625
tempdir=$(mktmpdir php)
27-
cd $tempdir
26+
cd "$tempdir"
2827

2928
echo "-----> Downloading dependency zlib ${zlib_version}"
3029
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"
3231

3332
echo "-----> Downloading dependency libonig ${libonig_version}"
34-
libzip_flag=""
3533
mkdir /app/vendor/libonig -p
3634
curl -L -o - "${PHP_BASE_URL}/package/libonig-${libonig_version}.tgz" | tar -C /app/vendor/libonig -xvz
3735
export C_INCLUDE_PATH="$C_INCLUDE_PATH:/app/vendor/libonig/include"
3836
export PKG_CONFIG_PATH="/app/vendor/libonig/lib/pkgconfig:$PKG_CONFIG_PATH"
3937

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+
4042
echo "-----> Downloading PHP $php_version"
4143
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"
4345

4446
install_zend_optimizer=":"
4547
install_zend_optimizer=$(cat <<SH
4648
echo "zend_extension=opcache.so" > /app/vendor/php/etc/conf.d/opcache.ini
4749
SH
4850
)
4951

50-
WITH_CURL_CONFIGURE=""
52+
WITH_CURL_CONFIGURE="--with-curl=/usr"
5153
if [ -d '/app/.apt/usr' ] ; then
5254
WITH_CURL_CONFIGURE="--with-curl=/app/.apt/usr"
5355
fi
5456

55-
mkdir -p "/app/vendor/libwebp" \
56-
&& curl "${PHP_BASE_URL}/package/libwebp-${webp_version}.tgz" | tar xzv -C /app/vendor/libwebp
57-
5857
export WEBP_LIBS="-L/app/vendor/libwebp/lib -lwebp"
5958
export WEBP_CFLAGS="-I/app/vendor/libwebp/include"
6059

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"
101105

102106
mkdir package
103107
pushd /app/vendor/php > /dev/null
104-
tar zcvf "${tempdir}/package/php-${php_version}.tgz" .
108+
tar zcf "${tempdir}/package/php-${php_version}.tgz" .
105109
popd > /dev/null
106110

107111
echo "-----> Moving package to Swift"

0 commit comments

Comments
 (0)