From 7c3dbd2b9e9fa6956917580fcbda7a9a1f973709 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 3 Aug 2021 10:38:36 +0200 Subject: [PATCH] Add support for event Test: event+sockets --- README.md | 1 + data/supported-extensions | 1 + install-php-extensions | 82 +++++++++++++++++++++++++++++++++++++++ scripts/tests/event | 21 ++++++++++ 4 files changed, 105 insertions(+) create mode 100755 scripts/tests/event diff --git a/README.md b/README.md index 145c43f..08a566d 100644 --- a/README.md +++ b/README.md @@ -275,6 +275,7 @@ The compilation of some extensions may be fine-tuned to better fit your needs by | Extension | Environment variable | Description | |---|---|---| | lzf | IPE_LZF_BETTERCOMPRESSION=1 | By default `install-php-extensions` compiles the `lzf` extension to prefer speed over size; you can use this environment variable to compile it preferring size over speed | +| event | IPE_EVENT_NAMESPACE=... | By default the `event` classes are defined in the root namespace. You can use this environment variable to specify a custom namespace | ## Special requirements diff --git a/data/supported-extensions b/data/supported-extensions index 72bd53c..3e6a3ed 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -12,6 +12,7 @@ decimal 7.0 7.1 7.2 7.3 7.4 8.0 8.1 ds 7.0 7.1 7.2 7.3 7.4 8.0 enchant 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 ev 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 +event 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 excimer 7.1 7.2 7.3 7.4 8.0 8.1 exif 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 ffi 7.4 8.0 8.1 diff --git a/install-php-extensions b/install-php-extensions index eea6063..ab698df 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -360,6 +360,16 @@ sortModulesToInstall() { checkRequiredModule 'http' 'propro' fi checkRequiredModule 'http' 'raphf' + # event requires sockets (for PHP <= 5.6) + if test $PHP_MAJMIN_VERSION -le 506; then + checkRequiredModule event sockets + fi + # Some module installation may use sockets if available: move it before other modules + if stringInList 'sockets' "$PHP_MODULES_TO_INSTALL"; then + PHP_MODULES_TO_INSTALL="$(removeStringFromList 'sockets' "$PHP_MODULES_TO_INSTALL")" + PHP_MODULES_TO_INSTALL="sockets $PHP_MODULES_TO_INSTALL" + PHP_MODULES_TO_INSTALL="${PHP_MODULES_TO_INSTALL% }" + fi # Some module installation may use igbinary if available: move it before other modules if stringInList 'igbinary' "$PHP_MODULES_TO_INSTALL"; then PHP_MODULES_TO_INSTALL="$(removeStringFromList 'igbinary' "$PHP_MODULES_TO_INSTALL")" @@ -485,6 +495,14 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-dev" ;; + event@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libevent $buildRequiredPackageLists_libssl" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libevent-dev $buildRequiredPackageLists_libssldev" + ;; + event@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libevent[0-9\.\-]*$ ^libevent-openssl[0-9\.\-]*$ ^libevent-extra[0-9\.\-]*$ ^libevent-pthreads[0-9\.\-]*$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libevent-dev $buildRequiredPackageLists_libssldev" + ;; ffi@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libffi" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libffi-dev" @@ -1675,6 +1693,66 @@ installRemoteModule() { ;; esac ;; + event) + if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 2.4.0) -ge 0; then + # Enable internal debugging in Event + addConfigureOption enable-event-debug no + # Enable sockets support in Event + if php --ri sockets >/dev/null 2>/dev/null; then + addConfigureOption enable-event-sockets yes + else + addConfigureOption enable-event-sockets no + fi + # libevent installation prefix + addConfigureOption with-event-libevent-dir /usr + # Include libevent's pthreads library and enable thread safety support in Event + addConfigureOption with-event-pthreads yes + # Include libevent protocol-specific functionality support including HTTP, DNS, and RPC + addConfigureOption with-event-extra yes + # Include libevent OpenSSL support + addConfigureOption with-event-openssl yes + # PHP Namespace for all Event classes + if test -n "${IPE_EVENT_NAMESPACE:-}"; then + addConfigureOption with-event-ns "$IPE_EVENT_NAMESPACE" + else + addConfigureOption with-event-ns no + fi + # openssl installation prefix + addConfigureOption with-openssl-dir no + elif test $(compareVersions "$installRemoteModule_version" 1.7.6) -ge 0; then + # Enable internal debugging in Event + addConfigureOption enable-event-debug no + # Enable sockets support in Event + if php --ri sockets >/dev/null 2>/dev/null; then + addConfigureOption enable-event-sockets yes + else + addConfigureOption enable-event-sockets no + fi + # libevent installation prefix + addConfigureOption with-event-libevent-dir /usr + # Include libevent's pthreads library and enable thread safety support in Event + addConfigureOption with-event-pthreads yes + # Include libevent protocol-specific functionality support including HTTP, DNS, and RPC + addConfigureOption with-event-extra yes + # Include libevent OpenSSL support + addConfigureOption with-event-openssl yes + # openssl installation prefix + addConfigureOption with-openssl-dir no + elif test $(compareVersions "$installRemoteModule_version" 1.3.0) -ge 0; then + # Enable internal debugging in event + addConfigureOption enable-event-debug no + # libevent installation prefix + addConfigureOption with-event-libevent-dir /usr + # Include libevent's pthreads library and enable thread safety support in event + addConfigureOption with-event-pthreads yes + # Include libevent protocol-specific functionality support including HTTP, DNS, and RPC + addConfigureOption with-event-extra yes + # Include libevent OpenSSL support + addConfigureOption with-event-openssl yes + # openssl installation prefix + addConfigureOption with-openssl-dir no + fi + ;; gearman) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then @@ -2387,6 +2465,10 @@ installRemoteModule() { # apcu_bc must be loaded after apcu docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" apc ;; + event) + # event must be loaded after sockets + docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" "$installRemoteModule_module" + ;; ioncube_loader) # On PHP 5.5, docker-php-ext-enable fails to detect that ionCube Loader is a Zend Extension if test $PHP_MAJMIN_VERSION -le 505; then diff --git a/scripts/tests/event b/scripts/tests/event new file mode 100755 index 0000000..78bf6d9 --- /dev/null +++ b/scripts/tests/event @@ -0,0 +1,21 @@ +#!/bin/sh + +set -o errexit +set -o nounset + +rc=0 +if php --ri sockets >/dev/null 2>/dev/null; then + if test -z "$(php --ri event | grep 'Sockets support => enabled')"; then + echo 'event has not been compiled with sockets support' >&2 + rc=1 + else + echo 'event has been compiled with sockets support' + fi +fi +if test -z "$(php --ri event | grep 'OpenSSL support => enabled')"; then + echo 'event has not been compiled with OpenSSL support' >&2 + rc=1 +else + echo 'event has been compiled with OpenSSL support' +fi +exit $rc