From 3e2b610d74552d6e0464abb5945b56983036a6d6 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Thu, 8 Aug 2024 09:43:34 +0200 Subject: [PATCH] Fix installing gd and vips at the same time (#955) --- install-php-extensions | 61 +++++++++++++++++++++++++++----------- scripts/ci-test-extensions | 32 +++++++++++++------- 2 files changed, 65 insertions(+), 28 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index bb6b9230..d4f3ef59 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -662,9 +662,11 @@ expandASpellDictionaries() { # PACKAGES_PERSISTENT_PRE the list of packages required at runtume that are already installed # PACKAGES_VOLATILE the list of packages required at compile time that must be installed # PACKAGES_PREVIOUS the list of packages (with their version) that are installed right now (calculated only on Debian and only if PACKAGES_PERSISTENT_NEW or PACKAGES_VOLATILE are not empty) +# COMPILE_LIBS buildRequiredPackageLists() { buildRequiredPackageLists_persistent='' buildRequiredPackageLists_volatile='' + COMPILE_LIBS='' case "$DISTRO" in alpine) apk update @@ -844,6 +846,18 @@ buildRequiredPackageLists() { case "${IPE_GD_WITHOUTAVIF:-}" in 1 | y* | Y*) ;; *) + if ! isLibaomInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libaom" + fi + if ! isLibdav1dInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libdav1d" + fi + if ! isLibyuvInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libyuv" + fi + if ! isLibavifInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libavif" + fi buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake nasm meson" ;; @@ -869,6 +883,18 @@ buildRequiredPackageLists() { case "${IPE_GD_WITHOUTAVIF:-}" in 1 | y* | Y*) ;; *) + if ! isLibaomInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libaom" + fi + if ! isLibdav1dInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libdav1d" + fi + if ! isLibyuvInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libyuv" + fi + if ! isLibavifInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libavif" + fi buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake nasm meson" ;; esac @@ -2472,6 +2498,22 @@ You may need to: EOT } +# Compile the libraries specified in the COMPILE_LIBS variable +compileLibs() { + if stringInList libaom "$COMPILE_LIBS"; then + installLibaom + fi + if stringInList libdav1d "$COMPILE_LIBS"; then + installLibdav1d + fi + if stringInList libyuv "$COMPILE_LIBS"; then + installLibyuv + fi + if stringInList libavif "$COMPILE_LIBS"; then + installLibavif + fi +} + # Install a bundled PHP module given its handle # # Arguments: @@ -2568,23 +2610,6 @@ EOF ;; esac if test $installBundledModule_tmp -eq 0; then - case "${IPE_GD_WITHOUTAVIF:-}" in - 1 | y* | Y*) ;; - *) - if ! isLibaomInstalled; then - installLibaom - fi - if ! isLibdav1dInstalled; then - installLibdav1d - fi - if ! isLibyuvInstalled; then - installLibyuv - fi - if ! isLibavifInstalled; then - installLibavif - fi - ;; - esac if isLibaomInstalled && isLibdav1dInstalled && isLibyuvInstalled && isLibavifInstalled; then installBundledModule_tmp=1 fi @@ -4829,6 +4854,8 @@ if test $USE_PICKLE -gt 1; then buildPickle fi +compileLibs + for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do case "$PHP_MODULE_TO_INSTALL" in @fix_letsencrypt) diff --git a/scripts/ci-test-extensions b/scripts/ci-test-extensions index 5ef6ff9c..e443cc32 100755 --- a/scripts/ci-test-extensions +++ b/scripts/ci-test-extensions @@ -127,13 +127,20 @@ filterUnsupportedExensionsForDistro() { ;; esac - for filterUnsupportedExensionsForDistro_extension in $EXTENSIONS_TO_BE_TESTED; do - if stringInList "!$IPETEST_DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$filterUnsupportedExensionsForDistro_extension[ \t]")"; then - printf 'Note: extension "%s" is not supported for distro "%s"\n' "$filterUnsupportedExensionsForDistro_extension" "$IPETEST_DOCKER_DISTRO" - elif stringInList "!$filterUnsupportedExensionsForDistro_baseDistro" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$filterUnsupportedExensionsForDistro_extension[ \t]")"; then - printf 'Note: extension "%s" is not supported for distro "%s"\n' "$filterUnsupportedExensionsForDistro_extension" "$filterUnsupportedExensionsForDistro_baseDistro" - else - filterUnsupportedExensionsForDistro_filtered="$filterUnsupportedExensionsForDistro_filtered $filterUnsupportedExensionsForDistro_extension" + for filterUnsupportedExensionsForDistro_extensions in $EXTENSIONS_TO_BE_TESTED; do + filterUnsupportedExensionsForDistro_ok=1 + IFS='+' + for filterUnsupportedExensionsForDistro_extension in $filterUnsupportedExensionsForDistro_extensions; do + if stringInList "!$IPETEST_DOCKER_DISTRO" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$filterUnsupportedExensionsForDistro_extension[ \t]")"; then + printf 'Note: extension "%s" is not supported for distro "%s"\n' "$filterUnsupportedExensionsForDistro_extension" "$IPETEST_DOCKER_DISTRO" + filterUnsupportedExensionsForDistro_ok=0 + elif stringInList "!$filterUnsupportedExensionsForDistro_baseDistro" "$(cat "$filterUnsupportedExensionsForDistro_reqs" | grep -E "^$filterUnsupportedExensionsForDistro_extension[ \t]")"; then + printf 'Note: extension "%s" is not supported for distro "%s"\n' "$filterUnsupportedExensionsForDistro_extension" "$filterUnsupportedExensionsForDistro_baseDistro" + filterUnsupportedExensionsForDistro_ok=0 + fi + done + if test $filterUnsupportedExensionsForDistro_ok -eq 1; then + filterUnsupportedExensionsForDistro_filtered="$filterUnsupportedExensionsForDistro_filtered $filterUnsupportedExensionsForDistro_extensions" fi done resetIFS @@ -164,10 +171,13 @@ getDockerImageName() { getDockerImageName_reqs="$CI_BUILD_DIR/data/special-requirements" if test -f "$getDockerImageName_reqs"; then IFS=' ' - for getDockerImageName_testExtension in $1; do - if test -n "$(cat "$getDockerImageName_reqs" | grep -E "^$getDockerImageName_testExtension[ \t]+zts[ \t]*$")"; then - getDockerImageName_suffix='zts' - fi + for getDockerImageName_testExtensions in $1; do + IFS='+' + for getDockerImageName_testExtension in $getDockerImageName_testExtensions; do + if test -n "$(cat "$getDockerImageName_reqs" | grep -E "^$getDockerImageName_testExtension[ \t]+zts[ \t]*$")"; then + getDockerImageName_suffix='zts' + fi + done done fi getDockerImageName_imageName="$(printf 'php:%s-%s-%s' "$getDockerImageName_version" "$getDockerImageName_suffix" "$IPETEST_DOCKER_DISTRO")"