diff options
-rw-r--r-- | 19.patch | 34 | ||||
-rw-r--r-- | php-pecl-mcrypt.spec | 77 |
2 files changed, 52 insertions, 59 deletions
diff --git a/19.patch b/19.patch new file mode 100644 index 0000000..e3fa273 --- /dev/null +++ b/19.patch @@ -0,0 +1,34 @@ +From d5a6b4bb2d9704b69ff121356e1e5a65080dfdaf Mon Sep 17 00:00:00 2001 +From: Remi Collet <remi@php.net> +Date: Wed, 10 Jul 2024 14:43:24 +0200 +Subject: [PATCH] use php_mt_rand_range for 8.4 + +--- + mcrypt.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/mcrypt.c b/mcrypt.c +index b834ffe..cf2a8d4 100644 +--- a/mcrypt.c ++++ b/mcrypt.c +@@ -38,7 +38,11 @@ + #include "php_ini.h" + #include "php_globals.h" + #include "ext/standard/info.h" ++#if PHP_VERSION_ID < 80400 + #include "ext/standard/php_rand.h" ++#else ++#include "ext/random/php_random.h" ++#endif + #include "zend_smart_str.h" + #include "php_mcrypt_filter.h" + +@@ -1414,7 +1418,7 @@ PHP_FUNCTION(mcrypt_create_iv) + } else { + n = (int)size; + while (size) { +- iv[--size] = (char) (255.0 * php_rand() / RAND_MAX); ++ iv[--size] = (char)php_mt_rand_range(0, 255); + } + } + RETVAL_STRINGL(iv, n); diff --git a/php-pecl-mcrypt.spec b/php-pecl-mcrypt.spec index 97a4534..c592658 100644 --- a/php-pecl-mcrypt.spec +++ b/php-pecl-mcrypt.spec @@ -1,6 +1,6 @@ # remirepo spec file for php-pecl-mcrypt # -# Copyright (c) 2017-2023 Remi Collet +# Copyright (c) 2017-2024 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -20,12 +20,14 @@ Summary: Bindings for the libmcrypt library Name: %{?scl_prefix}php-pecl-mcrypt Version: 1.0.7 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP-3.01 URL: https://pecl.php.net/package/mcrypt Source0: https://pecl.php.net/get/%{sources}.tgz +Patch0: 19.patch + BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 7.2 @@ -43,29 +45,6 @@ Provides: %{?scl_prefix}php-%{pecl_name} = 1:%{version}-%{release} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = 1:%{version}-%{release} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} == 7 -Obsoletes: php54u-%{pecl_name} < 7.2 -Obsoletes: php54w-%{pecl_name} < 7.2 -Obsoletes: php55u-%{pecl_name} < 7.2 -Obsoletes: php55w-%{pecl_name} < 7.2 -Obsoletes: php56u-%{pecl_name} < 7.2 -Obsoletes: php56w-%{pecl_name} < 7.2 -Obsoletes: php70u-%{pecl_name} < 7.2 -Obsoletes: php70w-%{pecl_name} < 7.2 -Obsoletes: php71u-%{pecl_name} < 7.2 -Obsoletes: php71w-%{pecl_name} < 7.2 -Obsoletes: php72u-pecl-%{pecl_name} <= %{version} -Obsoletes: php72w-pecl-%{pecl_name} <= %{version} -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%endif - - %description Provides bindings for the unmaintained libmcrypt. @@ -77,10 +56,12 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO # Don't install/register tests sed -e 's/role="test"/role="src"/' \ - %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ + -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml cd %{sources} +%patch -P0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_MCRYPT_VERSION/{s/.* "//;s/".*$//;p}' php_mcrypt.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -106,13 +87,15 @@ mkdir ZTS cd %{sources} %{__phpize} +[ -f Makefile.global ] && GLOBAL=Makefile.global || GLOBAL=build/Makefile.global +sed -e 's/INSTALL_ROOT/DESTDIR/' -i $GLOBAL cd ../NTS %configure \ --with-mcrypt \ --with-php-config=%{__phpconfig} -make %{?_smp_mflags} +%make_build %if %{with_zts} cd ../ZTS @@ -120,21 +103,21 @@ cd ../ZTS --with-mcrypt \ --with-php-config=%{__ztsphpconfig} -make %{?_smp_mflags} +%make_build %endif %install %{?dtsenable} -make -C NTS install INSTALL_ROOT=%{buildroot} +%make_install -C NTS 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 @@ -173,39 +156,11 @@ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ %{__ztsphp} --no-php-ini \ --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=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ -%{__ztsphp} -n run-tests.php $OPT -%endif -%endif - - -%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 %files -%{?_licensedir:%license %{sources}/LICENSE} -%{!?_licensedir:%doc %{pecl_docdir}/%{pecl_name}} +%license %{sources}/LICENSE %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -218,6 +173,10 @@ fi %changelog +* Wed Jul 10 2024 Remi Collet <remi@remirepo.net> - 1.0.7-2 +- fix build with PHP 8.4 using patch from + https://github.com/php/pecl-encryption-mcrypt/pull/19 + * Tue Dec 19 2023 Remi Collet <remi@remirepo.net> - 1.0.7-1 - update to 1.0.7 (no change) |