From f91d49eb12a82fe024d19a9efde6c3a0b4f3cb8b Mon Sep 17 00:00:00 2001 From: Tinywan <756684177@qq.com> Date: Fri, 30 Aug 2024 23:04:20 +0800 Subject: [PATCH] feat: pecl install phpy --yes --- services/php8/Dockerfile | 4 + .../php8/extensions/install-php-extensions | 2808 +++++++++++++++-- services/php8/extensions/install.sh | 6 + 3 files changed, 2494 insertions(+), 324 deletions(-) diff --git a/services/php8/Dockerfile b/services/php8/Dockerfile index 9fe060f..d5d65a6 100644 --- a/services/php8/Dockerfile +++ b/services/php8/Dockerfile @@ -8,6 +8,10 @@ ARG CONTAINER_PACKAGE_URL RUN if [ $CONTAINER_PACKAGE_URL ] ; then sed -i "s/dl-cdn.alpinelinux.org/${CONTAINER_PACKAGE_URL}/g" /etc/apk/repositories ; fi +# phpy install https://github.com/swoole/phpy +# RUN apk add python3 +# RUN apk add autoconf gcc g++ make python3-dev + COPY ./extensions /tmp/extensions WORKDIR /tmp/extensions RUN chmod +x install.sh \ diff --git a/services/php8/extensions/install-php-extensions b/services/php8/extensions/install-php-extensions index fec98f1..2de0b1e 100644 --- a/services/php8/extensions/install-php-extensions +++ b/services/php8/extensions/install-php-extensions @@ -2,7 +2,7 @@ # This script wraps docker-php-ext-install, properly configuring the system. # -# Copyright (c) Michele Locati, 2018-2021 +# Copyright (c) Michele Locati, 2018-2023 # # Source: https://github.com/mlocati/docker-php-extension-installer # @@ -12,6 +12,10 @@ set -o errexit set -o nounset +if test "${IPE_DEBUG:-}" = "1"; then + set -x +fi + if ! which docker-php-ext-configure >/dev/null || ! which docker-php-ext-enable >/dev/null || ! which docker-php-ext-install >/dev/null || ! which docker-php-source >/dev/null; then printf 'The script %s is meant to be used with official Docker PHP Images - https://hub.docker.com/_/php\n' "$0" >&2 exit 1 @@ -19,6 +23,14 @@ fi IPE_VERSION=master +StandWithUkraine() { + if test -t 1 && ! grep -Eq '^VERSION=.*jessie' /etc/os-release; then + printf '\e[37;44m#StandWith\e[30;43mUkraine\e[0m\n' + else + printf '#StandWithUkraine\n' + fi +} + if test "$IPE_VERSION" = master && test "${CI:-}" != true; then cat <&2 @@ -68,11 +84,22 @@ setDistro() { # Set: # - PHP_MAJMIN_VERSION: Major-Minor version, format MMmm (example 800 for PHP 8.0.1) +# - PHP_MAJDOTMIN_VERSION: Major-Minor version, format M.m (example 8.0 for PHP 8.0.1) # - PHP_MAJMINPAT_VERSION: Major-Minor-Patch version, format MMmmpp (example 80001 for PHP 8.0.1) variables containing integers value +# - PHP_MAJDOTMINDOTPAT_VERSION: Major-Minor-Patch version, format M.m.p (example 8.0.1 for PHP 8.0.1) +# - PHP_THREADSAFE: 1 if PHP is thread-safe (TS), 0 if not thread-safe (NTS) +# - PHP_DEBUGBUILD: 1 if PHP is debug build (configured with "--enable-debug"), 0 otherwise +# - PHP_BITS: 32 if PHP is compiled for 32-bit, 64 if 64-bit +# - PHP_EXTDIR: the absolute path where the PHP extensions reside setPHPVersionVariables() { - setPHPVersionVariables_textual="$(php-config --version)" - PHP_MAJMIN_VERSION=$(printf '%s' "$setPHPVersionVariables_textual" | awk -F. '{print $1*100+$2}') - PHP_MAJMINPAT_VERSION=$(printf '%s' "$setPHPVersionVariables_textual" | awk -F. '{print $1*10000+$2*100+$3}') + PHP_MAJDOTMINDOTPAT_VERSION="$(php-config --version)" + PHP_MAJMIN_VERSION=$(printf '%s' "$PHP_MAJDOTMINDOTPAT_VERSION" | awk -F. '{print $1*100+$2}') + PHP_MAJDOTMIN_VERSION=$(printf '%s' "$PHP_MAJDOTMINDOTPAT_VERSION" | cut -d. -f1-2) + PHP_MAJMINPAT_VERSION=$(printf '%s' "$PHP_MAJDOTMINDOTPAT_VERSION" | awk -F. '{print $1*10000+$2*100+$3}') + PHP_THREADSAFE=$(php -n -r 'echo ZEND_THREAD_SAFE ? 1 : 0;') + PHP_DEBUGBUILD=$(php -n -r 'echo ZEND_DEBUG_BUILD ? 1 : 0;') + PHP_BITS=$(php -n -r 'echo PHP_INT_SIZE * 8;') + PHP_EXTDIR="$(php -d display_errors=stderr -r 'echo realpath(ini_get("extension_dir"));')" } # Fix apt-get being very slow on Debian Jessie @@ -107,6 +134,9 @@ normalizePHPModuleName() { ;; esac case "$normalizePHPModuleName_name" in + datadog_trace) + normalizePHPModuleName_name=ddtrace + ;; ioncube | ioncube\ loader) normalizePHPModuleName_name='ioncube_loader' ;; @@ -116,6 +146,16 @@ normalizePHPModuleName() { zend\ opcache) normalizePHPModuleName_name='opcache' ;; + libsodium) + if test $PHP_MAJMIN_VERSION -ge 700; then + normalizePHPModuleName_name='sodium' + fi + ;; + sodium) + if test $PHP_MAJMIN_VERSION -lt 700; then + normalizePHPModuleName_name='libsodium' + fi + ;; *\ *) printf '### WARNING Unrecognized module name: %s ###\n' "$1" >&2 ;; @@ -133,13 +173,86 @@ normalizePHPModuleName() { getPeclModuleName() { normalizePHPModuleName_name="$1" case "$normalizePHPModuleName_name" in + ddtrace) + normalizePHPModuleName_name=datadog_trace + ;; http) normalizePHPModuleName_name=pecl_http ;; + sodium) + normalizePHPModuleName_name=libsodium + ;; esac printf '%s' "$normalizePHPModuleName_name" } +# Parse a package.xml (or package2.xml) file and extract the module name and version +# +# Arguments: +# $1: the patho to the XML file +# +# Set these variables: +# - EXTRACTPACKAGEVERSIONFROMXML_NAME +# - EXTRACTPACKAGEVERSIONFROMXML_VERSION +# +# Output: +# Nothing +# +# Return: +# 0 (true): if the string is in the list +# 1 (false): if the string is not in the list +extractPackageVersionFromXML() { + if ! test -f "$1"; then + printf 'Unable to find the file\n%s\n' >&2 + return 1 + fi + extractPackageVersionFromXML_code="$( + cat <<'EOT' +$doc = new DOMDocument(); +if (!$doc->load($argv[1])) { + fwrite(STDERR, "Failed to load XML file\n"); + exit(1); +} +set_error_handler( + static function($errno, $errstr) { + fwrite(STDERR, trim((string) $errstr) . "\n"); + exit(1); + }, + -1 +); +$xpath = new DOMXpath($doc); +$xpath->registerNamespace('v20', 'http://pear.php.net/dtd/package-2.0'); +$xpath->registerNamespace('v21', 'http://pear.php.net/dtd/package-2.1'); +if ($xpath->query('/v20:package/v20:dependencies')->length === 1) { + $ns = 'v20:'; +} elseif ($xpath->query('/v21:package/v21:dependencies')->length === 1) { + $ns = 'v21:'; +} elseif ($xpath->query('/package')->length === 1) { + $ns = ''; +} else { + fwrite(STDERR, "Unsupported namespace of the XML of package version details\n"); +} +$nodes = $xpath->query("/{$ns}package/{$ns}name"); +$name = trim((string) $nodes[0]->nodeValue); +if ($ns === '') { + $nodes = $xpath->query("/{$ns}package/{$ns}version"); +} else { + $nodes = $xpath->query("/{$ns}package/{$ns}version/{$ns}release"); +} +$version = trim((string) $nodes[0]->nodeValue); +echo "EXTRACTPACKAGEVERSIONFROMXML_NAME='{$name}'\n"; +echo "EXTRACTPACKAGEVERSIONFROMXML_VERSION='{$version}'\n"; +exit(0); +EOT + )" + extractPackageVersionFromXML_vars="$(php -n -d display_errors=stderr -r "$extractPackageVersionFromXML_code" "$1")" + if test -z "$extractPackageVersionFromXML_vars"; then + return 1 + fi + eval "$extractPackageVersionFromXML_vars" + return 0 +} + # Parse a module name (and optionally version) as received via command arguments, extracting the version and normalizing it # Examples: # xdebug-2.9.8 @@ -154,17 +267,57 @@ getPeclModuleName() { # # Optionally set these variables: # - PHP_WANTEDMODULEVERSION_<...> (where <...> is the normalized module name) +# - PHP_MODULESOURCECODEPATH_<...> (where <...> is the normalized module name) # # Output: # Nothing processPHPModuleArgument() { - PROCESSED_PHP_MODULE_ARGUMENT="${1%%-*}" - if test -n "$PROCESSED_PHP_MODULE_ARGUMENT" && test "$PROCESSED_PHP_MODULE_ARGUMENT" != "$1"; then - processPHPModuleArgument_version="${1#*-}" + processPHPModuleArgument_arg="$1" + # Convert GitHub short form to long url, + # for example: from + # php-memcached-dev/php-memcached@8f106564e6bb005ca6100b12ccc89000daafa9d8 + # to + # https://codeload.github.com/php-memcached-dev/php-memcached/tar.gz/8f106564e6bb005ca6100b12ccc89000daafa9d8 + processPHPModuleArgument_arg="$(printf '%s' "$processPHPModuleArgument_arg" | sed -E 's/^([a-zA-Z0-9_.\-]+\/[a-zA-Z0-9_.\-]+)@(.+$)/https:\/\/codeload.github.com\/\1\/tar.gz\/\2/')" + # Let's check if $processPHPModuleArgument_arg is an URL + if printf '%s' "$processPHPModuleArgument_arg" | grep -Eq '^https?://[^ ]+/[^ ]+$'; then + printf 'Downloading source from %s\n' "$processPHPModuleArgument_arg" + processPHPModuleArgument_arg="$(getPackageSource "$processPHPModuleArgument_arg")" + fi + # Let's check if $processPHPModuleArgument_arg the absolute path of an existing directory + if test "$processPHPModuleArgument_arg" != "${processPHPModuleArgument_arg#/}" && test -d "$processPHPModuleArgument_arg"; then + if test -f "$processPHPModuleArgument_arg/package2.xml"; then + printf 'Checking package2.xml of directory %s... ' "$processPHPModuleArgument_arg" + if ! extractPackageVersionFromXML "$processPHPModuleArgument_arg/package2.xml"; then + return 1 + fi + elif test -f "$processPHPModuleArgument_arg/package.xml"; then + printf 'Checking package.xml of directory %s... ' "$processPHPModuleArgument_arg" + if ! extractPackageVersionFromXML "$processPHPModuleArgument_arg/package.xml"; then + return 1 + fi + else + printf 'Unable to find the package.xml file in the directory\n%s\n' "$processPHPModuleArgument_arg" + return 1 + fi + printf 'good (name: %s, version: %s)\n' "$EXTRACTPACKAGEVERSIONFROMXML_NAME" "$EXTRACTPACKAGEVERSIONFROMXML_VERSION" + PROCESSED_PHP_MODULE_ARGUMENT="$(normalizePHPModuleName "$EXTRACTPACKAGEVERSIONFROMXML_NAME")" + processPHPModuleArgument_version="$EXTRACTPACKAGEVERSIONFROMXML_VERSION" + if printf '%s' "$PROCESSED_PHP_MODULE_ARGUMENT" | grep -Eq '^[a-zA-Z0-9_]+$'; then + eval PHP_MODULESOURCECODEPATH_$PROCESSED_PHP_MODULE_ARGUMENT="$processPHPModuleArgument_arg" + else + printf 'Unable to parse the following module name:\n%s\n' "$PROCESSED_PHP_MODULE_ARGUMENT" >&2 + exit 1 + fi else - processPHPModuleArgument_version='' + PROCESSED_PHP_MODULE_ARGUMENT="${processPHPModuleArgument_arg%%-*}" + if test -n "$PROCESSED_PHP_MODULE_ARGUMENT" && test "$PROCESSED_PHP_MODULE_ARGUMENT" != "$processPHPModuleArgument_arg"; then + processPHPModuleArgument_version="${processPHPModuleArgument_arg#*-}" + else + processPHPModuleArgument_version='' + fi + PROCESSED_PHP_MODULE_ARGUMENT="$(normalizePHPModuleName "$PROCESSED_PHP_MODULE_ARGUMENT")" fi - PROCESSED_PHP_MODULE_ARGUMENT="$(normalizePHPModuleName "$PROCESSED_PHP_MODULE_ARGUMENT")" if test -n "$processPHPModuleArgument_version"; then if printf '%s' "$PROCESSED_PHP_MODULE_ARGUMENT" | grep -Eq '^[a-zA-Z0-9_]+$'; then eval PHP_WANTEDMODULEVERSION_$PROCESSED_PHP_MODULE_ARGUMENT="$processPHPModuleArgument_version" @@ -191,56 +344,124 @@ getWantedPHPModuleVersion() { fi } -# Get the wanted PHP module version, resolving it if it starts with '^' +# Get source code path of a 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) +getModuleSourceCodePath() { + if printf '%s' "$1" | grep -Eq '^[a-zA-Z0-9_]+$'; then + eval printf '%s' "\${PHP_MODULESOURCECODEPATH_$1:-}" + fi +} + +# Get the actual PHP module version, resolving it if it starts with '^' +# +# Arguments: +# $1: the name of the module +# $2: the wanted version (optional, if omitted we'll use getWantedPHPModuleVersion) +# +# Output: # The version to be used -resolveWantedPHPModuleVersion() { - resolveWantedPHPModuleVersion_raw="$(getWantedPHPModuleVersion "$1")" - resolveWantedPHPModuleVersion_afterCaret="${resolveWantedPHPModuleVersion_raw#^}" - if test "$resolveWantedPHPModuleVersion_raw" = "$resolveWantedPHPModuleVersion_afterCaret"; then - printf '%s' "$resolveWantedPHPModuleVersion_raw" +resolvePHPModuleVersion() { + resolvePHPModuleVersion_module="$1" + if test $# -lt 2; then + resolvePHPModuleVersion_raw="$(getWantedPHPModuleVersion "$installRemoteModule_module")" + else + resolvePHPModuleVersion_raw="$2" + fi + resolvePHPModuleVersion_afterCaret="${resolvePHPModuleVersion_raw#^}" + if test "$resolvePHPModuleVersion_raw" = "$resolvePHPModuleVersion_afterCaret"; then + printf '%s' "$resolvePHPModuleVersion_raw" return fi - resolveWantedPHPModuleVersion_xml="$(curl -sSLf "http://pecl.php.net/rest/r/$1/allreleases.xml")" - resolveWantedPHPModuleVersion_versions="$(printf '%s' "$resolveWantedPHPModuleVersion_xml" | tr -s ' \t\r\n' ' ' | sed -r 's# *<#\n<#g' | grep '' | sed 's###g' | sed 's# ##g')" + case "$resolvePHPModuleVersion_afterCaret" in + ?*@snapshot | ?*@devel | ?*@alpha | ?*@beta | ?*@stable) + resolvePHPModuleVersion_wantedStability="${resolvePHPModuleVersion_afterCaret##*@}" + resolvePHPModuleVersion_wantedVersion="${resolvePHPModuleVersion_afterCaret%@*}" + ;; + *) + resolvePHPModuleVersion_wantedStability='' + resolvePHPModuleVersion_wantedVersion="$resolvePHPModuleVersion_afterCaret" + ;; + esac + resolvePHPModuleVersion_peclModule="$(getPeclModuleName "$resolvePHPModuleVersion_module")" + resolvePHPModuleVersion_xml="$(curl -sSLf "http://pecl.php.net/rest/r/$resolvePHPModuleVersion_peclModule/allreleases.xml")" + # remove line endings, collapse spaces + resolvePHPModuleVersion_versions="$(printf '%s' "$resolvePHPModuleVersion_xml" | tr -s ' \t\r\n' ' ')" + # one line per release (eg 1.2.3stable) + resolvePHPModuleVersion_versions="$(printf '%s' "$resolvePHPModuleVersion_versions" | sed -r 's#$resolvePHPModuleVersion_wantedStability")" + fi + # remove everything's up to '' (included) + resolvePHPModuleVersion_versions="$(printf '%s' "$resolvePHPModuleVersion_versions" | sed 's#^.*##')" + # keep just the versions + resolvePHPModuleVersion_versions="$(printf '%s' "$resolvePHPModuleVersion_versions" | cut -d'<' -f1)" resetIFS - for resolveWantedPHPModuleVersion_version in $resolveWantedPHPModuleVersion_versions; do - resolveWantedPHPModuleVersion_suffix="${resolveWantedPHPModuleVersion_version#$resolveWantedPHPModuleVersion_afterCaret}" - if test "$resolveWantedPHPModuleVersion_version" != "${resolveWantedPHPModuleVersion_version#$resolveWantedPHPModuleVersion_afterCaret.}"; then + for resolvePHPModuleVersion_version in $resolvePHPModuleVersion_versions; do + resolvePHPModuleVersion_suffix="${resolvePHPModuleVersion_version#$resolvePHPModuleVersion_wantedVersion}" + if test "$resolvePHPModuleVersion_version" != "${resolvePHPModuleVersion_version#$resolvePHPModuleVersion_wantedVersion.}"; then # Example: looking for 1.0, found 1.0.1 - printf '%s' "$resolveWantedPHPModuleVersion_version" + printf '%s' "$resolvePHPModuleVersion_version" return fi done - for resolveWantedPHPModuleVersion_version in $resolveWantedPHPModuleVersion_versions; do - resolveWantedPHPModuleVersion_suffix="${resolveWantedPHPModuleVersion_version#$resolveWantedPHPModuleVersion_afterCaret}" - if test "$resolveWantedPHPModuleVersion_version" = "$resolveWantedPHPModuleVersion_suffix"; then + for resolvePHPModuleVersion_version in $resolvePHPModuleVersion_versions; do + resolvePHPModuleVersion_suffix="${resolvePHPModuleVersion_version#$resolvePHPModuleVersion_wantedVersion}" + if test "$resolvePHPModuleVersion_version" = "$resolvePHPModuleVersion_suffix"; then continue fi - if test -z "$resolveWantedPHPModuleVersion_suffix"; then + if test -z "$resolvePHPModuleVersion_suffix"; then # Example: looking for 1.0, found exactly it - printf '%s' "$resolveWantedPHPModuleVersion_version" + printf '%s' "$resolvePHPModuleVersion_version" return fi - case "$resolveWantedPHPModuleVersion_suffix" in + case "$resolvePHPModuleVersion_suffix" in [0-9]) # Example: looking for 1.1, but this is 1.10 ;; *) # Example: looking for 1.1, this is 1.1rc1 - printf '%s' "$resolveWantedPHPModuleVersion_version" + printf '%s' "$resolvePHPModuleVersion_version" return ;; esac done - printf 'Unable to find a version of "%s" compatible with "%s"\nAvailable versions are:\n%s\n' "$1" "$resolveWantedPHPModuleVersion_raw" "$resolveWantedPHPModuleVersion_versions" >&2 + printf 'Unable to find a version of "%s" compatible with "%s"\nAvailable versions are:\n%s\n' "$resolvePHPModuleVersion_module" "$resolvePHPModuleVersion_raw" "$resolvePHPModuleVersion_versions" >&2 exit 1 } +# Get the actual version of a PECL pmodule, resolving 'latest', 'stable', 'beta', 'alpha', 'devel'. +# +# Arguments: +# $1: the module name as known on the PECL archive +# $2: the version to be resolved +# Output: +# $2 itself if $1 is not 'latest', 'stable', 'beta', 'alpha', or 'devel', the actual version otherwise +resolvePeclStabilityVersion() { + case "$2" in + latest | stable | beta | alpha | devel) ;; + *) + printf '%s' "$2" + return + ;; + esac + resolvePeclStabilityVersion_peclModule="$(getPeclModuleName "$1")" + peclStabilityFlagToVersion_url="http://pecl.php.net/rest/r/$resolvePeclStabilityVersion_peclModule/$2.txt" + if ! peclStabilityFlagToVersion_result="$(curl -sSLf "$peclStabilityFlagToVersion_url")"; then + peclStabilityFlagToVersion_result='' + fi + if test -z "$peclStabilityFlagToVersion_result"; then + printf 'Failed to resolve the PECL package version "%s" of %s from %s\n' "$2" "$1" "$peclStabilityFlagToVersion_url" >&2 + exit 1 + fi + printf '%s' "$peclStabilityFlagToVersion_result" +} + # Set these variables: # - PHP_PREINSTALLED_MODULES the normalized list of PHP modules installed before running this script setPHPPreinstalledModules() { @@ -282,6 +503,12 @@ setPHPPreinstalledModules() { processCommandArguments() { processCommandArguments_endArgs=0 PHP_MODULES_TO_INSTALL='' + # Support deprecated flag IPE_FIX_CACERTS + case "${IPE_FIX_CACERTS:-}" in + 1 | y* | Y*) + PHP_MODULES_TO_INSTALL="$PHP_MODULES_TO_INSTALL @fix_letsencrypt" + ;; + esac while :; do if test $# -lt 1; then break @@ -364,6 +591,12 @@ sortModulesToInstall() { if test $PHP_MAJMIN_VERSION -le 506; then checkRequiredModule event sockets fi + # relay requires msgpack + checkRequiredModule relay msgpack + # relay requires igbinary + checkRequiredModule relay igbinary + # pq requires raphf + checkRequiredModule pq raphf # 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")" @@ -388,6 +621,18 @@ sortModulesToInstall() { PHP_MODULES_TO_INSTALL="socket $PHP_MODULES_TO_INSTALL" PHP_MODULES_TO_INSTALL="${PHP_MODULES_TO_INSTALL% }" fi + # Some module installation may use apcu if available: move it before other modules + if stringInList 'apcu' "$PHP_MODULES_TO_INSTALL"; then + PHP_MODULES_TO_INSTALL="$(removeStringFromList 'apcu' "$PHP_MODULES_TO_INSTALL")" + PHP_MODULES_TO_INSTALL="apcu $PHP_MODULES_TO_INSTALL" + PHP_MODULES_TO_INSTALL="${PHP_MODULES_TO_INSTALL% }" + fi + # Some module installation may use raphf if available: move it before other modules + if stringInList 'raphf' "$PHP_MODULES_TO_INSTALL"; then + PHP_MODULES_TO_INSTALL="$(removeStringFromList 'raphf' "$PHP_MODULES_TO_INSTALL")" + PHP_MODULES_TO_INSTALL="raphf $PHP_MODULES_TO_INSTALL" + PHP_MODULES_TO_INSTALL="${PHP_MODULES_TO_INSTALL% }" + fi # In any case, first of all, we need to install composer if stringInList '@composer' "$PHP_MODULES_TO_INSTALL"; then PHP_MODULES_TO_INSTALL="$(removeStringFromList '@composer' "$PHP_MODULES_TO_INSTALL")" @@ -396,6 +641,17 @@ sortModulesToInstall() { fi } +# Expand the IPE_ASPELL_LANGUAGES environment variable into apk/apt package names +expandASpellDictionaries() { + expandASpellDictionaries_languages="${IPE_ASPELL_LANGUAGES:-en}" + expandASpellDictionaries_result='' + resetIFS + for expandASpellDictionaries_language in $expandASpellDictionaries_languages; do + expandASpellDictionaries_result="$expandASpellDictionaries_result aspell-$expandASpellDictionaries_language" + done + printf '%s' "${expandASpellDictionaries_result# }" +} + # Get the required APT/APK packages for a specific PHP version and for the list of module handles # # Arguments: @@ -406,17 +662,17 @@ sortModulesToInstall() { # PACKAGES_PERSISTENT_PRE the list of packages required at runtume that are already installed # PACKAGES_VOLATILE the list of packages required at compile time that must be installed # PACKAGES_PREVIOUS the list of packages (with their version) that are installed right now (calculated only on Debian and only if PACKAGES_PERSISTENT_NEW or PACKAGES_VOLATILE are not empty) +# COMPILE_LIBS buildRequiredPackageLists() { buildRequiredPackageLists_persistent='' buildRequiredPackageLists_volatile='' + COMPILE_LIBS='' case "$DISTRO" in alpine) - if test $DISTRO_VERSION_NUMBER = '3.14'; then - # https://gitlab.alpinelinux.org/alpine/aports/-/issues/12763#note_172090 - apk -U upgrade - else - apk update - fi + apk update + ;; + debian) + invokeAptGetUpdate ;; esac case "$DISTRO_VERSION" in @@ -425,7 +681,7 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $PHPIZE_DEPS" fi if test -z "$(apk info 2>/dev/null | grep -E ^libssl)"; then - buildRequiredPackageLists_libssl='libssl1.0' + buildRequiredPackageLists_libssl="$(apk search | grep -E '^libssl[0-9]' | head -1 | cut -d- -f1)" elif test -z "$(apk info 2>/dev/null | grep -E '^libressl.*-libtls')" && test -z "$(apk info 2>/dev/null | grep -E '^libressl.*-libssl')" && test -z "$(apk info 2>/dev/null | grep -E '^libretls-')"; then buildRequiredPackageLists_libssl=$(apk search -q libressl*-libtls) else @@ -436,6 +692,15 @@ buildRequiredPackageLists() { else buildRequiredPackageLists_libssldev='libretls-dev' fi + buildRequiredPackageLists_icuPersistent='' + if test $DISTRO_MAJMIN_VERSION -ge 316; then + case "${IPE_ICU_EN_ONLY:-}" in + 1 | y* | Y*) ;; + *) + buildRequiredPackageLists_icuPersistent='icu-data-full' + ;; + esac + fi ;; debian@9) buildRequiredPackageLists_libssldev='libssl1.0-dev' @@ -470,12 +735,23 @@ buildRequiredPackageLists() { bz2@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libbz2-dev" ;; + cassandra@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent cassandra-cpp-driver gmp" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cassandra-cpp-driver-dev gmp-dev" + ;; cmark@alpine) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake" ;; cmark@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake" ;; + ddtrace@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libgcc" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile curl-dev" + ;; + ddtrace@debian) + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libcurl4-openssl-dev" + ;; dba@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent db" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile db-dev" @@ -487,21 +763,48 @@ buildRequiredPackageLists() { fi ;; decimal@debian) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmpdec2" - buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmpdec-dev" + if test $DISTRO_MAJMIN_VERSION -lt 1200; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libmpdec[0-9]*$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmpdec-dev" + fi + ;; + ecma_intl@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs $buildRequiredPackageLists_icuPersistent" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev libidn-dev" + ;; + ecma_intl@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libicu[0-9]+$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev" ;; enchant@alpine) if test $DISTRO_MAJMIN_VERSION -ge 312; then - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant2" - buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant2-dev" + if test $PHP_MAJMIN_VERSION -ge 800; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant2" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant2-dev" + else + # The system provides libenchant2, supported since PHP 8.0: we need to build libenchant1 on our own + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent glib aspell-libs libhunspell" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile glib-dev aspell-dev hunspell-dev" + fi else buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent enchant" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile enchant-dev" fi ;; enchant@debian) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a" - buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-dev" + if test $DISTRO_VERSION_NUMBER -ge 11; then + if test $PHP_MAJMIN_VERSION -ge 800; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant-2-2" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-2-dev" + else + # The system provides libenchant2, supported since PHP 8.0: we need to build libenchant1 on our own + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-en libhunspell-1.7-0" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libglib2.0-dev libaspell-dev libhunspell-dev" + fi + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libenchant1c2a" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libenchant-dev" + fi ;; event@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libevent $buildRequiredPackageLists_libssl" @@ -518,6 +821,12 @@ buildRequiredPackageLists() { ffi@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libffi-dev" ;; + ftp@alpine) + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev" + ;; + ftp@debian) + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev" + ;; gd@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetype libjpeg-turbo libpng libxpm" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetype-dev libjpeg-turbo-dev libpng-dev libxpm-dev" @@ -527,6 +836,34 @@ buildRequiredPackageLists() { else buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libwebp" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libwebp-dev" + if test $PHP_MAJMIN_VERSION -ge 801; then + if test $DISTRO_MAJMIN_VERSION -ge 315; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libavif aom-libs libdav1d" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libavif-dev aom-dev dav1d-dev" + elif isLibaomInstalled && isLibdav1dInstalled && isLibyuvInstalled && isLibavifInstalled; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + else + case "${IPE_GD_WITHOUTAVIF:-}" in + 1 | y* | Y*) ;; + *) + if ! isLibaomInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libaom" + fi + if ! isLibdav1dInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libdav1d" + fi + if ! isLibyuvInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libyuv" + fi + if ! isLibavifInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libavif" + fi + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake nasm meson" + ;; + esac + fi + fi fi ;; gd@debian) @@ -538,6 +875,31 @@ buildRequiredPackageLists() { else buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libwebp[0-9]+$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libwebp-dev" + if test $PHP_MAJMIN_VERSION -ge 801; then + if test $DISTRO_VERSION_NUMBER -ge 12; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libavif[0-9]+$ ^libaom[0-9]+$ ^libdav1d[0-9]+$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libavif-dev libaom-dev libdav1d-dev" + elif ! isLibaomInstalled || ! isLibdav1dInstalled || ! isLibyuvInstalled || ! isLibavifInstalled; then + case "${IPE_GD_WITHOUTAVIF:-}" in + 1 | y* | Y*) ;; + *) + if ! isLibaomInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libaom" + fi + if ! isLibdav1dInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libdav1d" + fi + if ! isLibyuvInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libyuv" + fi + if ! isLibavifInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libavif" + fi + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake nasm meson" + ;; + esac + fi + fi fi ;; gearman@alpine) @@ -556,6 +918,14 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libgeoip1[0-9]*$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgeoip-dev" ;; + geos@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent geos-dev" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile geos" + ;; + geos@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libgeos-c1(v[0-9]*)?$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgeos-dev" + ;; gettext@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libintl" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile gettext-dev" @@ -597,7 +967,7 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libidn" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libidn-dev" else - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs libidn" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs $buildRequiredPackageLists_icuPersistent libidn" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev libidn-dev" fi ;; @@ -608,12 +978,15 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile ^libidn1[0-9+]-dev$" else buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libicu[0-9]+$ ^libidn2-[0-9+]$" - buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev ^libidn2-[0-9+]-dev$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev ^libidn2-[0-9+]-dev$ ^libgcrypt[0-9]+-dev$" fi ;; imagick@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent imagemagick libgomp" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile imagemagick-dev" + if [ $DISTRO_MAJMIN_VERSION -ge 319 ]; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ghostscript libheif libjxl libraw librsvg" + fi ;; imagick@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libmagickwand-6.q16-[0-9]+$ ^libmagickcore-6.q16-[0-9]+-extra$" @@ -637,26 +1010,54 @@ buildRequiredPackageLists() { ;; interbase@alpine) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev ncurses-dev" + if ! isFirebirdInstalled; then + COMPILE_LIBS="$COMPILE_LIBS firebird" + fi ;; interbase@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libfbclient2" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile firebird-dev libib-util" ;; intl@alpine) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs $buildRequiredPackageLists_icuPersistent" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev" ;; intl@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libicu[0-9]+$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev" ;; + ion@alpine) + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake git" + ;; + ion@debian) + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake git" + ;; ldap@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libldap" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile openldap-dev" ;; ldap@debian) + if test $DISTRO_VERSION_NUMBER -ge 9; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libldap-common" + fi buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libldap2-dev" ;; + luasandbox@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent lua5.1-libs" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile lua5.1-dev" + ;; + luasandbox@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent liblua5.1-0" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile liblua5.1-0-dev" + ;; + lz4@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent lz4-libs" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile lz4-dev" + ;; + lz4@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent liblz4-1" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile liblz4-dev" + ;; maxminddb@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmaxminddb" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmaxminddb-dev" @@ -665,6 +1066,14 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libmaxminddb[0-9]*$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmaxminddb-dev" ;; + memprof@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent judy" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile judy-dev bsd-compat-headers" + ;; + memprof@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libjudydebian1" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libjudy-dev" + ;; mcrypt@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmcrypt" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmcrypt-dev" @@ -686,6 +1095,9 @@ buildRequiredPackageLists() { memcached@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libmemcachedutil2" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libmemcached-dev zlib1g-dev" + if test $DISTRO_MAJMIN_VERSION -ge 12; then + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev" + fi ;; mongo@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsasl $buildRequiredPackageLists_libssl" @@ -695,12 +1107,20 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev libsasl2-dev" ;; mongodb@alpine) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs libsasl $buildRequiredPackageLists_libssl snappy" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent icu-libs $buildRequiredPackageLists_icuPersistent libsasl $buildRequiredPackageLists_libssl snappy" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev cyrus-sasl-dev snappy-dev $buildRequiredPackageLists_libssldev zlib-dev" + if test $PHP_MAJMIN_VERSION -ge 704; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent zstd-libs" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zstd-dev" + fi ;; mongodb@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libsnappy[0-9]+(v[0-9]+)?$ ^libicu[0-9]+$" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libicu-dev libsasl2-dev libsnappy-dev $buildRequiredPackageLists_libssldev zlib1g-dev" + if test $PHP_MAJMIN_VERSION -ge 704; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libzstd[0-9]*$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libzstd-dev" + fi ;; mosquitto@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent mosquitto-libs" @@ -747,6 +1167,17 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libodbc1" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile unixodbc-dev" ;; + openswoole@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs libstdc++ $buildRequiredPackageLists_libssl" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile curl-dev postgresql-dev linux-headers $buildRequiredPackageLists_libssldev" + ;; + openswoole@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls libpq5" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev libcurl4-gnutls-dev libpq-dev" + ;; + parle@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + ;; pdo_dblib@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetds" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile freetds-dev" @@ -757,25 +1188,62 @@ buildRequiredPackageLists() { ;; pdo_firebird@alpine) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile icu-dev ncurses-dev" + if ! isFirebirdInstalled; then + COMPILE_LIBS="$COMPILE_LIBS firebird" + if test $PHP_MAJMIN_VERSION -ge 804; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev" + if ! isLibTommathInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libtommath" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile cmake" + fi + if ! isLibTomcryptInstalled; then + COMPILE_LIBS="$COMPILE_LIBS libtomcrypt" + fi + fi + fi ;; pdo_firebird@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libfbclient2" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile firebird-dev libib-util" ;; - pgsql@alpine | pdo_pgsql@alpine) + pgsql@alpine | pdo_pgsql@alpine | pq@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile postgresql-dev" ;; - pgsql@debian | pdo_pgsql@debian) + pgsql@debian | pdo_pgsql@debian | pq@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpq5" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpq-dev" ;; + php_trie@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + ;; + phpy@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent python3" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile python3-dev" + ;; + phpy@debian) + if test $DISTRO_VERSION_NUMBER -ge 12; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpython3.11" + elif test $DISTRO_VERSION_NUMBER -ge 11; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpython3.9" + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libpython3.7" + fi + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile python3-dev" + ;; + pkcs11@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent softhsm" + ;; + pkcs11@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsofthsm2" + ;; pspell@alpine) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-libs" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent aspell-libs $(expandASpellDictionaries)" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile aspell-dev" ;; pspell@debian) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libaspell15" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libaspell15 $(expandASpellDictionaries)" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libpspell-dev" ;; rdkafka@alpine) @@ -805,6 +1273,10 @@ buildRequiredPackageLists() { ;; esac buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zstd-dev" + if test $PHP_MAJMIN_VERSION -ge 702; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent lz4-libs" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile lz4-dev" + fi fi ;; redis@debian) @@ -822,6 +1294,25 @@ buildRequiredPackageLists() { ;; esac fi + if test $PHP_MAJMIN_VERSION -ge 702; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent liblz4-1" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile liblz4-dev" + fi + ;; + relay@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent lz4-libs zstd-libs" + if test $DISTRO_MAJMIN_VERSION -ge 317; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent $buildRequiredPackageLists_libssl" + fi + ;; + saxon@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_volatile unzip" + ;; + seasclick@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + ;; + simdjson@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" ;; smbclient@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsmbclient" @@ -831,6 +1322,14 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsmbclient" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libsmbclient-dev" ;; + snappy@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent snappy" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile snappy-dev" + ;; + snappy@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libsnappy1(v[0-9]+)?$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libsnappy-dev" + ;; snmp@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent net-snmp-libs" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile net-snmp-dev" @@ -852,6 +1351,19 @@ buildRequiredPackageLists() { soap@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev" ;; + sockets@alpine) + if test $PHP_MAJMIN_VERSION -ge 802; then + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile linux-headers" + fi + ;; + sodium@alpine | libsodium@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libsodium" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libsodium-dev" + ;; + sodium@debian | libsodium@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent ^libsodium[0-9]*$" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libsodium-dev" + ;; solr@alpine) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile curl-dev libxml2-dev" ;; @@ -859,6 +1371,9 @@ buildRequiredPackageLists() { buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libcurl4-gnutls-dev libxml2-dev" ;; + sourceguardian@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent eudev-libs" + ;; spx@alpine) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev" ;; @@ -893,10 +1408,28 @@ buildRequiredPackageLists() { swoole@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent postgresql-libs libstdc++ $buildRequiredPackageLists_libssl" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile curl-dev postgresql-dev linux-headers $buildRequiredPackageLists_libssldev" + if test $PHP_MAJMIN_VERSION -ge 702; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent c-ares" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile c-ares-dev" + if test $PHP_MAJMIN_VERSION -ge 801; then + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile sqlite-dev" + fi + fi ;; swoole@debian) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libcurl3-gnutls libpq5" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile $buildRequiredPackageLists_libssldev libcurl4-gnutls-dev libpq-dev" + if test $PHP_MAJMIN_VERSION -ge 702; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libc-ares2" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libc-ares-dev" + if test $PHP_MAJMIN_VERSION -ge 800; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libbrotli1" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib1g-dev libbrotli-dev" + if test $PHP_MAJMIN_VERSION -ge 801; then + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libsqlite3-dev" + fi + fi + fi ;; sybase_ct@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent freetds" @@ -914,24 +1447,46 @@ buildRequiredPackageLists() { buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git cmake gperf zlib1g-dev $buildRequiredPackageLists_libssldev" ;; tensor@alpine) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent lapack libexecinfo openblas" - buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile lapack-dev libexecinfo-dev openblas-dev" - if test $DISTRO_MAJMIN_VERSION -le 310; then - if ! stringInList --force-overwrite "$IPE_APK_FLAGS"; then - IPE_APK_FLAGS="$IPE_APK_FLAGS --force-overwrite" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent openblas" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile lapack-dev openblas-dev" + if test $DISTRO_MAJMIN_VERSION -le 317; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent lapack" + if test $DISTRO_MAJMIN_VERSION -le 316; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libexecinfo" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libexecinfo-dev" + if test $DISTRO_MAJMIN_VERSION -le 310; then + if ! stringInList --force-overwrite "$IPE_APK_FLAGS"; then + IPE_APK_FLAGS="$IPE_APK_FLAGS --force-overwrite" + fi + fi fi + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent liblapack" fi ;; tensor@debian) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent liblapacke libopenblas-base" + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent liblapacke" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile liblapack-dev libopenblas-dev liblapacke-dev" - if test $DISTRO_VERSION_NUMBER -ge 10; then - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent gfortran-8" + if test $DISTRO_VERSION_NUMBER -le 9; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent gfortran-6 libopenblas-base" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgfortran-6-dev" + elif test $DISTRO_VERSION_NUMBER -le 10; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent gfortran-8 libopenblas-base" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgfortran-8-dev" + elif test $DISTRO_VERSION_NUMBER -le 11; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent gfortran-10 libopenblas-base" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgfortran-10-dev" + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent gfortran-12 libopenblas0" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libgfortran-12-dev" fi ;; tidy@alpine) - buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent tidyhtml-libs" + if test $DISTRO_MAJMIN_VERSION -ge 315; then + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent tidyhtml" + else + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent tidyhtml-libs" + fi buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile tidyhtml-dev" ;; tidy@debian) @@ -945,6 +1500,14 @@ buildRequiredPackageLists() { uuid@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile uuid-dev" ;; + uv@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libuv" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libuv-dev" + ;; + uv@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libuv1" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libuv1-dev" + ;; vips@alpine) buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent vips" buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile vips-dev" @@ -959,6 +1522,19 @@ buildRequiredPackageLists() { wddx@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev" ;; + wikidiff2@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libstdc++" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git" + ;; + wikidiff2@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libthai0" + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile git libthai-dev" + ;; + xdebug@alpine) + if test $PHP_MAJMIN_VERSION -ge 800; then + buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile linux-headers" + fi + ;; xlswriter@alpine) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile zlib-dev" ;; @@ -1018,6 +1594,12 @@ buildRequiredPackageLists() { ;; esac ;; + zmq@alpine) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent zeromq-dev" + ;; + zmq@debian) + buildRequiredPackageLists_persistent="$buildRequiredPackageLists_persistent libzmq3-dev" + ;; zookeeper@alpine) if ! test -f /usr/local/include/zookeeper/zookeeper.h; then buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile maven automake libtool openjdk8" @@ -1037,11 +1619,6 @@ buildRequiredPackageLists() { if test -z "$buildRequiredPackageLists_persistent$buildRequiredPackageLists_volatile"; then return fi - case "$DISTRO" in - debian) - DEBIAN_FRONTEND=noninteractive apt-get update -q - ;; - esac if test -n "$buildRequiredPackageLists_persistent"; then PACKAGES_PERSISTENT_NEW="$(expandPackagesToBeInstalled $buildRequiredPackageLists_persistent)" if test -s "$IPE_ERRFLAG_FILE"; then @@ -1064,7 +1641,9 @@ buildRequiredPackageLists() { resetIFS for buildRequiredPackageLists_package in $buildRequiredPackageLists_packages; do if ! stringInList "$buildRequiredPackageLists_package" "$PACKAGES_PERSISTENT_NEW"; then - PACKAGES_VOLATILE="$PACKAGES_VOLATILE $buildRequiredPackageLists_package" + if test "$buildRequiredPackageLists_package" != icu-data-en || ! stringInList icu-data-full "$PACKAGES_PERSISTENT_NEW"; then + PACKAGES_VOLATILE="$PACKAGES_VOLATILE $buildRequiredPackageLists_package" + fi fi done PACKAGES_VOLATILE="${PACKAGES_VOLATILE# }" @@ -1107,7 +1686,7 @@ expandPackagesToBeInstalled() { resetIFS ;; debian) - expandPackagesToBeInstalled_log="$(DEBIAN_FRONTEND=noninteractive apt-get install -sy --no-install-recommends $@ 2>&1 || printf '\nE: apt-get failed\n')" + expandPackagesToBeInstalled_log="$(DEBIAN_FRONTEND=noninteractive apt-get install -sy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS $@ 2>&1 || printf '\nE: apt-get failed\n')" if test -n "$(printf '%s' "$expandPackagesToBeInstalled_log" | grep -E '^E:')"; then printf 'FAILED TO LIST THE WHOLE PACKAGE LIST FOR\n' >&2 printf '%s ' "$@" >&2 @@ -1165,6 +1744,10 @@ expandInstalledSystemPackageName() { # Output: # The number of processor cores available getProcessorCount() { + if test -n "${IPE_PROCESSOR_COUNT:-}"; then + echo $IPE_PROCESSOR_COUNT + return + fi if command -v nproc >/dev/null 2>&1; then nproc else @@ -1205,71 +1788,235 @@ getCompilationProcessorCount() { esac } -# Mark the pre-installed APT/APK packages as used -# that way they won't be uninstalled by accident -markPreinstalledPackagesAsUsed() { - printf '### MARKING PRE-INSTALLED PACKAGES AS IN-USE ###\n' - case "$DISTRO" in - alpine) - printf '# Packages: %s\n' "$PACKAGES_PERSISTENT_PRE" - apk add $PACKAGES_PERSISTENT_PRE +# Get the full path of a PHP extension given its name. +# +# Arguments: +# $1: the name of the PHP extension +# +# Output: +# The absolute path of the PHP extension file (or nothing if the file can't be found) +getModuleFullPath() { + case "$1" in + apcu_bc) + getModuleFullPath_path="$PHP_EXTDIR/apc.so" ;; - debian) - DEBIAN_FRONTEND=noninteractive apt-mark manual $PACKAGES_PERSISTENT_PRE + seasclick) + getModuleFullPath_path="$PHP_EXTDIR/SeasClick.so" + ;; + *) + getModuleFullPath_path="$PHP_EXTDIR/$1.so" ;; esac + if ! test -f "$getModuleFullPath_path"; then + printf 'Unable to find the file of the PHP extension "%s"\n' "$1" >&2 + exit 1 + fi + printf '%s' "$getModuleFullPath_path" } -# Install the required APT/APK packages +# Post-process a PHP module just compiled and installed in the PHP extension directory # # Arguments: -# $@: the list of APT/APK packages to be installed -installRequiredPackages() { - printf '### INSTALLING REQUIRED PACKAGES ###\n' - printf '# Packages to be kept after installation: %s\n' "$PACKAGES_PERSISTENT_NEW" - printf '# Packages to be used only for installation: %s\n' "$PACKAGES_VOLATILE" - case "$DISTRO" in - alpine) - apk add $IPE_APK_FLAGS $PACKAGES_PERSISTENT_NEW $PACKAGES_VOLATILE - apk upgrade - ;; - debian) - DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq -y $PACKAGES_PERSISTENT_NEW $PACKAGES_VOLATILE - ;; - esac +# $1: the name of the PHP extension +# +# Return: +# 0 (true): if suceeded +# non-zero (false): in case of errors +postProcessModule() { + postProcessModule_file="$(getModuleFullPath "$1")" + if test $PHP_DEBUGBUILD -ne 1; then + printf 'Removing symbols from %s... ' "$postProcessModule_file" + postProcessModule_preSize="$(stat -c %s "$postProcessModule_file")" + strip --strip-all "$postProcessModule_file" + postProcessModule_postSize="$(stat -c %s "$postProcessModule_file")" + printf 'done (%s bytes saved).\n' "$((postProcessModule_preSize - postProcessModule_postSize))" + fi + return $? } -# Get the version of an installed APT/APK package +# Get the type of the php.ini entry to be used for a PHP extension # # Arguments: -# $1: the name of the installed package +# $1: the name of the PHP extension # # Output: -# The numeric part of the package version, with from 1 to 3 numbers -# -# Example: -# 1 -# 1.2 -# 1.2.3 -getInstalledPackageVersion() { - case "$DISTRO" in - alpine) - apk info "$1" | head -n1 | cut -c $((${#1} + 2))- | grep -o -E '^[0-9]+(\.[0-9]+){0,2}' - ;; - debian) - dpkg-query --showformat='${Version}' --show "$1" 2>/dev/null | grep -o -E '^[0-9]+(\.[0-9]+){0,2}' +# zend_extension or extension +getModuleIniEntryType() { + case "$1" in + ioncube_loader | sourceguardian) + # On PHP 5.5, docker-php-ext-enable fails to detect that ionCube Loader and sourceguardian are Zend extensions + if test $PHP_MAJMIN_VERSION -le 505; then + printf 'zend_extension' + return 0 + fi ;; esac + getModuleIniEntryType_file="$(getModuleFullPath "$1")" + if readelf --wide --syms "$getModuleIniEntryType_file" | grep -Eq ' zend_extension_entry$'; then + printf 'zend_extension' + else + printf 'extension' + fi } -# Compare two versions +# Create the contents of a PHP ini file that enables an extension # # Arguments: -# $1: the first version -# $2: the second version +# $1: the name of the PHP extension +# $2: additional php.ini configuration (optional) # -# Output -# -1 if $1 is less than $2 +# Output: +# The contents of the ini file +buildPhpExtensionIniContent() { + buildPhpExtensionIniContent_type="$(getModuleIniEntryType "$1")" + buildPhpExtensionIniContent_soFile="$(getModuleFullPath "$1")" + buildPhpExtensionIniContent_result="$(printf '%s=%s' "$buildPhpExtensionIniContent_type" "${buildPhpExtensionIniContent_soFile##$PHP_EXTDIR/}")" + if test -n "${2:-}"; then + buildPhpExtensionIniContent_result="$(printf '%s\n%s' "$buildPhpExtensionIniContent_result" "$2")" + fi + printf '%s' "$buildPhpExtensionIniContent_result" +} + +# Check that a PHP module actually works (better to run this check before enabling the extension) +# +# Arguments: +# $1: the name of the PHP extension +# $2: base name (without path and extension) of additional php.ini configuration (optional) +# $3: additional php.ini configuration (optional) +# +# Return: +# 0 (true): if the string is in the list +# 1 (false): if the string is not in the list +checkModuleWorking() { + if test -n "${2:-}"; then + checkModuleWorking_iniFile="$PHP_INI_DIR/conf.d/$2--temp.ini" + else + checkModuleWorking_iniFile="$PHP_INI_DIR/conf.d/docker-php-ext-$1--temp.ini" + fi + checkModuleWorking_iniContent="$(buildPhpExtensionIniContent "$1" "${3:-}")" + printf 'Check if the %s module can be loaded... ' "$1" + checkModuleWorking_errBefore="$(php -r 'return;' 2>&1 || true)" + printf '%s' "$checkModuleWorking_iniContent" >"$checkModuleWorking_iniFile" + checkModuleWorking_errAfter="$(php -r 'return;' 2>&1 || true)" + rm "$checkModuleWorking_iniFile" + if test "$checkModuleWorking_errAfter" != "$checkModuleWorking_errBefore"; then + printf 'Error loading the "%s" extension:\n%s\n' "$1" "$checkModuleWorking_errAfter" >&2 + return 1 + fi + printf 'ok.\n' + return 0 +} + +# Enable a PHP extension +# +# Arguments: +# $1: the name of the PHP extension to be enabled +# $2: base name (without path and extension) of additional php.ini configuration (optional) +# $3: additional php.ini configuration (optional) +enablePhpExtension() { + if test -n "${2:-}"; then + enablePhpExtension_iniFile="$PHP_INI_DIR/conf.d/$2.ini" + else + enablePhpExtension_iniFile="$PHP_INI_DIR/conf.d/docker-php-ext-$1.ini" + fi + enablePhpExtension_iniContent="$(buildPhpExtensionIniContent "$1" "${3:-}")" + case "${IPE_DONT_ENABLE:-}" in + 1 | y* | Y*) + enablePhpExtension_enableCommand="/usr/local/bin/docker-php-ext-enable-$1" + printf '%s' "$enablePhpExtension_iniContent" >"$enablePhpExtension_iniFile-disabled" + printf '\n' >>"$enablePhpExtension_iniFile-disabled" + cat <"$enablePhpExtension_enableCommand" +#!/bin/sh + +if test -f '$enablePhpExtension_iniFile-disabled'; then + echo 'Enabling extension $1' + mv '$enablePhpExtension_iniFile-disabled' '$enablePhpExtension_iniFile' +else + echo 'The extension $1 has already been enabled' +fi +EOT + chmod +x "$enablePhpExtension_enableCommand" + printf '## Extension %s not enabled.\nYou can enable it by running the following command:\n%s\n\n' "$1" "$(basename "$enablePhpExtension_enableCommand")" + ;; + *) + printf '%s' "$enablePhpExtension_iniContent" >"$enablePhpExtension_iniFile" + printf '\n' >>"$enablePhpExtension_iniFile" + ;; + esac +} + +# Mark the pre-installed APT/APK packages as used +# that way they won't be uninstalled by accident +markPreinstalledPackagesAsUsed() { + printf '### MARKING PRE-INSTALLED PACKAGES AS IN-USE ###\n' + case "$DISTRO" in + alpine) + printf '# Packages: %s\n' "$PACKAGES_PERSISTENT_PRE" + apk add $PACKAGES_PERSISTENT_PRE + ;; + debian) + DEBIAN_FRONTEND=noninteractive apt-mark manual $PACKAGES_PERSISTENT_PRE + ;; + esac +} + +# Install the required APT/APK packages +# +# Arguments: +# $@: the list of APT/APK packages to be installed +installRequiredPackages() { + printf '### INSTALLING REQUIRED PACKAGES ###\n' + printf '# Packages to be kept after installation: %s\n' "$PACKAGES_PERSISTENT_NEW" + printf '# Packages to be used only for installation: %s\n' "$PACKAGES_VOLATILE" + case "$DISTRO" in + alpine) + apk add $IPE_APK_FLAGS $PACKAGES_PERSISTENT_NEW $PACKAGES_VOLATILE + # https://gitlab.alpinelinux.org/alpine/aports/-/issues/12763#note_172090 + # https://github.com/mlocati/docker-php-extension-installer/issues/385 + # https://github.com/mlocati/docker-php-extension-installer/issues/537#issuecomment-1078748882 + for installRequiredPackages_item in wget; do + if test -n "$(expandInstalledSystemPackageName "$installRequiredPackages_item")"; then + apk add --upgrade "$installRequiredPackages_item" + fi + done + ;; + debian) + DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS $PACKAGES_PERSISTENT_NEW $PACKAGES_VOLATILE + ;; + esac +} + +# Get the version of an installed APT/APK package +# +# Arguments: +# $1: the name of the installed package +# +# Output: +# The numeric part of the package version, with from 1 to 3 numbers +# +# Example: +# 1 +# 1.2 +# 1.2.3 +getInstalledPackageVersion() { + case "$DISTRO" in + alpine) + apk info "$1" | head -n1 | cut -c $((${#1} + 2))- | grep -o -E '^[0-9]+(\.[0-9]+){0,2}' + ;; + debian) + dpkg-query --showformat='${Version}' --show "$1" 2>/dev/null | grep -o -E '^[0-9]+(\.[0-9]+){0,2}' + ;; + esac +} + +# Compare two versions +# +# Arguments: +# $1: the first version +# $2: the second version +# +# Output +# -1 if $1 is less than $2 # 0 if $1 is the same as $2 # 1 if $1 is greater than $2 compareVersions() { @@ -1290,30 +2037,51 @@ compareVersions() { # Set: # ORACLE_INSTANTCLIENT_LIBPATH installOracleInstantClient() { - if test $(php -r 'echo PHP_INT_SIZE;') -eq 4; then - installOracleInstantClient_client=client - installOracleInstantClient_version='19.9' - installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-basic-linux-$installOracleInstantClient_version.0.0.0dbru.zip - installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-sdk-linux-$installOracleInstantClient_version.0.0.0dbru.zip - else - installOracleInstantClient_client=client64 - installOracleInstantClient_version='21.1' - installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-basic-linux.x64-$installOracleInstantClient_version.0.0.0.zip - installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-sdk-linux.x64-$installOracleInstantClient_version.0.0.0.zip - fi + case "${IPE_INSTANTCLIENT_BASIC:-}" in + 1 | y* | Y*) + installOracleInstantClient_handle=basic + ;; + *) + installOracleInstantClient_handle=basiclite + ;; + esac + case $PHP_BITS in + 32) + installOracleInstantClient_client=client + installOracleInstantClient_version='19.9' + installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-$installOracleInstantClient_handle-linux-$installOracleInstantClient_version.0.0.0dbru.zip + installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-sdk-linux-$installOracleInstantClient_version.0.0.0dbru.zip + ;; + *) + case $(uname -m) in + aarch64*) + installOracleInstantClient_client=client64 + installOracleInstantClient_version='19.10' + installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-$installOracleInstantClient_handle-linux.arm64-$installOracleInstantClient_version.0.0.0dbru.zip + installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/191000/instantclient-sdk-linux.arm64-$installOracleInstantClient_version.0.0.0dbru.zip + ;; + *) + installOracleInstantClient_client=client64 + installOracleInstantClient_version='21.1' + installOracleInstantClient_ic=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-$installOracleInstantClient_handle-linux.x64-$installOracleInstantClient_version.0.0.0.zip + installOracleInstantClient_sdk=https://download.oracle.com/otn_software/linux/instantclient/211000/instantclient-sdk-linux.x64-$installOracleInstantClient_version.0.0.0.zip + ;; + esac + ;; + esac ORACLE_INSTANTCLIENT_LIBPATH=/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client/lib if ! test -e "$ORACLE_INSTANTCLIENT_LIBPATH"; then - printf 'Downloading Oracle Instant Client v%s... ' "$installOracleInstantClient_version" + printf 'Downloading Oracle Instant Client v%s (%s)... ' "$installOracleInstantClient_version" "$installOracleInstantClient_handle" installOracleInstantClient_src="$(getPackageSource $installOracleInstantClient_ic)" mkdir -p "/usr/lib/oracle/$installOracleInstantClient_version/$installOracleInstantClient_client" mv "$installOracleInstantClient_src" "$ORACLE_INSTANTCLIENT_LIBPATH" echo 'done.' fi - if ! test -e "$ORACLE_INSTANTCLIENT_LIBPATH/sdk"; then + if ! test -e "$ORACLE_INSTANTCLIENT_LIBPATH/sdk" && ! test -L "$ORACLE_INSTANTCLIENT_LIBPATH/sdk"; then printf 'Downloading Oracle Instant SDK v%s... ' "$installOracleInstantClient_version" installOracleInstantClient_src="$(getPackageSource $installOracleInstantClient_sdk)" ln -sf "$installOracleInstantClient_src/sdk" "$ORACLE_INSTANTCLIENT_LIBPATH/sdk" - UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS '$ORACLE_INSTANTCLIENT_LIBPATH/sdk'" + UNNEEDED_PACKAGE_LINKS="$UNNEEDED_PACKAGE_LINKS $ORACLE_INSTANTCLIENT_LIBPATH/sdk" echo 'done.' fi case "$DISTRO" in @@ -1327,11 +2095,14 @@ installOracleInstantClient() { cat "$ORACLE_INSTANTCLIENT_LIBPATH" | awk -v suffix=":$ORACLE_INSTANTCLIENT_LIBPATH" '{print NR==1 ? $0suffix : $0}' >"$ORACLE_INSTANTCLIENT_LIBPATH" fi else - if test $(php -r 'echo PHP_INT_SIZE;') -eq 4; then - echo "/lib:/usr/local/lib:/usr/lib:$ORACLE_INSTANTCLIENT_LIBPATH" >"$installOracleInstantClient_ldconf" - else - echo "/lib64:/lib:/usr/local/lib:/usr/lib:$ORACLE_INSTANTCLIENT_LIBPATH" >"$installOracleInstantClient_ldconf" - fi + case $PHP_BITS in + 32) + echo "/lib:/usr/local/lib:/usr/lib:$ORACLE_INSTANTCLIENT_LIBPATH" >"$installOracleInstantClient_ldconf" + ;; + *) + echo "/lib64:/lib:/usr/local/lib:/usr/lib:$ORACLE_INSTANTCLIENT_LIBPATH" >"$installOracleInstantClient_ldconf" + ;; + esac fi ;; debian) @@ -1353,31 +2124,305 @@ isMicrosoftSqlServerODBCInstalled() { } # Install the Microsoft SQL Server ODBC Driver +# see https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server installMicrosoftSqlServerODBC() { printf 'Installing the Microsoft SQL Server ODBC Driver\n' case "$DISTRO" in alpine) - # https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server#alpine17 rm -rf /tmp/src/msodbcsql.apk - curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.7.2.1-1_amd64.apk + if test $PHP_MAJMIN_VERSION -le 703; then + curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_17.10.6.1-1_amd64.apk + else + case $(uname -m) in + aarch64 | arm64 | armv8) + installMicrosoftSqlServerODBC_arch=arm64 + ;; + *) + installMicrosoftSqlServerODBC_arch=amd64 + ;; + esac + curl -sSLf -o /tmp/src/msodbcsql.apk https://download.microsoft.com/download/3/5/5/355d7943-a338-41a7-858d-53b259ea33f5/msodbcsql18_18.3.3.1-1_$installMicrosoftSqlServerODBC_arch.apk + fi printf '\n' | apk add --allow-untrusted /tmp/src/msodbcsql.apk rm -rf /tmp/src/msodbcsql.apk ;; debian) - # https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server#debian17 printf -- '- installing the Microsoft APT key\n' - curl -sSLf https://packages.microsoft.com/keys/microsoft.asc | apt-key add - + if test $DISTRO_VERSION_NUMBER -eq 11; then + curl -sSLf -o /etc/apt/trusted.gpg.d/microsoft.asc https://packages.microsoft.com/keys/microsoft.asc + elif test $DISTRO_VERSION_NUMBER -ge 12; then + curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor --yes --output /usr/share/keyrings/microsoft-prod.gpg + else + # apt-key is deprecated + curl -sSLf https://packages.microsoft.com/keys/microsoft.asc | apt-key add - + fi if ! test -f /etc/apt/sources.list.d/mssql-release.list; then printf -- '- adding the Microsoft APT source list\n' curl -sSLf https://packages.microsoft.com/config/debian/$DISTRO_VERSION_NUMBER/prod.list >/etc/apt/sources.list.d/mssql-release.list - DEBIAN_FRONTEND=noninteractive apt-get -q update + invokeAptGetUpdate fi printf -- '- installing the APT package\n' - DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get -qy --no-install-recommends install '^msodbcsql[0-9]+$' + if test $PHP_MAJMIN_VERSION -le 703; then + DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -qqy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS msodbcsql17 + elif test $DISTRO_VERSION_NUMBER -ge 9 && test $DISTRO_VERSION_NUMBER -le 12; then + # On Debian 9 to 12 we have both msodbcsql17 and msodbcsql18: let's install just one + DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -qqy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS msodbcsql18 + else + DEBIAN_FRONTEND=noninteractive ACCEPT_EULA=Y apt-get install -qqy --no-install-recommends $IPE_APTGET_INSTALLOPTIONS '^msodbcsql[0-9]+$' + fi + ;; + esac +} + +# Check if libaom is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibaomInstalled() { + if ! test -f /usr/local/lib/libaom.so && ! test -f /usr/lib/libaom.so && ! test -f /usr/lib/x86_64*/libaom.so; then + return 1 + fi + if ! test -f /usr/local/include/aom/aom_codec.h && ! test -f /usr/include/aom/aom_codec.h; then + return 1 + fi + return 0 +} + +# Install libaom +installLibaom() { + printf 'Installing libaom\n' + installLibaom_version=3.8.1 + case "$DISTRO_VERSION" in + debian@10) + case $(uname -m) in + aarch* | arm*) + #see https://bugs.chromium.org/p/aomedia/issues/detail?id=3543 + installLibaom_version=3.5.0 + ;; + esac ;; esac + installLibaom_dir="$(getPackageSource https://aomedia.googlesource.com/aom/+archive/v$installLibaom_version.tar.gz)" + mkdir -- "$installLibaom_dir/my.build" + cd -- "$installLibaom_dir/my.build" + cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=0 -DENABLE_TESTDATA=0 -DENABLE_TESTS=0 -DENABLE_TOOLS=0 -DCMAKE_INSTALL_LIBDIR:PATH=lib .. + ninja -j $(getProcessorCount) install + cd - >/dev/null + ldconfig || true +} + +# Check if libdav1d is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibdav1dInstalled() { + if ! test -f /usr/local/lib/libdav1d.so && ! test -f /usr/lib/libdav1d.so && ! test -f /usr/lib/x86_64*/libdav1d.so; then + return 1 + fi + if ! test -f /usr/local/include/dav1d/dav1d.h && ! test -f /usr/include/dav1d/dav1d.h; then + return 1 + fi + return 0 +} + +# Install libdav1d +installLibdav1d() { + printf 'Installing libdav1d\n' + installLibdav1d_dir="$(getPackageSource https://github.com/videolan/dav1d/archive/refs/tags/1.3.0.tar.gz)" + mkdir -- "$installLibdav1d_dir/build" + cd -- "$installLibdav1d_dir/build" + meson --buildtype release -Dprefix=/usr .. + ninja -j $(getProcessorCount) install + cd - >/dev/null + if test -f /usr/lib/$TARGET_TRIPLET/libdav1d.so && ! test -f /usr/lib/libdav1d.so; then + ln -s /usr/lib/$TARGET_TRIPLET/libdav1d.so /usr/lib/ + fi + ldconfig || true +} + +# Check if libyuv is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibyuvInstalled() { + if ! test -f /usr/local/lib/libyuv.so && ! test -f /usr/lib/libyuv.so && ! test -f /usr/lib/x86_64*/libyuv.so && ! test -f /usr/lib/x86_64*/libyuv.so.*; then + return 1 + fi + if ! test -f /usr/local/include/libyuv.h && ! test -f /usr/include/libyuv.h; then + return 1 + fi + return 0 +} + +# Install libyuv +installLibyuv() { + printf 'Installing libyuv\n' + installLibyuv_dir="$(getPackageSource https://chromium.googlesource.com/libyuv/libyuv/+archive/d359a9f922af840b043535d43cf9d38b220d102e.tar.gz)" + mkdir -- "$installLibyuv_dir/build" + cd -- "$installLibyuv_dir/build" + cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -B. .. + make -j$(getProcessorCount) install + cd - >/dev/null } +# Check if libavif is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibavifInstalled() { + if ! test -f /usr/local/lib/libavif.so && ! test -f /usr/lib/libavif.so && ! test -f /usr/lib/x86_64*/libavif.so; then + return 1 + fi + if ! test -f /usr/local/include/avif/avif.h && ! test -f /usr/include/avif/avif.h; then + return 1 + fi + return 0 +} + +# Install libavif +installLibavif() { + printf 'Installing libavif\n' + installLibavif_dir="$(getPackageSource https://codeload.github.com/AOMediaCodec/libavif/tar.gz/refs/tags/v1.0.3)" + mkdir -- "$installLibavif_dir/build" + cd -- "$installLibavif_dir/build" + cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DAVIF_CODEC_AOM=ON -DCMAKE_INSTALL_LIBDIR:PATH=lib + make -j$(getProcessorCount) install + cd - >/dev/null +} + +# Install libmpdec +installLibMPDec() { + installLibMPDec_src="$(getPackageSource https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.1.tar.gz)" + cd -- "$installLibMPDec_src" + ./configure --disable-cxx + make -j$(getProcessorCount) + make install + cd - >/dev/null +} + +# Check if libdatrie is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibDatrieInstalled() { + if ! test -f /usr/local/lib/libdatrie.so && ! test -f /usr/lib/libdatrie.so && ! test -f /usr/lib/x86_64*/libdatrie.so; then + return 1 + fi + if ! test -f /usr/local/include/datrie/trie.h && ! test -f /usr/include/datrie/trie.h; then + return 1 + fi + return 0 +} + +# Install libdatrie +installLibDatrie() { + printf 'Installing libdatrie\n' + installLibDatrie_src="$(getPackageSource https://github.com/tlwg/libdatrie/releases/download/v0.2.13/libdatrie-0.2.13.tar.xz)" + cd -- "$installLibDatrie_src" + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null +} + +# Check if libdatrie is installed +# +# Return: +# 0 (true) +# 1 (false) +isLibThaiInstalled() { + return 1 + if ! test -f /usr/local/lib/libthai.so && ! test -f /usr/lib/libthai.so && ! test -f /usr/lib/x86_64*/libthai.so; then + return 1 + fi + if ! test -f /usr/local/include/thai/thailib.h && ! test -f /usr/include/thai/thailib.h; then + return 1 + fi + return 0 +} + +# Install libdatrie +installLibThai() { + printf 'Installing libthai\n' + installLibThai_src="$(getPackageSource https://github.com/tlwg/libthai/releases/download/v0.1.29/libthai-0.1.29.tar.xz)" + cd -- "$installLibThai_src" + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null +} + +isLibTommathInstalled() { + if test -f /usr/local/lib/libtommath.a && test -f /usr/local/include/tommath.h; then + return 0 + fi + return 1 +} + +installLibTommath() { + printf 'Installing libtommath\n' + installLibTommath_src="$(getPackageSource https://github.com/libtom/libtommath/releases/download/v1.3.0/ltm-1.3.0.tar.xz)" + mkdir -p "$installLibTommath_src/build" + cd -- "$installLibTommath_src/build" + CFLAGS='-fPIC' cmake -DCMAKE_BUILD_TYPE=Release .. + make -j$(getProcessorCount) + make install + cd - >/dev/null +} + +isLibTomcryptInstalled() { + if test -f /usr/local/lib/libtomcrypt.a && test -f /usr/local/include/tomcrypt.h; then + return 0 + fi + return 1 +} + +installLibTomcrypt() { + printf 'Installing libtomcrypt\n' + installLibTomcrypt_src="$(getPackageSource https://github.com/libtom/libtomcrypt/releases/download/v1.18.2/crypt-1.18.2.tar.xz)" + cd -- "$installLibTomcrypt_src" + CFLAGS='-fPIC' make -j$(getProcessorCount) + make install +} + +isFirebirdInstalled() { + if test -f /usr/lib/libfbclient.so && test -f /usr/include/ibase.h; then + return 0 + fi + if test -d /tmp/src/firebird; then + return 0 + fi + return 1 +} + +installFirebird() { + printf 'Installing firebird\n' + if test $PHP_MAJMIN_VERSION -ge 804; then + installFirebird_src="$(getPackageSource https://github.com/FirebirdSQL/firebird/releases/download/v5.0.1/Firebird-5.0.1.1469-0-source.tar.xz)" + cd -- "$installFirebird_src" + ./configure --enable-client-only + make -j$(getProcessorCount) + cp -Rd gen/Release/firebird/include/* /usr/include + cp -Rd gen/Release/firebird/lib/* /usr/lib + cd - >/dev/null + else + mv "$(getPackageSource https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/Firebird-2.5.9.27139-0.tar.bz2)" /tmp/src/firebird + cd /tmp/src/firebird + # Patch rwlock.h (this has been fixed in later release of firebird 3.x) + sed -i '194s/.*/#if 0/' src/common/classes/rwlock.h + ./configure --with-system-icu + # -j option can't be used: make targets must be compiled sequentially + make -s btyacc_binary gpre_boot libfbstatic libfbclient + cp gen/firebird/lib/libfbclient.so /usr/lib/ + ln -s /usr/lib/libfbclient.so /usr/lib/libfbclient.so.2 + cd - >/dev/null + fi +} # Install Composer installComposer() { installComposer_version="$(getWantedPHPModuleVersion @composer)" @@ -1425,6 +2470,156 @@ actuallyInstallComposer() { rm -- "$actuallyInstallComposer_installer" } +# Install ionCube Loader +installIonCubeLoader() { + # See https://www.ioncube.com/loaders.php + case $PHP_BITS in + 32) + case $(uname -m) in + aarch* | arm*) + installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_armv7l.tar.gz" + ;; + *) + installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86.tar.gz" + ;; + esac + ;; + *) + case $(uname -m) in + aarch64 | arm64 | armv8) + installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_aarch64.tar.gz" + ;; + *) + installIonCubeLoader_url="https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz" + ;; + esac + ;; + esac + printf 'Downloading ionCube Loader... ' + installIonCubeLoader_dir="$(getPackageSource $installIonCubeLoader_url)" + echo 'done.' + installIonCubeLoader_so=$(php -r "printf('ioncube_loader_lin_%s.%s%s.so', PHP_MAJOR_VERSION, PHP_MINOR_VERSION, ZEND_THREAD_SAFE ? '_ts' : '');") + cp "$installIonCubeLoader_dir/$installIonCubeLoader_so" "$(getPHPExtensionsDir)/ioncube_loader.so" +} + +# Install SourceGuardian Loader +installSourceGuardian() { + # See https://www.sourceguardian.com/loaders.html + case $PHP_BITS in + 32) + installSourceGuardian_url=https://www.sourceguardian.com/loaders/download/loaders.linux-i386.tar.gz + ;; + *) + case $(uname -m) in + aarch64 | arm64 | armv8) + installSourceGuardian_url=https://www.sourceguardian.com/loaders/download/loaders.linux-aarch64.tar.gz + ;; + *) + installSourceGuardian_url=https://www.sourceguardian.com/loaders/download/loaders.linux-x86_64.tar.gz + ;; + esac + ;; + esac + printf 'Downloading SourceGuardian... ' + installSourceGuardian_dir="$(getPackageSource $installSourceGuardian_url)" + printf 'done (version: %s)\n' "$(cat "$installSourceGuardian_dir/version")" + for installSourceGuardian_phpv in $PHP_MAJDOTMINDOTPAT_VERSION $PHP_MAJDOTMIN_VERSION; do + installSourceGuardian_file="$installSourceGuardian_dir/ixed.$PHP_MAJDOTMIN_VERSION" + if test $PHP_THREADSAFE -eq 1; then + installSourceGuardian_file="${installSourceGuardian_file}ts" + fi + installSourceGuardian_file="${installSourceGuardian_file}.lin" + if test -f "$installSourceGuardian_file"; then + mv "$installSourceGuardian_file" "$(getPHPExtensionsDir)/sourceguardian.so" + return + fi + done + printf 'Unable to find a SourceGuardian compatible with PHP %s or PHP %s.\nAvailable SourceGuardian versions:\n' "$PHP_MAJDOTMINDOTPAT_VERSION" "$PHP_MAJDOTMIN_VERSION" >&2 + ls -1 "$installSourceGuardian_dir" | grep -E '^ixed\..*\.lin$' | sed -E 's/^[^0-9]+([0-9]+(\.[0-9]+)*).*$/\1/' | sort | uniq >&2 + exit 1 +} + +# Install Cargo (if not yet installed) +installCargo() { + if command -v cargo >/dev/null; then + return + fi + printf '# Installing cargo\n' + case "$DISTRO" in + alpine) + # see https://github.com/hyperledger/indy-vdr/issues/69#issuecomment-998104850 + export RUSTFLAGS='-C target-feature=-crt-static' + ;; + esac + curl https://sh.rustup.rs -sSf | sh -s -- -y -q + . "$HOME/.cargo/env" + if test -z "${IPE_UNINSTALL_CARGO:-}"; then + IPE_UNINSTALL_CARGO=y + fi +} + +installNewRelic() { + printf '# Installing newrelic\n' + installNewRelic_search='\bnewrelic-php[0-9.]*-[0-9]+(\.[0-9]+)*-linux' + case "$DISTRO" in + alpine) + installNewRelic_search="$installNewRelic_search-musl" + ;; + esac + installNewRelic_file="$(curl -sSLf -o- https://download.newrelic.com/php_agent/release/ | sed -E 's/<[^>]*>//g' | grep -Eo "$installNewRelic_search.tar.gz" | sort | head -1)" + installNewRelic_url="https://download.newrelic.com/php_agent/release/$installNewRelic_file" + installNewRelic_src="$(getPackageSource "$installNewRelic_url")" + cd -- "$installNewRelic_src" + NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 ./newrelic-install install + case "${IPE_NEWRELIC_DAEMON:-}" in + 1 | y* | Y*) + NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 ./newrelic-install install_daemon + ;; + esac + case "${IPE_NEWRELIC_KEEPLOG:-}" in + 1 | y* | Y*) ;; + *) + rm -f /tmp/nrinstall-*.tar + ;; + esac + cd - >/dev/null + cat <&2 fi + if test -n "$(getModuleSourceCodePath "$1")"; then + printf '### WARNING the module "%s" is bundled with PHP, you can NOT specify a source code path for it\n' "$1" >&2 + fi case "$1" in dba) if test -e /usr/lib/$TARGET_TRIPLET/libdb-5.3.so && ! test -e /usr/lib/libdb-5.3.so; then @@ -1461,6 +2659,39 @@ EOF fi docker-php-ext-configure dba --with-db4 ;; + enchant) + installBundledModule_tmp=0 + if test $PHP_MAJMIN_VERSION -lt 800; then + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -ge 312; then + installBundledModule_tmp=1 + fi + ;; + debian) + if test $DISTRO_VERSION_NUMBER -ge 11; then + installBundledModule_tmp=1 + fi + ;; + esac + fi + if test $installBundledModule_tmp -eq 1 && ! test -f /usr/lib/libenchant.so && ! test -f /usr/local/lib/libenchant.so; then + # We need to install libenchant1 from source + installBundledModule_src="$(getPackageSource https://github.com/AbiWord/enchant/releases/download/enchant-1-6-1/enchant-1.6.1.tar.gz)" + cd -- "$installBundledModule_src" + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null + fi + ;; + ftp) + if test $PHP_MAJMIN_VERSION -ge 804; then + docker-php-ext-configure ftp --with-ftp-ssl=/usr + else + docker-php-ext-configure ftp --with-openssl-dir=/usr + fi + ;; gd) if test $PHP_MAJMIN_VERSION -le 506; then docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-vpx-dir @@ -1468,8 +2699,32 @@ EOF docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --enable-gd-native-ttf --with-webp-dir elif test $PHP_MAJMIN_VERSION -le 703; then docker-php-ext-configure gd --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-xpm-dir --with-freetype-dir --with-webp-dir - else + elif test $PHP_MAJMIN_VERSION -le 800; then docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype + else + installBundledModule_tmp=0 + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -ge 315; then + installBundledModule_tmp=1 + fi + ;; + debian) + if test $DISTRO_VERSION_NUMBER -ge 12; then + installBundledModule_tmp=1 + fi + ;; + esac + if test $installBundledModule_tmp -eq 0; then + if isLibaomInstalled && isLibdav1dInstalled && isLibyuvInstalled && isLibavifInstalled; then + installBundledModule_tmp=1 + fi + fi + if test $installBundledModule_tmp -eq 1; then + docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype --with-avif + else + docker-php-ext-configure gd --enable-gd --with-webp --with-jpeg --with-xpm --with-freetype + fi fi ;; gmp) @@ -1485,7 +2740,7 @@ EOF debian@9) installBundledModule_tmp="$(pwd)" cd /tmp - apt-get download libc-client2007e-dev + apt-get download $IPE_APTGET_INSTALLOPTIONS libc-client2007e-dev dpkg -i --ignore-depends=libssl-dev libc-client2007e-dev* rm libc-client2007e-dev* cd "$installBundledModule_tmp" @@ -1496,19 +2751,9 @@ EOF interbase | pdo_firebird) case "$DISTRO" in alpine) - if ! test -d /tmp/src/firebird; then - mv "$(getPackageSource https://github.com/FirebirdSQL/firebird/releases/download/R2_5_9/Firebird-2.5.9.27139-0.tar.bz2)" /tmp/src/firebird - cd /tmp/src/firebird - # Patch rwlock.h (this has been fixed in later release of firebird 3.x) - sed -i '194s/.*/#if 0/' src/common/classes/rwlock.h - ./configure --with-system-icu - # -j option can't be used: make targets must be compiled sequentially - make -s btyacc_binary gpre_boot libfbstatic libfbclient - cp gen/firebird/lib/libfbclient.so /usr/lib/ - ln -s /usr/lib/libfbclient.so /usr/lib/libfbclient.so.2 - cd - >/dev/null + if test $PHP_MAJMIN_VERSION -lt 804; then + CFLAGS='-I/tmp/src/firebird/src/jrd -I/tmp/src/firebird/src/include -I/tmp/src/firebird/src/include/gen' docker-php-ext-configure $1 fi - CFLAGS='-I/tmp/src/firebird/src/jrd -I/tmp/src/firebird/src/include -I/tmp/src/firebird/src/include/gen' docker-php-ext-configure $1 ;; esac ;; @@ -1551,6 +2796,15 @@ EOF ;; esac ;; + sockets) + case "$PHP_MAJDOTMINDOTPAT_VERSION" in + 8.0.15 | 8.1.2) + sed -i '70 i #ifndef _GNU_SOURCE' /usr/src/php/ext/sockets/config.m4 + sed -i '71 i #define _GNU_SOURCE' /usr/src/php/ext/sockets/config.m4 + sed -i '72 i #endif' /usr/src/php/ext/sockets/config.m4 + ;; + esac + ;; sybase_ct) docker-php-ext-configure sybase_ct --with-sybase-ct=/usr ;; @@ -1574,6 +2828,7 @@ EOF fi ;; esac + installBundledModule_errBefore="$(php -r 'return;' 2>&1 || true)" docker-php-ext-install -j$(getProcessorCount) "$1" case "$1" in imap) @@ -1584,6 +2839,18 @@ EOF esac ;; esac + case "${IPE_SKIP_CHECK:-}" in + 1 | y* | Y*) ;; + *) + php -r 'return;' >/dev/null 2>/dev/null || true + installBundledModule_errAfter="$(php -r 'return;' 2>&1 || true)" + if test "$installBundledModule_errAfter" != "$installBundledModule_errBefore"; then + printf 'PHP has problems after installing the "%s" extension:\n%s\n' "$1" "$installBundledModule_errAfter" >&2 + rm "$PHP_INI_DIR/conf.d/docker-php-ext-$1.ini" || true + return 1 + fi + ;; + esac } # Fetch a tar.gz file, extract it and returns the path of the extracted folder. @@ -1630,20 +2897,23 @@ getPackageSource() { installRemoteModule() { installRemoteModule_module="$1" printf '### INSTALLING REMOTE MODULE %s ###\n' "$installRemoteModule_module" - installRemoteModule_version="$(resolveWantedPHPModuleVersion "$installRemoteModule_module")" + installRemoteModule_version="$(resolvePHPModuleVersion "$installRemoteModule_module")" + installRemoteModule_path="$(getModuleSourceCodePath "$installRemoteModule_module")" rm -rf "$CONFIGURE_FILE" installRemoteModule_manuallyInstalled=0 installRemoteModule_cppflags='' + installRemoteModule_ini_basename='' + installRemoteModule_ini_extra='' case "$installRemoteModule_module" in amqp) if test -z "$installRemoteModule_version"; then - if test $PHP_MAJMIN_VERSION -ge 800; then - installRemoteModule_version=beta - elif test "$DISTRO_VERSION" = debian@8; then + if test "$DISTRO_VERSION" = debian@8; then # in Debian Jessie we have librabbitmq version 0.5.2 installRemoteModule_version=1.9.3 elif test $PHP_MAJMIN_VERSION -le 505; then installRemoteModule_version=1.9.4 + elif test $PHP_MAJMIN_VERSION -le 703; then + installRemoteModule_version=1.11.0 fi fi ;; @@ -1654,6 +2924,24 @@ installRemoteModule() { fi fi ;; + apcu_bc) + # apcu_bc must be loaded after apcu + installRemoteModule_ini_basename="xx-php-ext-$installRemoteModule_module" + ;; + ast) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 701; then + installRemoteModule_version=1.0.16 + fi + fi + ;; + bitset) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 506; then + installRemoteModule_version=2.0.4 + fi + fi + ;; blackfire) case $(uname -m) in i386 | i686 | x86) @@ -1681,6 +2969,16 @@ installRemoteModule() { mv blackfire-*.so $(getPHPExtensionsDir)/blackfire.so cd - >/dev/null installRemoteModule_manuallyInstalled=1 + installRemoteModule_ini_extra="$(printf '%sblackfire.agent_socket=tcp://blackfire:8307\n' "$installRemoteModule_ini_extra")" + ;; + cassandra) + installRemoteModule_src="$(getPackageSource https://github.com/nano-interactive/ext-cassandra/tarball/1cf12c5ce49ed43a2c449bee4b7b23ce02a37bf0)" + cd "$installRemoteModule_src/ext" + phpize + ./configure + make -j$(getProcessorCount) install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 ;; cmark) if test -z "$installRemoteModule_version"; then @@ -1689,15 +2987,11 @@ installRemoteModule() { fi fi if ! test -e /usr/local/lib/libcmark.so && ! test -e /usr/local/lib64/libcmark.so && ! test -e /usr/lib/libcmark.so && ! test -e /usr/lib64/libcmark.so && ! test -e /lib/libcmark.so; then - case "$DISTRO_VERSION" in - debian@8) - # See https://github.com/commonmark/cmark/issues/384 - installRemoteModule_tmp=0.29.0 - ;; - *) - installRemoteModule_tmp=0.30.1 - ;; - esac + if test $(compareVersions "$(cmake --version | head -n1 | sed -E 's/^.* //')" '3.7') -lt 0; then + installRemoteModule_tmp=0.29.0 + else + installRemoteModule_tmp=0.31.1 + fi cd "$(getPackageSource https://github.com/commonmark/cmark/archive/$installRemoteModule_tmp.tar.gz)" make -s -j$(getProcessorCount) cmake_build make -s -j$(getProcessorCount) install @@ -1721,21 +3015,60 @@ installRemoteModule() { fi fi ;; + ddtrace) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 700; then + installRemoteModule_version=0.75.0 + fi + if test -z "$installRemoteModule_version"; then + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -le 312; then + # cc is not supported due to a memcmp related bug + installRemoteModule_version=1.1.0 + fi + ;; + esac + fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" + fi + if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 0.75.0) -ge 0; then + installCargo + fi + ;; decimal) case "$DISTRO" in - alpine) - if ! test -f /usr/local/lib/libmpdec.so; then - installRemoteModule_src="$(getPackageSource https://www.bytereef.org/software/mpdecimal/releases/mpdecimal-2.5.1.tar.gz)" - cd -- "$installRemoteModule_src" - ./configure --disable-cxx - make -j$(getProcessorCount) - make install - cd - >/dev/null + alpine) + if ! test -f /usr/local/lib/libmpdec.so; then + installLibMPDec + fi + ;; + debian) + if test $DISTRO_MAJMIN_VERSION -ge 1200; then + if test -z "$(ldconfig -p | grep -E '\slibmpdec.so\s')"; then + installLibMPDec + fi fi ;; esac ;; + ds) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 703; then + installRemoteModule_version=1.3.0 + elif test $PHP_MAJMIN_VERSION -lt 704; then + installRemoteModule_version=1.4.0 + fi + fi + ;; + ecma_intl) + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=alpha + fi + ;; event) + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" 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 @@ -1760,7 +3093,7 @@ installRemoteModule() { addConfigureOption with-event-ns no fi # openssl installation prefix - addConfigureOption with-openssl-dir no + addConfigureOption with-openssl-dir yes elif test $(compareVersions "$installRemoteModule_version" 1.7.6) -ge 0; then # Enable internal debugging in Event addConfigureOption enable-event-debug no @@ -1794,6 +3127,8 @@ installRemoteModule() { # openssl installation prefix addConfigureOption with-openssl-dir no fi + # event must be loaded after sockets + installRemoteModule_ini_basename="xx-php-ext-$installRemoteModule_module" ;; gearman) if test -z "$installRemoteModule_version"; then @@ -1804,7 +3139,7 @@ installRemoteModule() { case "$DISTRO" in alpine) if ! test -e /usr/local/include/libgearman/gearman.h || ! test -e /usr/local/lib/libgearman.so; then - installRemoteModule_src="$(getPackageSource https://github.com/gearman/gearmand/releases/download/1.1.19.1/gearmand-1.1.19.1.tar.gz)" + installRemoteModule_src="$(getPackageSource https://github.com/gearman/gearmand/releases/download/1.1.21/gearmand-1.1.21.tar.gz)" cd -- "$installRemoteModule_src" ./configure make -j$(getProcessorCount) install-binPROGRAMS @@ -1819,6 +3154,20 @@ installRemoteModule() { installRemoteModule_version=beta fi ;; + geos) + if test -z "$installRemoteModule_path"; then + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=0def35611f773c951432f1f06a155471a5cb7611 + fi + installRemoteModule_src="$(getPackageSource https://git.osgeo.org/gitea/geos/php-geos/archive/$installRemoteModule_version.tar.gz)" + cd "$installRemoteModule_src" + ./autogen.sh + ./configure + make -j$(getProcessorCount) install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 + fi + ;; geospatial) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then @@ -1841,6 +3190,15 @@ installRemoteModule() { if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=1.33.1 + else + case "$DISTRO_VERSION" in + debian@8) + installRemoteModule_version=1.46.3 + ;; + alpine@3.7 | alpine@3.8 | debian@9) # With newer version: "This package requires GCC 7 or higher" + installRemoteModule_version=1.52.1 + ;; + esac fi fi if test -z "$installRemoteModule_version" || test "$installRemoteModule_version" = 1.35.0; then @@ -1868,6 +3226,8 @@ installRemoteModule() { cd - >/dev/null fi fi + # http must be loaded after raphf and propro + installRemoteModule_ini_basename="xx-php-ext-$installRemoteModule_module" ;; igbinary) if test -z "$installRemoteModule_version"; then @@ -1876,6 +3236,12 @@ installRemoteModule() { fi fi ;; + imap) + # Include Kerberos Support + addConfigureOption with-kerberos yes + # Include SSL Support + addConfigureOption with-imap-ssl yes + ;; inotify) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then @@ -1883,18 +3249,30 @@ installRemoteModule() { fi fi ;; - ioncube_loader) - installRemoteModule_src='https://downloads.ioncube.com/loader_downloads/' - if test $(php -r 'echo PHP_INT_SIZE;') -eq 4; then - installRemoteModule_src="${installRemoteModule_src}ioncube_loaders_lin_x86.tar.gz" - else - installRemoteModule_src="${installRemoteModule_src}ioncube_loaders_lin_x86-64.tar.gz" + ion) + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=alpha fi - printf 'Downloading ionCube Loader... ' - installRemoteModule_src="$(getPackageSource $installRemoteModule_src)" - echo 'done.' - installRemoteModule_so=$(php -r "printf('ioncube_loader_lin_%s.%s%s.so', PHP_MAJOR_VERSION, PHP_MINOR_VERSION, ZEND_THREAD_SAFE ? '_ts' : '');") - cp "$installRemoteModule_src/$installRemoteModule_so" "$(getPHPExtensionsDir)/$installRemoteModule_module.so" + if ! test -f /usr/local/lib/libionc.so || ! test -f /usr/local/include/ionc/ion.h; then + echo 'Installing ion-c... ' + installRemoteModule_src="$(mktemp -p /tmp/src -d)" + git clone -q -c advice.detachedHead=false --depth 1 --branch v1.1.3 https://github.com/amzn/ion-c.git "$installRemoteModule_src/ion" + ( + cd "$installRemoteModule_src/ion" + git submodule init -q + git submodule update -q + mkdir -p build + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. -Wno-dev + make clean + make -j$(getProcessorCount) install + ) + rm -rf "$installRemoteModule_src" + fi + addConfigureOption with-ion "shared,/usr/local" + ;; + ioncube_loader) + installIonCubeLoader installRemoteModule_manuallyInstalled=1 ;; jsmin) @@ -1904,7 +3282,42 @@ installRemoteModule() { fi fi ;; + jsonpath) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 800; then + installRemoteModule_version=1.0.1 + fi + fi + ;; + luasandbox) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 702; then + installRemoteModule_version=3.0.3 + fi + fi + ;; + lz4) + if test -z "$installRemoteModule_path"; then + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=0.4.3 + fi + installRemoteModule_src="$(getPackageSource https://github.com/kjdev/php-ext-lz4/archive/refs/tags/$installRemoteModule_version.tar.gz)" + cd "$installRemoteModule_src" + phpize + ./configure --with-lz4-includedir=/usr + make -j$(getProcessorCount) install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 + fi + ;; lzf) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 702; then + installRemoteModule_version=1.6.8 + fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" + fi if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" '1.5.0') -ge 0; then # Sacrifice speed in favour of compression ratio? case "${IPE_LZF_BETTERCOMPRESSION:-}" in @@ -1921,6 +3334,8 @@ installRemoteModule() { if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=2.1.6 + elif test $PHP_MAJMIN_VERSION -le 702; then + installRemoteModule_version=3.1.3 fi fi ;; @@ -1938,6 +3353,8 @@ installRemoteModule() { if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=2.2.0 fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" fi # Set the path to libmemcached install prefix addConfigureOption 'with-libmemcached-dir' 'no' @@ -1967,8 +3384,20 @@ installRemoteModule() { # Enable memcached session handler support addConfigureOption 'enable-memcached-session' 'yes' fi + # memcached must be loaded after msgpack + installRemoteModule_ini_basename="xx-php-ext-$installRemoteModule_module" + ;; + memprof) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 506; then + installRemoteModule_version=1.0.0 + elif test $PHP_MAJMIN_VERSION -le 700; then + installRemoteModule_version=2.1.0 + fi + fi ;; mongo) + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" '1.5.0') -ge 0; then # Build with Cyrus SASL (MongoDB Enterprise Authentication) support? addConfigureOption '-with-mongo-sasl' 'yes' @@ -1982,8 +3411,36 @@ installRemoteModule() { installRemoteModule_version=1.7.5 elif test $PHP_MAJMIN_VERSION -le 700; then installRemoteModule_version=1.9.2 + elif test $PHP_MAJMIN_VERSION -le 701; then + installRemoteModule_version=1.11.1 + elif test $PHP_MAJMIN_VERSION -le 703; then + installRemoteModule_version=1.16.2 fi fi + if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 1.17.0) -ge 0; then + # Enable developer flags? (yes/no) + addConfigureOption enable-mongodb-developer-flags no + # Enable code coverage? (yes/no) + addConfigureOption enable-mongodb-coverage no + # Use system libraries for libbson, libmongoc, and libmongocrypt? (yes/no) + addConfigureOption with-mongodb-system-libs no + # Enable client-side encryption? (auto/yes/no) + addConfigureOption with-mongodb-client-side-encryption yes + # Enable Snappy for compression? (auto/yes/no) + addConfigureOption with-mongodb-snappy yes + # Enable zlib for compression? (auto/system/bundled/no) + addConfigureOption with-mongodb-zlib yes + # Enable zstd for compression? (auto/yes/no) + addConfigureOption with-mongodb-zstd yes + # Enable SASL for Kerberos authentication? (auto/cyrus/no) + addConfigureOption with-mongodb-sasl yes + # Enable crypto and TLS? (auto/openssl/libressl/darwin/no) + addConfigureOption with-mongodb-ssl yes + # Use system crypto profile (OpenSSL only)? (yes/no) + addConfigureOption enable-mongodb-crypto-system-profile yes + # Use bundled or system utf8proc for SCRAM-SHA-256 SASLprep? (bundled/system) + addConfigureOption with-mongodb-utf8proc bundled + fi ;; mosquitto) if test -z "$installRemoteModule_version"; then @@ -1997,6 +3454,10 @@ installRemoteModule() { fi fi ;; + newrelic) + installNewRelic + installRemoteModule_manuallyInstalled=2 + ;; oauth) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then @@ -2004,17 +3465,142 @@ installRemoteModule() { fi fi ;; + oci8 | pdo_oci) + installOracleInstantClient + if test "$installRemoteModule_module" = oci8; then + addConfigureOption with-oci8 "instantclient,$ORACLE_INSTANTCLIENT_LIBPATH" + elif test "$installRemoteModule_module" = pdo_oci; then + addConfigureOption with-pdo-oci "instantclient,$ORACLE_INSTANTCLIENT_LIBPATH" + fi + ;; opencensus) if test -z "$installRemoteModule_version"; then installRemoteModule_version=alpha fi ;; + openswoole) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 704; then + installRemoteModule_version=4.10.0 + elif test $PHP_MAJMIN_VERSION -lt 801; then + installRemoteModule_version=22.0.0 + fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" + fi + if php --ri sockets >/dev/null 2>/dev/null; then + installRemoteModule_sockets=yes + installRemoteModule_ini_basename="xx-php-ext-$installRemoteModule_module" + else + installRemoteModule_sockets=no + fi + installRemoteModule_openssl=yes + if test -n "$installRemoteModule_version" && test $(compareVersions "$installRemoteModule_version" 22.1.2) -ge 0; then + # enable coroutine sockets? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 protocol? + addConfigureOption enable-http2 yes + # enable coroutine mysqlnd? + addConfigureOption enable-mysqlnd yes + # enable coroutine curl? + addConfigureOption enable-hook-curl yes + # enable coroutine postgres? + addConfigureOption with-postgres yes + elif test $(compareVersions "$installRemoteModule_version" 22.1.1) -ge 0; then + # enable c-ares support? + addConfigureOption enable-cares yes + # enable coroutine sockets? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 protocol? + addConfigureOption enable-http2 yes + # enable coroutine mysqlnd? + addConfigureOption enable-mysqlnd yes + # enable coroutine curl? + addConfigureOption enable-hook-curl yes + # enable coroutine postgres? + addConfigureOption with-postgres yes + elif test $(compareVersions "$installRemoteModule_version" 22.1.0) -ge 0; then + # enable coroutine sockets? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 protocol? + addConfigureOption enable-http2 yes + # enable coroutine mysqlnd? + addConfigureOption enable-mysqlnd yes + # enable coroutine curl? + addConfigureOption enable-hook-curl yes + # enable coroutine postgres? + addConfigureOption with-postgres yes + elif test $(compareVersions "$installRemoteModule_version" 22.0.0) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 support? + addConfigureOption enable-http2 yes + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable hook curl support? + addConfigureOption enable-hook-curl yes + # enable postgres support? + addConfigureOption with-postgres yes + elif test $(compareVersions "$installRemoteModule_version" 4.8.0) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 support? + addConfigureOption enable-http2 yes + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable json support? + addConfigureOption enable-swoole-json yes + # enable curl support? + addConfigureOption enable-swoole-curl yes + # enable postgres support? + addConfigureOption with-postgres yes + else + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 support? + addConfigureOption enable-http2 yes + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable json support? + addConfigureOption enable-swoole-json yes + # enable curl support? + addConfigureOption enable-swoole-curl yes + fi + ;; parallel) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 701; then installRemoteModule_version=0.8.3 + elif test $PHP_MAJMIN_VERSION -le 704; then + installRemoteModule_version=1.1.4 + fi + fi + ;; + parle) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 704; then + installRemoteModule_version=0.8.3 + else + installRemoteModule_version=beta fi fi + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" + if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 0.8.4) -ge 0; then + # Enable internal UTF-32 support in parle + addConfigureOption enable-parle-utf32 yes + fi ;; pcov) if test -z "$installRemoteModule_version"; then @@ -2023,6 +3609,17 @@ installRemoteModule() { fi fi ;; + php_trie) + if ! test -f /usr/local/include/hat-trie/include/tsl/htrie_map.h; then + installRemoteModule_src="$(getPackageSource https://codeload.github.com/Tessil/hat-trie/tar.gz/v0.6.0)" + mkdir -p /usr/local/include/hat-trie + mv "$installRemoteModule_src/include" /usr/local/include/hat-trie + fi + ;; + pq) + # pq must be loaded after raphf + installRemoteModule_ini_basename="xx-php-ext-$installRemoteModule_module" + ;; propro) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then @@ -2032,8 +3629,12 @@ installRemoteModule() { ;; protobuf) if test -z "$installRemoteModule_version"; then - if test $PHP_MAJMIN_VERSION -le 506; then + if test $PHP_MAJMIN_VERSION -lt 700; then installRemoteModule_version=3.12.4 + elif test $PHP_MAJMIN_VERSION -lt 800; then + installRemoteModule_version=3.24.4 + elif test $PHP_MAJMIN_VERSION -lt 801; then + installRemoteModule_version=3.25.3 fi fi ;; @@ -2052,6 +3653,7 @@ installRemoteModule() { fi ;; rdkafka) + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" if test -z "$installRemoteModule_version"; then installRemoteModule_version1='' if test $PHP_MAJMIN_VERSION -le 505; then @@ -2067,6 +3669,9 @@ installRemoteModule() { debian) installRemoteModule_tmp='librdkafka*' ;; + *) + installRemoteModule_tmp='' + ;; esac if test -n "$installRemoteModule_tmp"; then installRemoteModule_tmp="$(getInstalledPackageVersion "$installRemoteModule_tmp")" @@ -2087,17 +3692,21 @@ installRemoteModule() { if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=4.3.0 + elif test $PHP_MAJMIN_VERSION -le 701; then + installRemoteModule_version=5.3.7 fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" fi # Enable igbinary serializer support? if php --ri igbinary >/dev/null 2>/dev/null; then - addConfigureOption 'enable-redis-igbinary' 'yes' + addConfigureOption enable-redis-igbinary yes else - addConfigureOption 'enable-redis-igbinary' 'no' + addConfigureOption enable-redis-igbinary no fi # Enable lzf compression support? - addConfigureOption 'enable-redis-lzf' 'yes' - if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" '5.0.0') -ge 0; then + addConfigureOption enable-redis-lzf yes + if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 5.0.0) -ge 0; then if ! test -e /usr/include/zstd.h || ! test -e /usr/lib/libzstd.so -o -e "/usr/lib/$TARGET_TRIPLET/libzstd.so"; then installRemoteModule_zstdVersion=1.4.4 installRemoteModule_zstdVersionMajor=$(echo $installRemoteModule_zstdVersion | cut -d. -f1) @@ -2113,47 +3722,186 @@ installRemoteModule() { cd - >/dev/null fi # Enable zstd compression support? - addConfigureOption 'enable-redis-zstd' 'yes' + addConfigureOption enable-redis-zstd yes + if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 6.0.0) -ge 0; then + # Enable msgpack serializer support? + if php --ri msgpack >/dev/null 2>/dev/null; then + addConfigureOption enable-redis-msgpack yes + else + addConfigureOption enable-redis-msgpack no + fi + # Enable lz4 compression? + addConfigureOption enable-redis-lz4 yes + # Use system liblz4? + addConfigureOption with-liblz4 yes + fi fi ;; - snuffleupagus) + relay) + if test -z "$installRemoteModule_version"; then + installRemoteModule_version="$(curl -sSLf https://builds.r2.relay.so/meta/latest)" + installRemoteModule_version="${installRemoteModule_version#v}" + fi + case $(uname -m) in + aarch64 | arm64 | armv8) + installRemoteModule_hardware=aarch64 + ;; + *) + installRemoteModule_hardware=x86-64 + ;; + esac + installRemoteModule_distro="$DISTRO" + installRemoteModule_flags='' + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -lt 317; then + installRemoteModule_distro=alpine3.9 + else + installRemoteModule_distro=alpine3.17 + fi + ;; + debian) + case "$(dpkg -l 'libssl*' | grep -E '^ii ' | cut -d' ' -f3)" in + libssl3*) + installRemoteModule_flags=+libssl3 + ;; + esac + ;; + esac + # See https://relay.so/builds + installRemoteModule_url="https://builds.r2.relay.so/v${installRemoteModule_version}/relay-v${installRemoteModule_version}-php${PHP_MAJDOTMIN_VERSION}-${installRemoteModule_distro}-${installRemoteModule_hardware}${installRemoteModule_flags}.tar.gz" + printf 'Downloading relay v%s (%s) from %s... ' "$installRemoteModule_version" "$installRemoteModule_hardware" "$installRemoteModule_url" + installRemoteModule_src="$(getPackageSource $installRemoteModule_url)" + echo 'done.' + cp -- "$installRemoteModule_src/relay-pkg.so" "$PHP_EXTDIR/relay.so" + sed -i "s/00000000-0000-0000-0000-000000000000/$(cat /proc/sys/kernel/random/uuid)/" "$PHP_EXTDIR/relay.so" + installRemoteModule_ini_extra="$(grep -vE '^[ \t]*extension[ \t]*=' $installRemoteModule_src/relay.ini)" + installRemoteModule_manuallyInstalled=1 + ;; + saxon) if test -z "$installRemoteModule_version"; then - installRemoteModule_version=0.7.1 + if test $PHP_MAJMIN_VERSION -ge 800; then + installRemoteModule_version='12.4.2' + else + installRemoteModule_version='12.3' + fi + fi + installRemoteModule_majorVersion="${installRemoteModule_version%%.*}" + if test "$installRemoteModule_majorVersion" -ge 12; then + case $(uname -m) in + aarch64 | arm64 | armv8) + installRemoteModule_url=https://downloads.saxonica.com/SaxonC/EE/${installRemoteModule_majorVersion}/libsaxon-EEC-linux-aarch64-v${installRemoteModule_version}.zip + ;; + *) + installRemoteModule_url=https://downloads.saxonica.com/SaxonC/EE/${installRemoteModule_majorVersion}/libsaxon-EEC-linux-x86_64-v${installRemoteModule_version}.zip + ;; + esac + else + installRemoteModule_url=https://downloads.saxonica.com/SaxonC/EE/${installRemoteModule_majorVersion}/libsaxon-EEC-setup64-v${installRemoteModule_version}.zip + fi + installRemoteModule_dir="$(getPackageSource $installRemoteModule_url)" + if ! test -f /usr/lib/libsaxon-*.so; then + if test "$installRemoteModule_majorVersion" -ge 12; then + cp $installRemoteModule_dir/libs/nix/*.so /usr/lib/ + else + cp $installRemoteModule_dir/*.so /usr/lib/ + fi + ldconfig || true fi - installRemoteModule_src="$(getPackageSource https://codeload.github.com/jvoisin/snuffleupagus/tar.gz/v$installRemoteModule_version)" - cd "$installRemoteModule_src/src" + cd "$installRemoteModule_dir/Saxon.C.API" phpize - ./configure --enable-snuffleupagus + ./configure --enable-saxon make -j$(getProcessorCount) install cd - >/dev/null - cp -a "$installRemoteModule_src/config/default.rules" "$PHP_INI_DIR/conf.d/snuffleupagus.rules" installRemoteModule_manuallyInstalled=1 ;; - solr) + seasclick) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then - installRemoteModule_version=2.4.0 + installRemoteModule_version=0.1.0 fi fi ;; - spx) - if test -z "$installRemoteModule_version"; then - installRemoteModule_version=1367cbc70194d18888ec9cfe9b06c0a5b4426dff + snappy) + if test -z "$installRemoteModule_path"; then + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=0.2.1 + fi + installRemoteModule_src="$(getPackageSource https://github.com/kjdev/php-ext-snappy/archive/refs/tags/$installRemoteModule_version.tar.gz)" + cd "$installRemoteModule_src" + phpize + ./configure --with-snappy-includedir=/usr + make -j$(getProcessorCount) install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 fi - if test "${installRemoteModule_version%.*}" = "$installRemoteModule_version"; then - installRemoteModule_displayVersion="$installRemoteModule_version" + ;; + snuffleupagus) + if test -z "$installRemoteModule_path"; then + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 704; then + installRemoteModule_version=0.9.0 + else + installRemoteModule_version=0.10.0 + fi + fi + installRemoteModule_src="$(getPackageSource https://codeload.github.com/jvoisin/snuffleupagus/tar.gz/v$installRemoteModule_version)" + cd "$installRemoteModule_src/src" + phpize + ./configure --enable-snuffleupagus + make -j$(getProcessorCount) install + cd - >/dev/null + cp -a "$installRemoteModule_src/config/default.rules" "$PHP_INI_DIR/conf.d/snuffleupagus.rules" + if test $(compareVersions "$installRemoteModule_version" 0.8.0) -ge 0; then + printf '\n# Disable "PHP version is not officially maintained anymore" message\nsp.global.show_old_php_warning.disable();\n' >>"$PHP_INI_DIR/conf.d/snuffleupagus.rules" + fi else - installRemoteModule_displayVersion="git--master-$installRemoteModule_version" + if test -f "$installRemoteModule_path/config/default.rules"; then + cp -a "$installRemoteModule_path/config/default.rules" "$PHP_INI_DIR/conf.d/snuffleupagus.rules" + fi fi - installRemoteModule_src="$(getPackageSource https://codeload.github.com/NoiseByNorthwest/php-spx/tar.gz/$installRemoteModule_version)" - cd -- "$installRemoteModule_src" - sed -Ei "s/^([ \t]*#define[ \t]+PHP_SPX_VERSION[ \t]+\")0.4.10(\")/\1git--master-$installRemoteModule_displayVersion\2/" src/php_spx.h - phpize - ./configure - make -j$(getProcessorCount) install - cd - >/dev/null + installRemoteModule_ini_extra="$(printf '%ssp.configuration_file=%s\n' "$installRemoteModule_ini_extra" "$PHP_INI_DIR/conf.d/snuffleupagus.rules")" + installRemoteModule_manuallyInstalled=1 + ;; + sodium | libsodium) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 700; then + installRemoteModule_version=1.0.7 + fi + fi + ;; + solr) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 700; then + installRemoteModule_version=2.4.0 + elif test $PHP_MAJMIN_VERSION -lt 704; then + installRemoteModule_version=2.6.0 + fi + fi + ;; + sourceguardian) + installSourceGuardian installRemoteModule_manuallyInstalled=1 ;; + spx) + if test -z "$installRemoteModule_path"; then + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=v0.4.16 + fi + if test "${installRemoteModule_version%.*}" = "$installRemoteModule_version"; then + installRemoteModule_displayVersion="$installRemoteModule_version" + else + installRemoteModule_displayVersion="git--master-$installRemoteModule_version" + fi + installRemoteModule_src="$(getPackageSource https://codeload.github.com/NoiseByNorthwest/php-spx/tar.gz/$installRemoteModule_version)" + cd -- "$installRemoteModule_src" + phpize + ./configure + make -j$(getProcessorCount) install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 + fi + ;; sqlsrv | pdo_sqlsrv) isMicrosoftSqlServerODBCInstalled || installMicrosoftSqlServerODBC if test -z "$installRemoteModule_version"; then @@ -2166,20 +3914,12 @@ installRemoteModule() { installRemoteModule_version=5.6.1 elif test $PHP_MAJMIN_VERSION -le 702; then installRemoteModule_version=5.8.1 - elif test $PHP_MAJMIN_VERSION -ge 801; then - # https://github.com/microsoft/msphpsql/commits/PHP-8.1-dev - installRemoteModule_src="$(getPackageSource https://codeload.github.com/microsoft/msphpsql/tar.gz/f00dc9f0c555eebaf9f1e5a9bd1a04044908bba1)" - cd -- "$installRemoteModule_src/source/$installRemoteModule_module" - if command -v bash >/dev/null; then - (cd .. && bash ./packagize.sh) - else - (cd .. && sh ./packagize.sh) - fi - phpize - ./configure - make -j$(getProcessorCount) install - cd - >/dev/null - installRemoteModule_manuallyInstalled=1 + elif test $PHP_MAJMIN_VERSION -le 703; then + installRemoteModule_version=5.9.0 + elif test $PHP_MAJMIN_VERSION -le 704; then + installRemoteModule_version=5.10.1 + elif test $PHP_MAJMIN_VERSION -le 800; then + installRemoteModule_version=5.11.1 fi fi ;; @@ -2187,8 +3927,6 @@ installRemoteModule() { if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=0.13 - else - installRemoteModule_version=beta fi fi ;; @@ -2216,7 +3954,29 @@ installRemoteModule() { installRemoteModule_version=4.3.6 elif test $PHP_MAJMIN_VERSION -le 701; then installRemoteModule_version=4.5.10 + elif test $PHP_MAJMIN_VERSION -le 704; then + installRemoteModule_version=4.8.11 + elif test $PHP_BITS -eq 32; then + # See https://github.com/swoole/swoole-src/issues/5198#issuecomment-1820162178 + installRemoteModule_version="$(resolvePHPModuleVersion "$installRemoteModule_module" '^5.0')" + else + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -le 312; then + installRemoteModule_version=5.1.2 + fi + ;; + esac fi + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 800; then + installRemoteModule_version=5.1.3 + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" stable)" + fi + fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" fi if php --ri sockets >/dev/null 2>/dev/null; then installRemoteModule_sockets=yes @@ -2226,13 +3986,109 @@ installRemoteModule() { installRemoteModule_openssl=yes case "$DISTRO_VERSION" in alpine@3.7 | alpine@3.8) - if test -n "$installRemoteModule_version" && test $(compareVersions "$installRemoteModule_version" 4.6.0) -lt 0; then + if test $(compareVersions "$installRemoteModule_version" 4.6.0) -lt 0; then # see https://github.com/swoole/swoole-src/issues/3934 installRemoteModule_openssl=no fi ;; esac - if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 4.6.1) -ge 0; then + if test $PHP_MAJMIN_VERSION -ge 800; then + # see https://github.com/swoole/swoole-src/issues/5365 + installRemoteModule_curl=no + else + installRemoteModule_curl=yes + fi + if test $PHP_THREADSAFE -eq 1; then + installRemoteModule_zts=yes + else + installRemoteModule_zts=no + fi + installRemoteModule_sqlite=yes + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -lt 317; then + # we need sqlite3 >= 3.7.7 + installRemoteModule_sqlite=no + fi + ;; + debian) + if test $DISTRO_MAJMIN_VERSION -lt 1200; then + # we need sqlite3 >= 3.7.7 + installRemoteModule_sqlite=no + fi + ;; + esac + if test $(compareVersions "$installRemoteModule_version" 6.0.0) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable curl support? + addConfigureOption enable-swoole-curl $installRemoteModule_curl + # enable cares support? + addConfigureOption enable-cares yes + # enable brotli support? + addConfigureOption enable-brotli yes + # enable PostgreSQL database support? + addConfigureOption enable-swoole-pgsql yes + # enable ODBC database support? + addConfigureOption with-swoole-odbc no + # enable Oracle database support? + addConfigureOption with-swoole-oracle no + # enable Sqlite database support? + addConfigureOption enable-swoole-sqlite $installRemoteModule_sqlite + # enable swoole thread support (need php zts support)? + addConfigureOption enable-swoole-thread $installRemoteModule_zts + # enable iouring for file async support? + addConfigureOption enable-iouring yes + elif test $(compareVersions "$installRemoteModule_version" 5.1.0) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable curl support? + addConfigureOption enable-swoole-curl $installRemoteModule_curl + # enable cares support? + addConfigureOption enable-cares yes + # enable brotli support? + addConfigureOption enable-brotli yes + # enable PostgreSQL database support? + addConfigureOption enable-swoole-pgsql yes + # enable ODBC database support? + addConfigureOption with-swoole-odbc no + # enable Oracle database support? + addConfigureOption with-swoole-oracle no + # enable Sqlite database support? + addConfigureOption enable-swoole-sqlite $installRemoteModule_sqlite + elif test $(compareVersions "$installRemoteModule_version" 5.0.1) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable curl support? + addConfigureOption enable-swoole-curl $installRemoteModule_curl + # enable cares support? + addConfigureOption enable-cares yes + # enable brotli support? + addConfigureOption enable-brotli yes + elif test $(compareVersions "$installRemoteModule_version" 5.0.0) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable curl support? + addConfigureOption enable-swoole-curl $installRemoteModule_curl + # enable cares support? + addConfigureOption enable-cares yes + elif test $(compareVersions "$installRemoteModule_version" 4.8.11) -ge 0; then # enable sockets supports? addConfigureOption enable-sockets $installRemoteModule_sockets # enable openssl support? @@ -2244,12 +4100,22 @@ installRemoteModule() { # enable json support? addConfigureOption enable-swoole-json yes # enable curl support? - if test $PHP_MAJMINPAT_VERSION -ne 80000; then - addConfigureOption enable-swoole-curl yes - else - # https://github.com/swoole/swoole-src/issues/3977#issuecomment-754755521 - addConfigureOption enable-swoole-curl no - fi + addConfigureOption enable-swoole-curl $installRemoteModule_curl + # enable cares support? + addConfigureOption enable-cares yes + elif test $(compareVersions "$installRemoteModule_version" 4.6.1) -ge 0; then + # enable sockets supports? + addConfigureOption enable-sockets $installRemoteModule_sockets + # enable openssl support? + addConfigureOption enable-openssl $installRemoteModule_openssl + # enable http2 support? + addConfigureOption enable-http2 yes + # enable mysqlnd support? + addConfigureOption enable-mysqlnd yes + # enable json support? + addConfigureOption enable-swoole-json yes + # enable curl support? + addConfigureOption enable-swoole-curl $installRemoteModule_curl elif test $(compareVersions "$installRemoteModule_version" 4.4.0) -ge 0; then # enable sockets supports? addConfigureOption enable-sockets $installRemoteModule_sockets @@ -2354,16 +4220,18 @@ installRemoteModule() { make install cd - >/dev/null fi - installRemoteModule_tmp="$(mktemp -p /tmp/src -d)" - git clone --depth=1 --recurse-submodules https://github.com/yaroslavche/phptdlib.git "$installRemoteModule_tmp" - mkdir "$installRemoteModule_tmp/build" - cd "$installRemoteModule_tmp/build" - cmake -D USE_SHARED_PHPCPP:BOOL=ON .. - make - make install - cd - >/dev/null - rm "$PHP_INI_DIR/conf.d/tdlib.ini" - installRemoteModule_manuallyInstalled=1 + if test -z "$installRemoteModule_path"; then + installRemoteModule_tmp="$(mktemp -p /tmp/src -d)" + git clone --depth=1 --recurse-submodules https://github.com/yaroslavche/phptdlib.git "$installRemoteModule_tmp" + mkdir "$installRemoteModule_tmp/build" + cd "$installRemoteModule_tmp/build" + cmake -D USE_SHARED_PHPCPP:BOOL=ON .. + make + make install + cd - >/dev/null + rm "$PHP_INI_DIR/conf.d/tdlib.ini" + installRemoteModule_manuallyInstalled=1 + fi ;; tensor) if test -z "$installRemoteModule_version"; then @@ -2371,6 +4239,66 @@ installRemoteModule() { installRemoteModule_version=2.2.3 fi fi + case "$DISTRO" in + alpine) + if test $DISTRO_MAJMIN_VERSION -ge 315 && test $DISTRO_MAJMIN_VERSION -le 317; then + if test -e /usr/lib/liblapacke.so.3 && ! test -e /usr/lib/liblapacke.so; then + ln -s /usr/lib/liblapacke.so.3 /usr/lib/liblapacke.so + fi + fi + ;; + esac + ;; + tideways) + case "$DISTRO" in + alpine) + case $(uname -m) in + aarch64 | arm64 | armv8) + installRemoteModule_architecture=alpine-arm64 + ;; + *) + installRemoteModule_architecture=alpine-x86_64 + ;; + esac + ;; + debian) + case $(uname -m) in + aarch64 | arm64 | armv8) + installRemoteModule_architecture=arm64 + ;; + *) + installRemoteModule_architecture=x86_64 + ;; + esac + ;; + esac + installRemoteModule_url="$(curl -sSLf -o - https://tideways.com/profiler/downloads | grep -Eo "\"[^\"]+/tideways-php-([0-9]+\.[0-9]+\.[0-9]+)-$installRemoteModule_architecture.tar.gz\"" | cut -d'"' -f2)" + if test -z "$installRemoteModule_url"; then + echo 'Failed to find the tideways tarball to be downloaded' + exit 1 + fi + printf 'Downloading tideways from %s\n' "$installRemoteModule_url" + installRemoteModule_src="$(getPackageSource $installRemoteModule_url)" + if test -d "$installRemoteModule_src/dist"; then + installRemoteModule_src="$installRemoteModule_src/dist" + fi + installRemoteModule_src="$installRemoteModule_src/tideways-php" + case "$DISTRO" in + alpine) + installRemoteModule_src="$installRemoteModule_src-alpine" + ;; + esac + installRemoteModule_src="$installRemoteModule_src-$PHP_MAJDOTMIN_VERSION" + if test $PHP_THREADSAFE -eq 1; then + installRemoteModule_src="$installRemoteModule_src-zts" + fi + installRemoteModule_src="$installRemoteModule_src.so" + if ! test -f "$installRemoteModule_src"; then + echo 'tideways does not support the current environment' >&2 + exit 1 + fi + mv "$installRemoteModule_src" $(getPHPExtensionsDir)/tideways.so + installRemoteModule_manuallyInstalled=1 ;; uopz) if test -z "$installRemoteModule_version"; then @@ -2383,6 +4311,13 @@ installRemoteModule() { fi fi ;; + uploadprogress) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 701; then + installRemoteModule_version=1.1.4 + fi + fi + ;; uuid) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then @@ -2390,6 +4325,51 @@ installRemoteModule() { fi fi ;; + uv) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 800; then + installRemoteModule_version=0.2.4 + else + installRemoteModule_version=beta + fi + fi + ;; + vld) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -lt 700; then + installRemoteModule_version=0.14.0 + else + installRemoteModule_version=beta + fi + fi + ;; + wikidiff2) + case "$DISTRO" in + alpine) + if ! isLibDatrieInstalled; then + installLibDatrie + fi + if ! isLibThaiInstalled; then + installLibThai + fi + ;; + esac + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 702; then + installRemoteModule_version=1.13.0 + else + installRemoteModule_version="$(git -c versionsort.suffix=- ls-remote --tags --refs --quiet --exit-code --sort=version:refname https://github.com/wikimedia/mediawiki-php-wikidiff2.git 'refs/tags/*.*.*' | tail -1 | cut -d/ -f3)" + fi + fi + installRemoteModule_src="$(getPackageSource "https://codeload.github.com/wikimedia/mediawiki-php-wikidiff2/tar.gz/refs/tags/$installRemoteModule_version")" + cd -- "$installRemoteModule_src" + phpize + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 + ;; xdebug) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 500; then @@ -2404,8 +4384,25 @@ installRemoteModule() { installRemoteModule_version=2.6.1 elif test $PHP_MAJMIN_VERSION -le 701; then installRemoteModule_version=2.9.8 + elif test $PHP_MAJMIN_VERSION -le 704; then + installRemoteModule_version=3.1.6 + fi + fi + ;; + xdiff) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 506; then + installRemoteModule_version=1.5.2 fi fi + if ! test -f /usr/local/lib/libxdiff.* && ! test -f /usr/lib/libxdiff.* && ! test -f /usr/lib/x86_64*/libxdiff.*; then + installRemoteModule_src="$(getPackageSource https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/assets/resources/libxdiff-0.23.tar.gz)" + cd -- "$installRemoteModule_src" + ./configure --disable-shared --disable-dependency-tracking --with-pic + make -j$(getProcessorCount) + make install + cd - >/dev/null + fi ;; xhprof) if test -z "$installRemoteModule_version"; then @@ -2415,16 +4412,24 @@ installRemoteModule() { fi ;; xlswriter) + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 1.2.7) -ge 0; then # enable reader supports? addConfigureOption enable-reader yes fi ;; + xmlrpc) + if test -z "$installRemoteModule_version"; then + installRemoteModule_version=beta + fi + ;; yac) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=0.9.2 fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" fi if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 2.2.0) -ge 0; then # Enable igbinary serializer support @@ -2461,6 +4466,8 @@ installRemoteModule() { if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=1.2.5 fi + else + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" fi if test -z "$installRemoteModule_version" || test $(compareVersions "$installRemoteModule_version" 1.2.4) -ge 0; then # Enable Msgpack Supports @@ -2471,14 +4478,27 @@ installRemoteModule() { fi fi ;; + zmq) + if test -z "$installRemoteModule_version"; then + installRemoteModule_src="$(getPackageSource https://github.com/zeromq/php-zmq/tarball/master)" + cd "$installRemoteModule_src" + phpize + ./configure + make -j$(getProcessorCount) + make install + cd - >/dev/null + installRemoteModule_manuallyInstalled=1 + fi + ;; zookeeper) if test -z "$installRemoteModule_version"; then if test $PHP_MAJMIN_VERSION -le 506; then installRemoteModule_version=0.5.0 else - installRemoteModule_version=1.0.0 + installRemoteModule_version=alpha fi fi + installRemoteModule_version="$(resolvePeclStabilityVersion "$installRemoteModule_module" "$installRemoteModule_version")" case "$DISTRO" in alpine) if ! test -f /usr/local/include/zookeeper/zookeeper.h; then @@ -2513,69 +4533,72 @@ installRemoteModule() { ;; esac ;; + zstd) + if test -z "$installRemoteModule_version"; then + if test $PHP_MAJMIN_VERSION -le 506; then + installRemoteModule_version=0.11.0 + fi + fi + ;; esac if test $installRemoteModule_manuallyInstalled -eq 0; then - if test -n "$installRemoteModule_version"; then + if test -n "$installRemoteModule_path"; then + printf ' (installing version %s from %s)\n' "$installRemoteModule_version" "$installRemoteModule_path" + elif test -n "$installRemoteModule_version"; then printf ' (installing version %s)\n' "$installRemoteModule_version" fi - installPeclPackage "$installRemoteModule_module" "$installRemoteModule_version" "$installRemoteModule_cppflags" + installPeclPackage "$installRemoteModule_module" "$installRemoteModule_version" "$installRemoteModule_cppflags" "$installRemoteModule_path" fi - case "$installRemoteModule_module" in - apcu_bc) - # apcu_bc must be loaded after apcu - docker-php-ext-enable --ini-name "xx-php-ext-$installRemoteModule_module.ini" apc - ;; - blackfire) - printf "extension=blackfire.so\nblackfire.agent_socket=tcp://blackfire:8307\n" >"$PHP_INI_DIR/conf.d/docker-php-ext-$installRemoteModule_module.ini" - ;; - 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 - printf 'zend_extension=%s/%s.so\n' "$(getPHPExtensionsDir)" "$installRemoteModule_module" >"$PHP_INI_DIR/conf.d/docker-php-ext-$installRemoteModule_module.ini" - else - docker-php-ext-enable "$installRemoteModule_module" - fi - ;; - 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) - docker-php-ext-enable "$installRemoteModule_module" - printf 'sp.configuration_file=%s\n' "$PHP_INI_DIR/conf.d/snuffleupagus.rules" >>"$PHP_INI_DIR/conf.d/docker-php-ext-snuffleupagus.ini" + postProcessModule "$installRemoteModule_module" + if test $installRemoteModule_manuallyInstalled -lt 2; then + case "${IPE_SKIP_CHECK:-}" in + 1 | y* | Y*) ;; + *) + checkModuleWorking "$installRemoteModule_module" "$installRemoteModule_ini_basename" "$installRemoteModule_ini_extra" + ;; + esac + enablePhpExtension "$installRemoteModule_module" "$installRemoteModule_ini_basename" "$installRemoteModule_ini_extra" + fi +} + +# Check if a module/helper may be installed using the pecl archive +# +# Arguments: +# $1: the name of the module +# +# Return: +# 0: true +# 1: false +moduleMayUsePecl() { + case "$1" in + @composer | @fix_letsencrypt) + return 1 ;; - *) - docker-php-ext-enable "$installRemoteModule_module" + blackfire | geos | ioncube_loader | snuffleupagus | sourceguardian | spx | tdlib | tideways) + return 1 ;; esac + if test -n "$(getModuleSourceCodePath "$1")"; then + return 1 + fi + if stringInList "$1" "$BUNDLED_MODULES"; then + return 1 + fi + return 0 } -# Configure the PECL package installed +# Configure the PECL package installer # # Updates: # PHP_MODULES_TO_INSTALL # Sets: -# USE_PICKLE +# USE_PICKLE 0: no, 1: yes (already downloaded), 2: yes (build it from source) configureInstaller() { USE_PICKLE=0 - for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do - if test "${PHP_MODULE_TO_INSTALL#@}" != "$PHP_MODULE_TO_INSTALL"; then - continue - fi - if test "$PHP_MODULE_TO_INSTALL" = 'spx'; then - continue - fi - if test "$PHP_MODULE_TO_INSTALL" = 'amqp' && test $PHP_MAJMIN_VERSION -ge 800; then - continue - fi - if ! stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then - if test $PHP_MAJMIN_VERSION -lt 800; then - pecl channel-update pecl.php.net || true - return + if ! which pecl >/dev/null; then + for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do + if ! moduleMayUsePecl "$PHP_MODULE_TO_INSTALL"; then + continue fi if false && anyStringInList '' "$PHP_MODULES_TO_INSTALL"; then USE_PICKLE=2 @@ -2584,9 +4607,19 @@ configureInstaller() { chmod +x /tmp/pickle USE_PICKLE=1 fi - return + break + done + fi + if test $USE_PICKLE -eq 0; then + if test -z "$(pear config-get http_proxy)"; then + if test -n "${http_proxy:-}"; then + pear config-set http_proxy "$http_proxy" || true + elif test -n "${HTTP_PROXY:-}"; then + pear config-set http_proxy "$HTTP_PROXY" || true + fi fi - done + pecl channel-update pecl.php.net || true + fi } buildPickle() { @@ -2628,7 +4661,8 @@ addConfigureOption() { # Arguments: # $1: the package to be installed # $2: the package version to be installed (optional) -# $3: the value of the CPPFLAGS variable +# $3: the value of the CPPFLAGS variable (optional) +# $4: the path of the local package to be installed (optional, downloaded from PECL if omitted/empty) installPeclPackage() { if ! test -f "$CONFIGURE_FILE"; then printf '\n' >"$CONFIGURE_FILE" @@ -2639,10 +4673,21 @@ installPeclPackage() { else installPeclPackage_fullname="$installPeclPackage_name-$2" fi + installPeclPackage_path="${4:-}" + if test -z "$installPeclPackage_path"; then + installPeclPackage_path="$installPeclPackage_fullname" + fi if test $USE_PICKLE -eq 0; then - cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" pecl install "$installPeclPackage_fullname" + if test -n "${4:-}"; then + if test -f "$installPeclPackage_path/package2.xml"; then + installPeclPackage_path="$installPeclPackage_path/package2.xml" + else + installPeclPackage_path="$installPeclPackage_path/package.xml" + fi + fi + cat "$CONFIGURE_FILE" | MAKE="make -j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" pecl install "$installPeclPackage_path" else - 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" + MAKEFLAGS="-j$(getCompilationProcessorCount $1)" CPPFLAGS="${3:-}" /tmp/pickle install --tmp-dir=/tmp/pickle.tmp --no-interaction --version-override='' --with-configure-options "$CONFIGURE_FILE" -- "$installPeclPackage_path" fi } @@ -2704,8 +4749,105 @@ removeStringFromList() { printf '%s' "$removeStringFromList_result" } +# Invoke apt-get update +# +# Set: +# IPE_APTGET_INSTALLOPTIONS +invokeAptGetUpdate() { + if test -n "${IPE_APTGETUPDATE_ALREADY:-}"; then + DEBIAN_FRONTEND=noninteractive apt-get update -q + return + fi + IPE_APTGET_INSTALLOPTIONS='' + invokeAptGetUpdate_fixdistro='' + if grep -q 'VERSION="8 (jessie)"' /etc/os-release; then + invokeAptGetUpdate_fixdistro=jessie + elif grep -q 'VERSION="9 (stretch)"' /etc/os-release; then + invokeAptGetUpdate_fixdistro=stretch + else + IPE_APTGETUPDATE_ALREADY=y + DEBIAN_FRONTEND=noninteractive apt-get update -q + return + fi + # See https://www.debian.org/distrib/archive.en.html for a list of mirrors + if test -z "${IPE_DEB_ARCHIVE:-}"; then + IPE_DEB_ARCHIVE=http://archive.kernel.org/debian-archive + fi + if test -z "${IPE_DEB_ARCHIVE_SECURITY:-}"; then + IPE_DEB_ARCHIVE_SECURITY=http://archive.kernel.org/debian-archive/debian-security + fi + sed -ri "s;^(\s*deb\s+http://(httpredir|deb).debian.org/debian\s+$invokeAptGetUpdate_fixdistro-updates\b.*);#\1;" /etc/apt/sources.list + sed -ri "s;^(\s*deb\s+)http://(httpredir|deb).debian.org;\1$IPE_DEB_ARCHIVE;" /etc/apt/sources.list + sed -ri "s;^(\s*deb\s+)http://security.debian.org/debian-security;\1$IPE_DEB_ARCHIVE_SECURITY;" /etc/apt/sources.list + sed -ri "s;^(\s*deb\s+)http://security.debian.org;\1$IPE_DEB_ARCHIVE_SECURITY;" /etc/apt/sources.list + invokeAptGetUpdate_tmp="$(mktemp)" + DEBIAN_FRONTEND=noninteractive apt-get update -q 2>"$invokeAptGetUpdate_tmp" + if test -s "$invokeAptGetUpdate_tmp"; then + cat "$invokeAptGetUpdate_tmp" >&2 + if grep -qE ' KEYEXPIRED [0-9]' "$invokeAptGetUpdate_tmp"; then + IPE_APTGET_INSTALLOPTIONS='-o APT::Get::AllowUnauthenticated=true' + echo '############' >&2 + echo '# WARNING! #' >&2 + echo '############' >&2 + echo 'apt packages will be installed without checking authenticity!' >&2 + fi + fi + rm "$invokeAptGetUpdate_tmp" + IPE_APTGETUPDATE_ALREADY=y +} + +# Fix the Let's Encrypt CA certificates on old distros +fixLetsEncrypt() { + printf '### FIXING LETS ENCRYPT CA CERTIFICATES ###\n' + case "$DISTRO_VERSION" in + alpine@3.7 | alpine@3.8) + printf -- '- old Alpine Linux detected: we should fix the certificates\n' + ;; + debian@8 | debian@9) + printf -- '- old Debian detected: we should fix the certificates\n' + if ! grep -q 'mozilla/ISRG_Root_X1.crt' /etc/ca-certificates.conf && grep -q 'mozilla/DST_Root_CA_X3.crt' /etc/ca-certificates.conf; then + printf -- '- old ca-certificates package detected\n' + fixCACerts_mustUpdate=1 + if test -d /var/lib/apt/lists; then + for fixCACerts_item in $(ls -1 /var/lib/apt/lists); do + case "$fixCACerts_item" in + partial | lock) ;; + *) + fixCACerts_mustUpdate=0 + break + ;; + esac + done + fi + if test $fixCACerts_mustUpdate -eq 1; then + printf -- '- refreshing the APT package list\n' + invokeAptGetUpdate + fi + printf -- '- installing newer ca-certificates package\n' + DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends ${IPE_APTGET_INSTALLOPTIONS:-} ca-certificates + fi + ;; + *) + printf -- '- patch not required in this distro version\n' + return + ;; + esac + if grep -Eq '^mozilla/ISRG_Root_X1\.crt$' /etc/ca-certificates.conf && grep -Eq '^mozilla/DST_Root_CA_X3\.crt$' /etc/ca-certificates.conf; then + printf -- '- disabling the DST_Root_CA_X3 certificate\n' + sed -i '/^mozilla\/DST_Root_CA_X3/s/^/!/' /etc/ca-certificates.conf + printf -- '- refreshing the certificates\n' + update-ca-certificates -f + else + printf -- '- DST_Root_CA_X3 certificate not found or already disabled\n' + fi +} + # Cleanup everything at the end of the execution cleanup() { + if test "${IPE_UNINSTALL_CARGO:-}" = y; then + . "$HOME/.cargo/env" + rustup self uninstall -y + fi if test -n "$UNNEEDED_PACKAGE_LINKS"; then printf '### REMOVING UNNEEDED PACKAGE LINKS ###\n' for cleanup_link in $UNNEEDED_PACKAGE_LINKS; do @@ -2714,25 +4856,27 @@ cleanup() { fi done fi - if test -n "$PACKAGES_VOLATILE"; then - printf '### REMOVING UNNEEDED PACKAGES ###\n' - case "$DISTRO" in - alpine) + case "$DISTRO" in + alpine) + if stringInList icu-libs "${PACKAGES_PERSISTENT_NEW:-}" && stringInList icu-data-en "${PACKAGES_PERSISTENT_NEW:-}"; then + apk del icu-data-en >/dev/null 2>&1 || true + fi + if test -n "$PACKAGES_VOLATILE"; then + printf '### REMOVING UNNEEDED PACKAGES ###\n' apk del --purge $PACKAGES_VOLATILE - ;; - debian) + fi + ;; + debian) + if test -n "$PACKAGES_VOLATILE"; then + printf '### REMOVING UNNEEDED PACKAGES ###\n' DEBIAN_FRONTEND=noninteractive apt-get remove --purge -y $PACKAGES_VOLATILE - ;; - esac - fi - if test -n "$PACKAGES_PREVIOUS"; then - case "$DISTRO" in - debian) + fi + if test -n "$PACKAGES_PREVIOUS"; then printf '### RESTORING PREVIOUSLY INSTALLED PACKAGES ###\n' - DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --no-upgrade -qqy $PACKAGES_PREVIOUS - ;; - esac - fi + DEBIAN_FRONTEND=noninteractive apt-get install -qqy --no-install-recommends --no-upgrade $IPE_APTGET_INSTALLOPTIONS $PACKAGES_PREVIOUS + fi + ;; + esac docker-php-source delete rm -rf /tmp/src rm -rf /tmp/pickle @@ -2769,7 +4913,7 @@ esac setPHPVersionVariables setPHPPreinstalledModules case "$PHP_MAJMIN_VERSION" in - 505 | 506 | 700 | 701 | 702 | 703 | 704 | 800 | 801) ;; + 505 | 506 | 700 | 701 | 702 | 703 | 704 | 800 | 801 | 802 | 803 | 804) ;; *) printf "### ERROR: Unsupported PHP version: %s.%s ###\n" $((PHP_MAJMIN_VERSION / 100)) $((PHP_MAJMIN_VERSION % 100)) ;; @@ -2781,6 +4925,11 @@ if test -z "$PHP_MODULES_TO_INSTALL"; then exit 0 fi +if stringInList @fix_letsencrypt "$PHP_MODULES_TO_INSTALL"; then + # This must be the very first thing we do + fixLetsEncrypt +fi + sortModulesToInstall docker-php-source extract @@ -2800,13 +4949,24 @@ fi if test $USE_PICKLE -gt 1; then buildPickle fi + +compileLibs + for PHP_MODULE_TO_INSTALL in $PHP_MODULES_TO_INSTALL; do - if test "$PHP_MODULE_TO_INSTALL" = '@composer'; then - installComposer - elif stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then - installBundledModule "$PHP_MODULE_TO_INSTALL" - else - installRemoteModule "$PHP_MODULE_TO_INSTALL" - fi + case "$PHP_MODULE_TO_INSTALL" in + @fix_letsencrypt) + # Already done: it must be the first thing we do + ;; + @composer) + installComposer + ;; + *) + if stringInList "$PHP_MODULE_TO_INSTALL" "$BUNDLED_MODULES"; then + installBundledModule "$PHP_MODULE_TO_INSTALL" + else + installRemoteModule "$PHP_MODULE_TO_INSTALL" + fi + ;; + esac done cleanup diff --git a/services/php8/extensions/install.sh b/services/php8/extensions/install.sh index f180100..ba88d3d 100644 --- a/services/php8/extensions/install.sh +++ b/services/php8/extensions/install.sh @@ -521,6 +521,12 @@ if [[ -z "${EXTENSIONS##*,redis,*}" ]]; then installExtensionFromTgz redis-5.3.5 fi +if [[ -z "${EXTENSIONS##*,phpy,*}" ]]; then + echo "---------- Install phpy Start----------" + pecl install phpy --yes + docker-php-ext-enable phpy +fi + if [[ -z "${EXTENSIONS##*,apcu,*}" ]]; then echo "---------- Install apcu ----------" pecl install apcu