diff options
| -rw-r--r-- | 79.patch | 72 | ||||
| -rw-r--r-- | REFLECTION | 2 | ||||
| -rw-r--r-- | php-pecl-scrypt.spec | 127 |
3 files changed, 127 insertions, 74 deletions
diff --git a/79.patch b/79.patch new file mode 100644 index 0000000..4f5bb8f --- /dev/null +++ b/79.patch @@ -0,0 +1,72 @@ +From 31cd3a52fd658b857364f4afd0ca0f6ea2bfffcd Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@remirepo.net> +Date: Tue, 21 Jul 2026 11:21:04 +0200 +Subject: [PATCH] Fix build with PHP 8.6.0alpha2 + + . The zend_parse_parameters_none_throw(), zend_parse_parameters_throw(), + and ZEND_PARSE_PARAMS_THROW have been removed due to being misleading, + since ZPP always throws, unless ZEND_PARSE_PARAMS_QUIET is given. Use + the non-throw versions. + + . Added zend_bin2hex() and zend_bin2hex_str() as helper functions to remove + dependencies on /ext/hash in various extensions. + +And remove dependency on hash extension +--- + php_scrypt.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/php_scrypt.c b/php_scrypt.c +index 86c804d..f058f85 100644 +--- a/php_scrypt.c ++++ b/php_scrypt.c +@@ -36,7 +36,9 @@ + #include "zend_config.w32.h" + #endif + ++#if PHP_VERSION_ID < 80600 + #include "ext/hash/php_hash.h" ++#endif + #include "php_scrypt_utils.h" + #include "php_scrypt.h" + #include "crypto/crypto_scrypt.h" +@@ -56,7 +58,9 @@ + typedef size_t strsize_t; + + static const zend_module_dep scrypt_deps[] = { ++#if PHP_VERSION_ID < 80600 + ZEND_MOD_REQUIRED("hash") ++#endif + ZEND_MOD_END + }; + +@@ -134,7 +138,7 @@ PHP_FUNCTION(scrypt) + + /* Get the parameters for this call */ + raw_output = 0; +- if (zend_parse_parameters_throw( ++ if (zend_parse_parameters( + ZEND_NUM_ARGS(), "ssllll|b", + &password, &password_len, &salt, &salt_len, + &phpN, &phpR, &phpP, &keyLength, &raw_output +@@ -204,7 +208,11 @@ PHP_FUNCTION(scrypt) + if (!raw_output) { + /* Encode the output in hex */ + hex = (char*) safe_emalloc(2, keyLength, 1); ++#if PHP_VERSION_ID < 80600 + php_hash_bin2hex(hex, buf, keyLength); ++#else ++ zend_bin2hex(hex, buf, keyLength); ++#endif + efree(buf); + hex[keyLength*2] = '\0'; + RETVAL_STRINGL(hex, keyLength * 2); +@@ -238,7 +246,7 @@ PHP_FUNCTION(scrypt_pickparams) + int rc; + + /* Get the parameters for this call */ +- if (zend_parse_parameters_throw( ++ if (zend_parse_parameters( + ZEND_NUM_ARGS(), "ldd", + &maxmem, &memfrac, &maxtime + ) == FAILURE) @@ -1,4 +1,4 @@ -Extension [ <persistent> extension #122 scrypt version 2.0.1 ] { +Extension [ <persistent> extension #121 scrypt version 2.0.1 ] { - Dependencies { Dependency [ hash (Required) ] diff --git a/php-pecl-scrypt.spec b/php-pecl-scrypt.spec index adbb3f2..bd02580 100644 --- a/php-pecl-scrypt.spec +++ b/php-pecl-scrypt.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-pecl-scrypt # -# Copyright (c) 2013-2023 Remi Collet -# License: CC-BY-SA-4.0 -# http://creativecommons.org/licenses/by-sa/4.0/ +# SPDX-FileCopyrightText: Copyright 2013-2026 Remi Collet +# SPDX-License-Identifier: CECILL-2.1 +# http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt # # Please, preserve the changelog entries # @@ -13,31 +13,44 @@ %global pecl_name scrypt %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini -%global sources %{pecl_name}-%{version} -%global _configure ../%{sources}/configure +%global _configure ../configure +%global pie_vend woohoolabs +%global pie_proj php-scrypt +%global gh_vend DomBlack +%global gh_proj php-scrypt +%global forgeurl https://github.com/%{gh_vend}/%{gh_proj} +%global tag %{version} -Summary: Scrypt hashing function Name: %{?scl_prefix}php-pecl-%{pecl_name} -Version: 2.0.1 -Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Summary: Scrypt hashing function License: BSD-2-Clause -Group: Development/Languages -URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{sources}.tgz +Version: 2.0.1 +Release: 3%{?dist} +%forgemeta +URL: %{forgeurl} +Source0: %{forgesource} + +Patch0: 79.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.0 -BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} +%if "%{php_version}" < "8.6" Requires: %{?scl_prefix}php-hash%{?_isa} +%endif -Provides: %{?scl_prefix}php-%{pecl_name} = %{version} -Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} -Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} -Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# Extension +Provides: %{?scl_prefix}php-%{pecl_name} = %{version} +Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} +# PECL +Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} +Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} +# PIE +Provides: %{?scl_prefix}php-pie(%{pie_vend}/%{pie_proj}) = %{version} +Provides: %{?scl_prefix}php-%{pie_vend}-%{pie_proj} = %{version} %description @@ -47,21 +60,15 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep -%setup -q -c +%forgesetup +%patch -P0 -p1 -# Don't install/register tests -sed -e 's/role="test"/role="src"/' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ - -i package.xml - -cd %{sources} # Sanity check, really often broken extver=$(sed -n '/#define PHP_SCRYPT_VERSION/{s/.* "//;s/".*$//;p}' php_scrypt.h) if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then : Error: Upstream extension version is ${extver}, expecting %{version}%{?prever:-%{prever}}. exit 1 fi -cd .. mkdir NTS %if %{with_zts} @@ -78,15 +85,16 @@ EOF %build %{?dtsenable} -cd %{sources} %{__phpize} +[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global +sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL -cd ../NTS +cd NTS %configure \ --with-libdir=%{_lib} \ --with-php-config=%{__phpconfig} -make %{?_smp_mflags} +%make_build %if %{with_zts} cd ../ZTS @@ -94,65 +102,36 @@ cd ../ZTS --with-libdir=%{_lib} \ --with-php-config=%{__ztsphpconfig} -make %{?_smp_mflags} +%make_build %endif %install %{?dtsenable} -make -C NTS install INSTALL_ROOT=%{buildroot} +%make_install -C NTS # install config file install -D -m 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} -# Install XML package description -install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml - %if %{with_zts} -make -C ZTS install INSTALL_ROOT=%{buildroot} +%make_install -C ZTS install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif -# Documentation -for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i -done - - -%if 0%{?fedora} < 24 && 0%{?rhel} < 8 -# when pear installed alone, after us -%triggerin -- %{?scl_prefix}php-pear -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -# posttrans as pear can be installed after us -%posttrans -if [ -x %{__pecl} ] ; then - %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : -fi - -%postun -if [ $1 -eq 0 -a -x %{__pecl} ] ; then - %{pecl_uninstall} %{pecl_name} >/dev/null || : -fi -%endif - %check -cd %{sources} : Minimal load test for NTS extension %{__php} --no-php-ini \ - --define extension=../NTS/modules/%{pecl_name}.so \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' %if %{with tests} : Upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{__php} \ -TEST_PHP_ARGS="-n -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ +TEST_PHP_ARGS="-n -d extension=$PWD/NTS/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ %{__php} -n run-tests.php -q --show-diff %endif @@ -161,23 +140,17 @@ REPORT_EXIT_STATUS=1 \ %if %{with_zts} : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ - --define extension=../ZTS/modules/%{pecl_name}.so \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' - -%if %{with tests} -: Upstream test suite for ZTS extension -TEST_PHP_EXECUTABLE=%{__ztsphp} \ -TEST_PHP_ARGS="-n -d extension=$PWD/../ZTS/modules/%{pecl_name}.so" \ -REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php -q --show-diff -%endif %endif %files -%{?_licensedir:%license %{sources}/LICENSE} -%doc %{pecl_docdir}/%{pecl_name} -%{pecl_xmldir}/%{name}.xml +%license LICENSE +#doc composer.json +%doc *.md +%doc CREDITS +%doc scrypt.php %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so @@ -189,6 +162,14 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Tue Jul 21 2026 Remi Collet <remi@remirepo.net> - 2.0.1-3 +- re-license spec file to CECILL-2.1 +- add pie virtual provides +- drop pear/pecl dependency +- sources from github +- fix build with PHP 8.6.0alpha2 using patch from + https://github.com/DomBlack/php-scrypt/pull/79 + * Fri Sep 1 2023 Remi Collet <remi@remirepo.net> - 2.0.1-2 - build out of sources tree |
