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