From 176c18583415140f41a0879b2a07443a86e30109 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 26 Jan 2021 15:16:04 +0100 Subject: [PATCH 1/2] Simplify handling of PECL package names Test: http --- install-php-extensions | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/install-php-extensions b/install-php-extensions index c76ebfb..ecec568 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -123,6 +123,23 @@ normalizePHPModuleName() { printf '%s' "$normalizePHPModuleName_name" } +# Get the PECL name of PHP extension +# +# Arguments: +# $1: the name of the extension +# +# Output: +# The PECL name of the extension +getPeclModuleName() { + normalizePHPModuleName_name="$1" + case "$normalizePHPModuleName_name" in + http) + normalizePHPModuleName_name=pecl_http + ;; + esac + printf '%s' "$normalizePHPModuleName_name" +} + # Parse a module name (and optionally version) as received via command arguments, extracting the version and normalizing it # Example: # xdebug-2.9.8 @@ -1034,9 +1051,11 @@ setTargetTriplet() { getCompilationProcessorCount() { case "$1" in amqp | bcmath | bz2 | calendar | exif | gd | gettext | grpc | imagick | intl | mysqli | opcache | pcntl | pdo_mysql | protobuf | redis | soap | sockets | tidy | xdebug | xsl | yaml | zip) + # These extensions support parallel compilation getProcessorCount ;; *) + # We don't know - it's safer to disable parallel compilation echo 1 ;; esac @@ -1525,7 +1544,6 @@ installRemoteModule() { fi ;; http) - installRemoteModule_module=pecl_http if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=2.6.0 @@ -2126,12 +2144,8 @@ installRemoteModule() { docker-php-ext-enable "$installRemoteModule_module" fi ;; - pecl_http) - # http must be loaded after raphf and propro - docker-php-ext-enable --ini-name "xx-php-ext-http.ini" http - ;; - memcached) - # memcached must be loaded after msgpack + http | memcached) + # http must be loaded after raphf and propro, memcached must be loaded after msgpack docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" "$installRemoteModule_module" ;; snuffleupagus) @@ -2223,18 +2237,19 @@ installPeclPackage() { if ! test -f "$CONFIGURE_FILE"; then printf '\n' >"$CONFIGURE_FILE" fi + installPeclPackage_name="$(getPeclModuleName "$1")" if test $USE_PICKLE -eq 0; then if test -z "${2:-}"; then - installPeclPackage_fullname="$1" + installPeclPackage_fullname="$installPeclPackage_name" else - installPeclPackage_fullname="$1-$2" + installPeclPackage_fullname="$installPeclPackage_name-$2" fi cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" pecl install "$installPeclPackage_fullname" else if test -z "${2:-}"; then - installPeclPackage_fullname="$1" + installPeclPackage_fullname="$installPeclPackage_name" else - installPeclPackage_fullname="$1@$2" + installPeclPackage_fullname="$installPeclPackage_name@$2" fi MAKE="make -j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" /tmp/pickle install --tmp-dir=/tmp/pickle.tmp --no-interaction --version-override='' --with-configure-options "$CONFIGURE_FILE" -- "$installPeclPackage_fullname" fi From 46db5e452ab5bdc5308e51c81e440a0f2c0e6b20 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 26 Jan 2021 15:41:48 +0100 Subject: [PATCH 2/2] Enable parallel compilation for the HTTP extension --- install-php-extensions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-php-extensions b/install-php-extensions index ecec568..ddf02f1 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -1050,7 +1050,7 @@ setTargetTriplet() { # The number of processors to be used getCompilationProcessorCount() { case "$1" in - amqp | bcmath | bz2 | calendar | exif | gd | gettext | grpc | imagick | intl | mysqli | opcache | pcntl | pdo_mysql | protobuf | redis | soap | sockets | tidy | xdebug | xsl | yaml | zip) + amqp | bcmath | bz2 | calendar | exif | gd | gettext | grpc | http | imagick | intl | mysqli | opcache | pcntl | pdo_mysql | protobuf | redis | soap | sockets | tidy | xdebug | xsl | yaml | zip) # These extensions support parallel compilation getProcessorCount ;;