From a73248ed6fc96f141a06f2854315a53db4bddd98 Mon Sep 17 00:00:00 2001 From: Michele Locati Date: Tue, 5 Apr 2022 14:37:14 +0200 Subject: [PATCH] Add support for sodium on PHP 5.6, 7.0 and 7.1 (#562) --- data/special-requirements | 1 + data/supported-extensions | 1 + install-php-extensions | 28 +++++++++++++++++++++++++++ scripts/check-installed-extension.php | 5 +++++ 4 files changed, 35 insertions(+) diff --git a/data/special-requirements b/data/special-requirements index 64f3ad0..784c314 100644 --- a/data/special-requirements +++ b/data/special-requirements @@ -3,6 +3,7 @@ memprof !alpine parallel zts pdo_sqlsrv !alpine3.7 !alpine3.8 pthreads zts +sodium !jessie sqlsrv !alpine3.7 !alpine3.8 !7.1-alpine3.9 !7.1-alpine3.10 tensor !alpine3.15 vips !alpine3.7 !alpine3.8 !alpine3.9 !jessie diff --git a/data/supported-extensions b/data/supported-extensions index dfe6ac0..542c637 100644 --- a/data/supported-extensions +++ b/data/supported-extensions @@ -85,6 +85,7 @@ snmp 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 snuffleupagus 7.0 7.1 7.2 7.3 7.4 8.0 8.1 soap 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 sockets 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 +sodium 5.6 7.0 7.1 solr 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 sourceguardian 5.5 5.6 7.0 7.1 7.2 7.3 7.4 8.0 spx 5.6 7.0 7.1 7.2 7.3 7.4 8.0 8.1 diff --git a/install-php-extensions b/install-php-extensions index 87b28be..0e6b4c3 100755 --- a/install-php-extensions +++ b/install-php-extensions @@ -139,6 +139,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 ;; @@ -159,6 +169,9 @@ getPeclModuleName() { http) normalizePHPModuleName_name=pecl_http ;; + sodium) + normalizePHPModuleName_name=libsodium + ;; esac printf '%s' "$normalizePHPModuleName_name" } @@ -1081,6 +1094,14 @@ buildRequiredPackageLists() { soap@debian) buildRequiredPackageLists_volatile="$buildRequiredPackageLists_volatile libxml2-dev" ;; + 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" ;; @@ -2893,6 +2914,13 @@ installRemoteModule() { 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 -le 506; then diff --git a/scripts/check-installed-extension.php b/scripts/check-installed-extension.php index 7c8c73d..d0604d7 100644 --- a/scripts/check-installed-extension.php +++ b/scripts/check-installed-extension.php @@ -7,6 +7,11 @@ $nameMap = [ 'apcu_bc' => 'apc', 'ioncube_loader' => 'ionCube Loader', ]; +if (PHP_VERSION_ID < 70000) { + $nameMap['sodium'] = 'libsodium'; +} else { + $nameMap['libsodium'] = 'sodium'; +} $testsDir = __DIR__ . '/tests'; function runTest($testFile) {