Let users install a specific PHP module version

Test: amqp,apcu,gmagick,http,pecl_http,igbinary,memcache,mailparse,memcached,mongodb,mosquitto,msgpack,oauth,opencensus,parallel,pcov,pdo_sqlsrv,sqlsrv,propro,protobuf,pthreads,raphf,rdkafka,redis,solr,ssh2,uuid,xdebug,uopz,xhprof,yaml
pull/194/head
Michele Locati 2020-12-02 18:19:24 +01:00
parent a48eab9e71
commit 4ee43e5429
No known key found for this signature in database
GPG Key ID: 98B7CE2E7234E28B
4 changed files with 308 additions and 125 deletions

View File

@ -76,3 +76,21 @@ jobs:
with: with:
fetch-depth: 1 fetch-depth: 1
- run: docker run --rm --volume "$(pwd):/app" --workdir /app php:7.3-stretch ./scripts/test-restore-apt - run: docker run --rm --volume "$(pwd):/app" --workdir /app php:7.3-stretch ./scripts/test-restore-apt
test_custom_version:
name: Test installing specific versions
needs:
- check_syntax_shell
- check_syntax_php
runs-on: ubuntu-latest
strategy:
matrix:
xdebug_version:
- ''
- 2.9.8
- 3.0.0
steps:
- name: Checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- run: docker run --rm --volume "$(pwd):/app" --workdir /app php:7.4-alpine ./scripts/test-installversion "${{ matrix.xdebug_version }}"

View File

@ -9,7 +9,6 @@ The script will install all the required APT/APK packages; at the end of the scr
Supported docker images are all the Alpine/Debian versions, except for PHP 5.5 where we only support Debian 8 (jessie) (that is, `php:5.5`, `php:5.5-apache`, `php:5.5-cli`, `php:5.5-fpm`, `php:5.5-zts`). Supported docker images are all the Alpine/Debian versions, except for PHP 5.5 where we only support Debian 8 (jessie) (that is, `php:5.5`, `php:5.5-apache`, `php:5.5-cli`, `php:5.5-fpm`, `php:5.5-zts`).
See also the notes in the [Special requirements](#special-requirements) section. See also the notes in the [Special requirements](#special-requirements) section.
## Usage ## Usage
You have two ways to use this script within your `Dockerfile`s: you can download the script on the fly, or you can grab it from the [`mlocati/php-extension-installer` Docker Hub image](https://hub.docker.com/r/mlocati/php-extension-installer). You have two ways to use this script within your `Dockerfile`s: you can download the script on the fly, or you can grab it from the [`mlocati/php-extension-installer` Docker Hub image](https://hub.docker.com/r/mlocati/php-extension-installer).
@ -38,6 +37,15 @@ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr
RUN install-php-extensions gd xdebug RUN install-php-extensions gd xdebug
``` ```
### Installing a specific version of an extension
Simply append `-<version>` to the module name.
For example:
```sh
install-php-extensions xdebug-2.9.7
```
## Supported PHP extensions ## Supported PHP extensions
<!-- START OF EXTENSIONS TABLE --> <!-- START OF EXTENSIONS TABLE -->
@ -199,7 +207,6 @@ Some extension has special requirements:
| <a name="special-requirements-for-tdlib"></a>tdlib | &bull; Not available in `alpine3.7` docker images<br />&bull; Not available in `jessie` docker images | | <a name="special-requirements-for-tdlib"></a>tdlib | &bull; Not available in `alpine3.7` docker images<br />&bull; Not available in `jessie` docker images |
<!-- END OF SPECIAL REQUIREMENTS --> <!-- END OF SPECIAL REQUIREMENTS -->
## Tests ## Tests
When submitting a pull request, a [GitHub Action](https://github.com/mlocati/docker-php-extension-installer/blob/master/.github/workflows/test-extensions.yml) is executed to check if affected PHP extensions actually work (see below). When submitting a pull request, a [GitHub Action](https://github.com/mlocati/docker-php-extension-installer/blob/master/.github/workflows/test-extensions.yml) is executed to check if affected PHP extensions actually work (see below).
@ -209,7 +216,6 @@ This is done on a scheduled basis with another [GitHub Action](https://github.co
In case of failure, a message is sent to a [Telegram Channel](https://t.me/docker_php_extension_installer). In case of failure, a message is sent to a [Telegram Channel](https://t.me/docker_php_extension_installer).
Feel free to subscribe to it to receive failure notifications. Feel free to subscribe to it to receive failure notifications.
## How to contribute ## How to contribute
### Formatting code ### Formatting code
@ -266,7 +272,6 @@ Test: gd, zip, -STOP-
See [this pull request](https://github.com/mlocati/docker-php-extension-installer/pull/43) for an example. See [this pull request](https://github.com/mlocati/docker-php-extension-installer/pull/43) for an example.
## Do you want to really say thank you? ## Do you want to really say thank you?
You can offer me a [monthly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) :wink: You can offer me a [monthly coffee](https://github.com/sponsors/mlocati) or a [one-time coffee](https://paypal.me/mlocati) :wink:

View File

@ -70,6 +70,51 @@ normalizePHPModuleName() {
printf '%s' "$normalizePHPModuleName_name" 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
#
# Arguments:
# $1: the name of the module to be normalized
#
# Set these variables:
# - PROCESSED_PHP_MODULE_ARGUMENT
#
# Optionally set these variables:
# - PHP_WANTEDMODULEVERSION_<...> (where <...> is the normalized module name)
#
# Output:
# Nothing
processPHPMuduleArgument() {
PROCESSED_PHP_MODULE_ARGUMENT="${1%%-*}"
if test -n "$PROCESSED_PHP_MODULE_ARGUMENT" && test "$PROCESSED_PHP_MODULE_ARGUMENT" != "$1"; then
processPHPMuduleArgument_version="${1#*-}"
else
processPHPMuduleArgument_version=''
fi
PROCESSED_PHP_MODULE_ARGUMENT="$(normalizePHPModuleName "$PROCESSED_PHP_MODULE_ARGUMENT")"
if test -n "$processPHPMuduleArgument_version"; then
if printf '%s' "$PROCESSED_PHP_MODULE_ARGUMENT" | grep -Eq '^[a-zA-Z0-9_]+$'; then
eval PHP_WANTEDMODULEVERSION_$PROCESSED_PHP_MODULE_ARGUMENT="$processPHPMuduleArgument_version"
else
printf 'Unable to parse the following module name:\n%s\n' "$PROCESSED_PHP_MODULE_ARGUMENT" >&2
fi
fi
}
# Get the wanted PHP module version, as specified in the command line arguments.
#
# Arguments:
# $1: the name of the module to be normalized
#
# Output:
# The wanted version (if any)
getWantedPHPModuleVersion() {
if printf '%s' "$1" | grep -Eq '^[a-zA-Z0-9_]+$'; then
eval printf '%s' "\${PHP_WANTEDMODULEVERSION_$1:-}"
fi
}
# Set these variables: # Set these variables:
# - PHP_PREINSTALLED_MODULES the normalized list of PHP modules installed before running this script # - PHP_PREINSTALLED_MODULES the normalized list of PHP modules installed before running this script
setPHPPreinstalledModules() { setPHPPreinstalledModules() {
@ -130,7 +175,8 @@ processCommandArguments() {
esac esac
fi fi
if test $processCommandArguments_skip -eq 0; then if test $processCommandArguments_skip -eq 0; then
processCommandArguments_name="$(normalizePHPModuleName "$1")" processPHPMuduleArgument "$1"
processCommandArguments_name="$PROCESSED_PHP_MODULE_ARGUMENT"
if stringInList "$processCommandArguments_name" "$PHP_MODULES_TO_INSTALL"; then if stringInList "$processCommandArguments_name" "$PHP_MODULES_TO_INSTALL"; then
printf '### WARNING Duplicated module name specified: %s ###\n' "$processCommandArguments_name" >&2 printf '### WARNING Duplicated module name specified: %s ###\n' "$processCommandArguments_name" >&2
elif stringInList "$processCommandArguments_name" "$PHP_PREINSTALLED_MODULES"; then elif stringInList "$processCommandArguments_name" "$PHP_PREINSTALLED_MODULES"; then
@ -915,6 +961,9 @@ compareVersions() {
# Nothing # Nothing
installBundledModule() { installBundledModule() {
printf '### INSTALLING BUNDLED MODULE %s ###\n' "$1" printf '### INSTALLING BUNDLED MODULE %s ###\n' "$1"
if test -n "$(getWantedPHPModuleVersion "$1")"; then
printf '### WARNING the module "%s" is bundled with PHP, you can NOT specify a version for it\n' "$1" >&2
fi
case "$1" in case "$1" in
gd) gd)
if test $PHP_MAJMIN_VERSION -le 506; then if test $PHP_MAJMIN_VERSION -le 506; then
@ -1104,22 +1153,27 @@ installModuleFromSource() {
# Arguments: # Arguments:
# $1: the handle of the PHP module # $1: the handle of the PHP module
installPECLModule() { installPECLModule() {
printf '### INSTALLING PECL MODULE %s ###\n' "$1" installPECLModule_module="$1"
installPECLModule_actual="$1" printf '### INSTALLING PECL MODULE %s ###\n' "$installPECLModule_module"
installPECLModule_version="$(getWantedPHPModuleVersion "$installPECLModule_module")"
rm -rf "$CONFIGURE_FILE" rm -rf "$CONFIGURE_FILE"
installPECLModule_manuallyInstalled=0 installPECLModule_manuallyInstalled=0
case "$1" in case "$installPECLModule_module" in
amqp) amqp)
case "$DISTRO_VERSION" in case "$DISTRO_VERSION" in
debian@8) debian@8)
# in Debian Jessie we have librammitmq version 0.5.2 if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.9.3" # in Debian Jessie we have librammitmq version 0.5.2
installPECLModule_version=1.9.3
fi
;; ;;
esac esac
;; ;;
apcu) apcu)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-4.0.11" if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=4.0.11
fi
fi fi
;; ;;
decimal) decimal)
@ -1135,17 +1189,22 @@ installPECLModule() {
esac esac
;; ;;
gmagick) gmagick)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.1.7RC3" if test $PHP_MAJMIN_VERSION -le 506; then
else installPECLModule_version=1.1.7RC3
installPECLModule_actual="$1-beta" else
installPECLModule_version=beta
fi
fi fi
;; ;;
http) http)
if test $PHP_MAJMIN_VERSION -le 506; then installPECLModule_module=pecl_http
installPECLModule_actual="pecl_http-2.6.0" if test -z "$installPECLModule_version"; then
else if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_actual="pecl_http" installPECLModule_version=2.6.0
fi
fi
if test $PHP_MAJMIN_VERSION -ge 700; then
if ! test -e /usr/local/lib/libidnkit.so; then if ! test -e /usr/local/lib/libidnkit.so; then
installPECLModule_src="$(getPackageSource https://jprs.co.jp/idn/idnkit-2.3.tar.bz2)" installPECLModule_src="$(getPackageSource https://jprs.co.jp/idn/idnkit-2.3.tar.bz2)"
cd -- "$installPECLModule_src" cd -- "$installPECLModule_src"
@ -1156,26 +1215,35 @@ installPECLModule() {
fi fi
;; ;;
igbinary) igbinary)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.0.8" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=2.0.8
fi
fi fi
;; ;;
memcache) memcache)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.2.7" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=2.2.7
fi
fi fi
;; ;;
mailparse) mailparse)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.1.6" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=2.1.6
fi
fi fi
;; ;;
memcached) memcached)
if test -z "$installPECLModule_version"; then
if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=2.2.0
fi
fi
# Set the path to libmemcached install prefix # Set the path to libmemcached install prefix
addConfigureOption 'with-libmemcached-dir' 'no' addConfigureOption 'with-libmemcached-dir' 'no'
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version" || test $(compareVersions "$installPECLModule_version" '3.0.0') -ge 0; then
installPECLModule_actual="$1-2.2.0"
else
# Set the path to ZLIB install prefix # Set the path to ZLIB install prefix
addConfigureOption 'with-zlib-dir' 'no' addConfigureOption 'with-zlib-dir' 'no'
# Use system FastLZ library # Use system FastLZ library
@ -1207,31 +1275,45 @@ installPECLModule() {
addConfigureOption '-with-mongo-sasl' 'yes' addConfigureOption '-with-mongo-sasl' 'yes'
;; ;;
mongodb) mongodb)
if test $PHP_MAJMIN_VERSION -le 505; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.5.5" if test $PHP_MAJMIN_VERSION -le 505; then
elif test $PHP_MAJMIN_VERSION -le 506; then installPECLModule_version=1.5.5
installPECLModule_actual="$1-1.7.5" elif test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=1.7.5
fi
fi fi
;; ;;
mosquitto) mosquitto)
installPECLModule_actual="$1-0.4.0" if test -z "$installPECLModule_version"; then
installPECLModule_version=0.4.0
fi
;; ;;
msgpack) msgpack)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-0.5.7" if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=0.5.7
fi
fi fi
;; ;;
oauth) oauth)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.2.3" if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=1.2.3
fi
fi fi
;; ;;
opencensus) opencensus)
if test $PHP_MAJMIN_VERSION -le 702; then if test $PHP_MAJMIN_VERSION -le 702; then
installPECLModule_actual="$1-alpha" if test -z "$installPECLModule_version"; then
installPECLModule_version=alpha
fi
else else
installPECLModule_manuallyInstalled=1 installPECLModule_manuallyInstalled=1
installPECLModule_src="$(getPackageSource https://pecl.php.net/get/opencensus)" if test -z "$installPECLModule_version"; then
installPECLModule_src="$(getPackageSource https://pecl.php.net/get/opencensus)"
else
installPECLModule_src="$(getPackageSource https://pecl.php.net/get/opencensus-$installPECLModule_version)"
fi
cd "$installPECLModule_src"/opencensus-* cd "$installPECLModule_src"/opencensus-*
find . -name '*.c' -type f -exec sed -i 's/\bZVAL_DESTRUCTOR\b/zval_dtor/g' {} + find . -name '*.c' -type f -exec sed -i 's/\bZVAL_DESTRUCTOR\b/zval_dtor/g' {} +
phpize phpize
@ -1241,67 +1323,90 @@ installPECLModule() {
fi fi
;; ;;
parallel) parallel)
if test $PHP_MAJMIN_VERSION -le 701; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-0.8.3" if test $PHP_MAJMIN_VERSION -le 701; then
installPECLModule_version=0.8.3
fi
fi fi
;; ;;
pcov) pcov)
if test $PHP_MAJMIN_VERSION -lt 701; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-0.9.0" if test $PHP_MAJMIN_VERSION -lt 701; then
installPECLModule_version=0.9.0
fi
fi fi
;; ;;
pdo_sqlsrv | sqlsrv) pdo_sqlsrv | sqlsrv)
# https://docs.microsoft.com/it-it/sql/connect/php/system-requirements-for-the-php-sql-driver?view=sql-server-2017 if test -z "$installPECLModule_version"; then
if test $PHP_MAJMIN_VERSION -le 700; then # https://docs.microsoft.com/it-it/sql/connect/php/system-requirements-for-the-php-sql-driver?view=sql-server-2017
installPECLModule_actual="$1-5.3.0" if test $PHP_MAJMIN_VERSION -le 700; then
elif test $PHP_MAJMIN_VERSION -le 701; then installPECLModule_version=5.3.0
installPECLModule_actual="$1-5.6.1" elif test $PHP_MAJMIN_VERSION -le 701; then
installPECLModule_version=5.6.1
fi
fi fi
;; ;;
propro) propro)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.0.2" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=1.0.2
fi
fi fi
;; ;;
protobuf) protobuf)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-3.12.4" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=3.12.4
else
installPECLModule_version=3.13.0
fi
fi fi
;; ;;
pthreads) pthreads)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.0.10" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=2.0.10
fi
fi fi
;; ;;
raphf) raphf)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.1.2" if test $PHP_MAJMIN_VERSION -lt 700; then
installPECLModule_version=1.1.2
fi
fi fi
;; ;;
rdkafka) rdkafka)
if test $PHP_MAJMIN_VERSION -le 505; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-3.0.5" if test $PHP_MAJMIN_VERSION -le 505; then
else installPECLModule_version=3.0.5
installPECLModule_tmp= else
case "$DISTRO" in installPECLModule_tmp=
alpine) case "$DISTRO" in
installPECLModule_tmp='librdkafka' alpine)
;; installPECLModule_tmp='librdkafka'
debian) ;;
installPECLModule_tmp='librdkafka*' debian)
;; installPECLModule_tmp='librdkafka*'
esac ;;
if test -n "$installPECLModule_tmp"; then esac
installPECLModule_tmp="$(getInstalledPackageVersion "$installPECLModule_tmp")"
if test -n "$installPECLModule_tmp"; then if test -n "$installPECLModule_tmp"; then
if test $(compareVersions "$installPECLModule_tmp" '0.11.0') -lt 0; then installPECLModule_tmp="$(getInstalledPackageVersion "$installPECLModule_tmp")"
installPECLModule_actual="$1-3.1.3" if test -n "$installPECLModule_tmp"; then
if test $(compareVersions "$installPECLModule_tmp" '0.11.0') -lt 0; then
installPECLModule_version=3.1.3
fi
fi fi
fi fi
fi fi
fi fi
;; ;;
redis) redis)
if test -z "$installPECLModule_version"; then
if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=4.3.0
fi
fi
# Enable igbinary serializer support? # Enable igbinary serializer support?
if php --ri igbinary >/dev/null 2>/dev/null; then if php --ri igbinary >/dev/null 2>/dev/null; then
addConfigureOption 'enable-redis-igbinary' 'yes' addConfigureOption 'enable-redis-igbinary' 'yes'
@ -1310,9 +1415,7 @@ installPECLModule() {
fi fi
# Enable lzf compression support? # Enable lzf compression support?
addConfigureOption 'enable-redis-lzf' 'yes' addConfigureOption 'enable-redis-lzf' 'yes'
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version" || test $(compareVersions "$installPECLModule_version" '5.0.0') -ge 0; then
installPECLModule_actual="$1-4.3.0"
else
installPECLModule_machine=$(getTargetTriplet) installPECLModule_machine=$(getTargetTriplet)
if ! test -e /usr/include/zstd.h || ! test -e /usr/lib/libzstd.so -o -e "/usr/lib/$installPECLModule_machine/libzstd.so"; then if ! test -e /usr/include/zstd.h || ! test -e /usr/lib/libzstd.so -o -e "/usr/lib/$installPECLModule_machine/libzstd.so"; then
installPECLModule_zstdVersion=1.4.4 installPECLModule_zstdVersion=1.4.4
@ -1333,15 +1436,19 @@ installPECLModule() {
fi fi
;; ;;
solr) solr)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.4.0" if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=2.4.0
fi
fi fi
;; ;;
ssh2) ssh2)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-0.13" if test $PHP_MAJMIN_VERSION -le 506; then
else installPECLModule_version=0.13
installPECLModule_actual="$1-1.2" else
installPECLModule_version=1.2
fi
fi fi
;; ;;
tdlib) tdlib)
@ -1368,26 +1475,34 @@ installPECLModule() {
installPECLModule_manuallyInstalled=1 installPECLModule_manuallyInstalled=1
;; ;;
uuid) uuid)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.0.5" if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=1.0.5
fi
fi fi
;; ;;
xdebug) xdebug)
if test $PHP_MAJMIN_VERSION -le 500; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.0.5" if test $PHP_MAJMIN_VERSION -le 500; then
elif test $PHP_MAJMIN_VERSION -le 503; then installPECLModule_version=2.0.5
installPECLModule_actual="$1-2.2.7" elif test $PHP_MAJMIN_VERSION -le 503; then
elif test $PHP_MAJMIN_VERSION -le 504; then installPECLModule_version=2.2.7
installPECLModule_actual="$1-2.4.1" elif test $PHP_MAJMIN_VERSION -le 504; then
elif test $PHP_MAJMIN_VERSION -le 506; then installPECLModule_version=2.4.1
installPECLModule_actual="$1-2.5.5" elif test $PHP_MAJMIN_VERSION -le 506; then
elif test $PHP_MAJMIN_VERSION -le 700; then installPECLModule_version=2.5.5
installPECLModule_actual="$1-2.6.1" elif test $PHP_MAJMIN_VERSION -le 700; then
elif test $PHP_MAJMIN_VERSION -le 701; then installPECLModule_version=2.6.1
installPECLModule_actual="$1-2.9.8" elif test $PHP_MAJMIN_VERSION -le 701; then
elif test $PHP_MAJMIN_VERSION -ge 800; then installPECLModule_version=2.9.8
fi
fi
if test $PHP_MAJMIN_VERSION -ge 800; then
# Workaround for picke problem - see https://github.com/FriendsOfPHP/pickle/issues/188 and https://github.com/FriendsOfPHP/pickle/issues/191 # Workaround for picke problem - see https://github.com/FriendsOfPHP/pickle/issues/188 and https://github.com/FriendsOfPHP/pickle/issues/191
installPECLModule_src="$(getPackageSource https://codeload.github.com/xdebug/xdebug/tar.gz/3.0.0)" if test -z "$installPECLModule_version"; then
installPECLModule_version=3.0.0
fi
installPECLModule_src="$(getPackageSource https://codeload.github.com/xdebug/xdebug/tar.gz/$installPECLModule_version)"
cd -- "$installPECLModule_src" cd -- "$installPECLModule_src"
phpize phpize
./configure --enable-xdebug ./configure --enable-xdebug
@ -1398,22 +1513,28 @@ installPECLModule() {
fi fi
;; ;;
uopz) uopz)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-2.0.7" if test $PHP_MAJMIN_VERSION -lt 700; then
elif test $PHP_MAJMIN_VERSION -lt 701; then installPECLModule_version=2.0.7
installPECLModule_actual="$1-5.0.2" elif test $PHP_MAJMIN_VERSION -lt 701; then
installPECLModule_version=5.0.2
fi
fi fi
;; ;;
xhprof) xhprof)
if test $PHP_MAJMIN_VERSION -le 506; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-0.9.4" if test $PHP_MAJMIN_VERSION -le 506; then
installPECLModule_version=0.9.4
fi
fi fi
;; ;;
yaml) yaml)
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-1.3.1" if test $PHP_MAJMIN_VERSION -lt 700; then
elif test $PHP_MAJMIN_VERSION -lt 701; then installPECLModule_version=1.3.1
installPECLModule_actual="$1-2.0.4" elif test $PHP_MAJMIN_VERSION -lt 701; then
installPECLModule_version=2.0.4
fi
fi fi
;; ;;
zookeeper) zookeeper)
@ -1429,34 +1550,36 @@ installPECLModule() {
fi fi
;; ;;
esac esac
if test $PHP_MAJMIN_VERSION -lt 700; then if test -z "$installPECLModule_version"; then
installPECLModule_actual="$1-0.5.0" if test $PHP_MAJMIN_VERSION -lt 700; then
elif test $PHP_MAJMIN_VERSION -gt 702; then installPECLModule_version=0.5.0
installPECLModule_actual="$1-0.7.2" elif test $PHP_MAJMIN_VERSION -gt 702; then
installPECLModule_version=0.7.2
fi
fi fi
;; ;;
esac esac
if test $installPECLModule_manuallyInstalled -eq 0; then if test $installPECLModule_manuallyInstalled -eq 0; then
if test "$1" != "$installPECLModule_actual"; then if test -n "$installPECLModule_version"; then
printf ' (installing version %s)\n' "$installPECLModule_actual" printf ' (installing version %s)\n' "$installPECLModule_version"
fi fi
installPeclPackage "$installPECLModule_actual" installPeclPackage "$installPECLModule_module" "$installPECLModule_version"
fi fi
case "$1" in case "$installPECLModule_module" in
apcu_bc) apcu_bc)
# apcu_bc must be loaded after apcu # apcu_bc must be loaded after apcu
docker-php-ext-enable --ini-name "xx-php-ext-$1.ini" apc docker-php-ext-enable --ini-name "xx-php-ext-$installPECLModule_module.ini" apc
;; ;;
http) pecl_http)
# http must be loaded after raphf and propro # http must be loaded after raphf and propro
docker-php-ext-enable --ini-name "xx-php-ext-$1.ini" "$1" docker-php-ext-enable --ini-name "xx-php-ext-http.ini" http
;; ;;
memcached) memcached)
# memcached must be loaded after msgpack # memcached must be loaded after msgpack
docker-php-ext-enable --ini-name "xx-php-ext-$1.ini" "$1" docker-php-ext-enable --ini-name "xx-php-ext-$installPECLModule_module.ini" "$installPECLModule_module"
;; ;;
*) *)
docker-php-ext-enable "$1" docker-php-ext-enable "$installPECLModule_module"
;; ;;
esac esac
} }
@ -1504,14 +1627,20 @@ addConfigureOption() {
# #
# Arguments: # Arguments:
# $1: the package to be installed # $1: the package to be installed
# $2: the package version to be installed (optional)
installPeclPackage() { installPeclPackage() {
if test -z "${2:-}"; then
installPeclPackage_fullname="$1"
else
installPeclPackage_fullname="$1-$2"
fi
if ! test -f "$CONFIGURE_FILE"; then if ! test -f "$CONFIGURE_FILE"; then
printf '\n' >"$CONFIGURE_FILE" printf '\n' >"$CONFIGURE_FILE"
fi fi
if test $USE_PICKLE -eq 0; then if test $USE_PICKLE -eq 0; then
cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" pecl install "$1" cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" pecl install "$installPeclPackage_fullname"
else else
MAKE="make -j$(getCompilationProcessorCount $1)" /tmp/pickle install --tmp-dir=/tmp/pickle.tmp --no-interaction --with-configure-options "$CONFIGURE_FILE" -- "$1" MAKE="make -j$(getCompilationProcessorCount $1)" /tmp/pickle install --tmp-dir=/tmp/pickle.tmp --no-interaction --with-configure-options "$CONFIGURE_FILE" -- "$installPeclPackage_fullname"
fi fi
} }
@ -1640,14 +1769,22 @@ for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do
MODULE_SOURCE_CFLAGS='' MODULE_SOURCE_CFLAGS=''
case "$PHP_MODULE_TO_INSTALL" in case "$PHP_MODULE_TO_INSTALL" in
cmark) cmark)
MODULE_SOURCE=https://github.com/krakjoe/cmark/archive/v1.0.0.tar.gz MODULE_VERSION="$(getWantedPHPModuleVersion "$PHP_MODULE_TO_INSTALL")"
if test -z "$MODULE_VERSION"; then
MODULE_VERSION='1.0.0'
fi
MODULE_SOURCE=https://github.com/krakjoe/cmark/archive/v$MODULE_VERSION.tar.gz
cd "$(getPackageSource https://github.com/commonmark/cmark/archive/0.28.3.tar.gz)" cd "$(getPackageSource https://github.com/commonmark/cmark/archive/0.28.3.tar.gz)"
make install make install
cd - >/dev/null cd - >/dev/null
MODULE_SOURCE_CONFIGOPTIONS=--with-cmark MODULE_SOURCE_CONFIGOPTIONS=--with-cmark
;; ;;
snuffleupagus) snuffleupagus)
MODULE_SOURCE="https://codeload.github.com/jvoisin/snuffleupagus/tar.gz/v0.5.0" MODULE_VERSION="$(getWantedPHPModuleVersion "$PHP_MODULE_TO_INSTALL")"
if test -z "$MODULE_VERSION"; then
MODULE_VERSION='0.5.0'
fi
MODULE_SOURCE=https://codeload.github.com/jvoisin/snuffleupagus/tar.gz/v$MODULE_VERSION
MODULE_SOURCE_CONFIGOPTIONS=--enable-snuffleupagus MODULE_SOURCE_CONFIGOPTIONS=--enable-snuffleupagus
;; ;;
esac esac

23
scripts/test-installversion Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
# Let's set a sane environment
set -o errexit
set -o nounset
WANTED_VERSION="${1:-}"
INSTALLME=xdebug
if test -n "$WANTED_VERSION"; then
INSTALLME="$INSTALLME-$1"
fi
./install-php-extensions "$INSTALLME"
INSTALLED_VERSION="$(php --ri xdebug | grep -Ei 'Version\s*=>\s*' | sed -E 's/^.*?=>\s*//')"
if test -z "$WANTED_VERSION"; then
echo 'Installing the default version worked'
elif test "$WANTED_VERSION" = "$INSTALLED_VERSION"; then
printf 'Installing specific version %s worked\n' "$WANTED_VERSION"
else
printf 'We wanted to install version %s, but we installed %s\n' "$WANTED_VERSION" "$INSTALLED_VERSION" >&2
exit 1
fi