diff --git a/install-php-extensions b/install-php-extensions index 92d4c88..6babddd 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -178,7 +178,6 @@ sortModulesToInstall() { # Get the required APT/APK packages for a specific PHP version and for the list of module handles # # Arguments: -# $1: the numeric PHP Major-Minor version # $@: the PHP module handles # # Set: @@ -188,7 +187,6 @@ sortModulesToInstall() { buildRequiredPackageLists() { buildRequiredPackageLists_persistent='' buildRequiredPackageLists_volatile='' - buildRequiredPackageLists_phpv=$1 case "$DISTRO" in alpine) apk update @@ -213,10 +211,9 @@ buildRequiredPackageLists() { ;; esac while :; do - if test $# -lt 2; then + if test $# -lt 1; then break fi - shift case "$1@$DISTRO" in amqp@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent rabbitmq-c" @@ -261,7 +258,7 @@ buildRequiredPackageLists() { gd@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetype libjpeg-turbo libpng libxpm" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetype-dev libjpeg-turbo-dev libpng-dev libxpm-dev" - if test $buildRequiredPackageLists_phpv -le 506; then + if test $PHP_MAJMIN_VERSION -le 506; then buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libvpx" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libvpx-dev" else @@ -272,7 +269,7 @@ buildRequiredPackageLists() { gd@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libfreetype6 libjpeg62-turbo libpng[0-9]+-[0-9]+$ libxpm4" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libfreetype6-dev libjpeg62-turbo-dev libpng-dev libxpm-dev" - if test $buildRequiredPackageLists_phpv -le 506; then + if test $PHP_MAJMIN_VERSION -le 506; then buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libvpx[0-9]+$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libvpx-dev" else @@ -309,7 +306,7 @@ buildRequiredPackageLists() { http@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libevent" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev curl-dev libevent-dev" - if test $buildRequiredPackageLists_phpv -le 506; then + if test $PHP_MAJMIN_VERSION -le 506; then buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libidn" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libidn-dev" else @@ -320,7 +317,7 @@ buildRequiredPackageLists() { http@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls libevent[0-9\.\-]*$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib1g-dev libgnutls28-dev libcurl4-gnutls-dev libevent-dev" - if test $buildRequiredPackageLists_phpv -le 506; then + if test $PHP_MAJMIN_VERSION -le 506; then buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libidn1[0-9+]-dev$" else buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libicu[0-9]+$ libidn2-[0-9+]$" @@ -419,12 +416,12 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev" ;; oauth@alpine) - if test $buildRequiredPackageLists_phpv -ge 700; then + if test $PHP_MAJMIN_VERSION -ge 700; then buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile pcre-dev" fi ;; oauth@debian) - if test $buildRequiredPackageLists_phpv -ge 700; then + if test $PHP_MAJMIN_VERSION -ge 700; then buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpcre3-dev" fi ;; @@ -508,7 +505,7 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile librecode-dev" ;; redis@alpine) - if test $buildRequiredPackageLists_phpv -ge 700; then + if test $PHP_MAJMIN_VERSION -ge 700; then case "$DISTRO_VERSION" in alpine@3.7) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent zstd" @@ -521,7 +518,7 @@ buildRequiredPackageLists() { fi ;; redis@debian) - if test $buildRequiredPackageLists_phpv -ge 700; then + if test $PHP_MAJMIN_VERSION -ge 700; then case "$DISTRO_VERSION" in debian@8) ## There's no APT package for libzstd @@ -655,6 +652,7 @@ buildRequiredPackageLists() { esac ;; esac + shift done PACKAGES_PERSISTENT='' PACKAGES_VOLATILE='' @@ -825,8 +823,7 @@ compareVersions() { # Install a bundled PHP module given its handle # # Arguments: -# $1: the numeric PHP Major-Minor version -# $2: the handle of the PHP module +# $1: the handle of the PHP module # # Set: # UNNEEDED_PACKAGE_LINKS @@ -834,21 +831,21 @@ compareVersions() { # Output: # Nothing installBundledModule() { - printf '### INSTALLING BUNDLED MODULE %s ###\n' "$2" - case "$2" in + printf '### INSTALLING BUNDLED MODULE %s ###\n' "$1" + case "$1" in gd) - if test $1 -le 506; then + if test $PHP_MAJMIN_VERSION -le 506; then docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-vpx-dir - elif test $1 -le 701; then + elif test $PHP_MAJMIN_VERSION -le 701; then docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-webp-dir - elif test $1 -le 703; then + elif test $PHP_MAJMIN_VERSION -le 703; then docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --with-webp-dir else docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype fi ;; gmp) - if test $1 -le 506; then + if test $PHP_MAJMIN_VERSION -le 506; then if ! test -f /usr/include/gmp.h; then ln -s /usr/include/x86_64-linux-gnu/gmp.h /usr/include/gmp.h UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/include/gmp.h" @@ -883,7 +880,7 @@ installBundledModule() { ln -s /usr/lib/libfbclient.so /usr/lib/libfbclient.so.2 cd - >/dev/null fi - CFLAGS='-I/tmp/src/firebird/src/jrd -I/tmp/src/firebird/src/include -I/tmp/src/firebird/src/include/gen' docker-php-ext-configure $2 + CFLAGS='-I/tmp/src/firebird/src/jrd -I/tmp/src/firebird/src/include -I/tmp/src/firebird/src/include/gen' docker-php-ext-configure $1 ;; esac ;; @@ -895,7 +892,7 @@ installBundledModule() { esac ;; mssql | pdo_dblib) - if test $1 -le 704; then + if test $PHP_MAJMIN_VERSION -le 704; then if ! test -f /usr/lib/libsybdb.so; then ln -s /usr/lib/x86_64-linux-gnu/libsybdb.so /usr/lib/libsybdb.so UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS /usr/lib/libsybdb.so" @@ -903,7 +900,7 @@ installBundledModule() { fi ;; odbc) - if test $1 -le 704; then + if test $PHP_MAJMIN_VERSION -le 704; then docker-php-source extract cd /usr/src/php/ext/odbc phpize @@ -936,17 +933,17 @@ installBundledModule() { esac ;; zip) - if test $1 -le 505; then + if test $PHP_MAJMIN_VERSION -le 505; then docker-php-ext-configure zip - elif test $1 -le 703; then + elif test $PHP_MAJMIN_VERSION -le 703; then docker-php-ext-configure zip --with-libzip else docker-php-ext-configure zip --with-zip fi ;; esac - docker-php-ext-install -j$(nproc) "$2" - case "$2" in + docker-php-ext-install -j$(nproc) "$1" + case "$1" in imap) case "$DISTRO_VERSION" in debian@9) @@ -1434,7 +1431,7 @@ fi sortModulesToInstall -buildRequiredPackageLists $PHP_MAJMIN_VERSION $PHP_MODULES_TO_INSTALL +buildRequiredPackageLists $PHP_MODULES_TO_INSTALL if test -n "$PACKAGES_PERSISTENT$PACKAGES_VOLATILE"; then installRequiredPackages fi @@ -1442,7 +1439,7 @@ docker-php-source extract BUNDLED_MODULES="$(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | xargs -n1 dirname | xargs -n1 basename | xargs)" for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do if stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then - installBundledModule $PHP_MAJMIN_VERSION "$PHP_MODULE_TO_INSTALL" + installBundledModule "$PHP_MODULE_TO_INSTALL" else MODULE_SOURCE='' MODULE_SOURCE_CONFIGOPTIONS=''