Merge pull request #280 from mlocati/simplify-handling-of-pecl-names

Simplify handling of PECL package names
pull/281/head
Michele Locati 2021-01-26 15:52:17 +01:00 committed by GitHub
commit 764446f602
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 27 additions and 12 deletions

View File

@ -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
@ -1033,10 +1050,12 @@ 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
;;
*)
# 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