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" 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 # Parse a module name (and optionally version) as received via command arguments, extracting the version and normalizing it
# Example: # Example:
# xdebug-2.9.8 # xdebug-2.9.8
@ -1033,10 +1050,12 @@ setTargetTriplet() {
# The number of processors to be used # The number of processors to be used
getCompilationProcessorCount() { getCompilationProcessorCount() {
case "$1" in 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 getProcessorCount
;; ;;
*) *)
# We don't know - it's safer to disable parallel compilation
echo 1 echo 1
;; ;;
esac esac
@ -1525,7 +1544,6 @@ installRemoteModule() {
fi fi
;; ;;
http) http)
installRemoteModule_module=pecl_http
if test -z "$installRemoteModule_version"; then if test -z "$installRemoteModule_version"; then
if test $PHP_MAJMIN_VERSION -le 506; then if test $PHP_MAJMIN_VERSION -le 506; then
installRemoteModule_version=2.6.0 installRemoteModule_version=2.6.0
@ -2126,12 +2144,8 @@ installRemoteModule() {
docker-php-ext-enable "$installRemoteModule_module" docker-php-ext-enable "$installRemoteModule_module"
fi fi
;; ;;
pecl_http) http | memcached)
# http must be loaded after raphf and propro # http must be loaded after raphf and propro, memcached must be loaded after msgpack
docker-php-ext-enable --ini-name "xx-php-ext-http.ini" http
;;
memcached)
# memcached must be loaded after msgpack
docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" "$installRemoteModule_module" docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" "$installRemoteModule_module"
;; ;;
snuffleupagus) snuffleupagus)
@ -2223,18 +2237,19 @@ installPeclPackage() {
if ! test -f "$CONFIGURE_FILE"; then if ! test -f "$CONFIGURE_FILE"; then
printf '\n' >"$CONFIGURE_FILE" printf '\n' >"$CONFIGURE_FILE"
fi fi
installPeclPackage_name="$(getPeclModuleName "$1")"
if test $USE_PICKLE -eq 0; then if test $USE_PICKLE -eq 0; then
if test -z "${2:-}"; then if test -z "${2:-}"; then
installPeclPackage_fullname="$1" installPeclPackage_fullname="$installPeclPackage_name"
else else
installPeclPackage_fullname="$1-$2" installPeclPackage_fullname="$installPeclPackage_name-$2"
fi fi
cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" pecl install "$installPeclPackage_fullname" cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" pecl install "$installPeclPackage_fullname"
else else
if test -z "${2:-}"; then if test -z "${2:-}"; then
installPeclPackage_fullname="$1" installPeclPackage_fullname="$installPeclPackage_name"
else else
installPeclPackage_fullname="$1@$2" installPeclPackage_fullname="$installPeclPackage_name@$2"
fi 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" 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 fi