From 3cc75383565539ba875ee8b464a6d4fff9b741ab Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 27 Aug 2024 16:01:57 +0200 Subject: workaround for recent util-linux --- php-pecl-uuid.spec | 116 +++++++++++++++++++++----------------------------- uuid-workaround.patch | 28 ++++++++++++ 2 files changed, 76 insertions(+), 68 deletions(-) create mode 100644 uuid-workaround.patch diff --git a/php-pecl-uuid.spec b/php-pecl-uuid.spec index 18b98a4..b765a82 100644 --- a/php-pecl-uuid.spec +++ b/php-pecl-uuid.spec @@ -3,36 +3,33 @@ # # Fedora spec file for php-pecl-uuid # -# Copyright (c) 2012-2023 Remi Collet +# Copyright (c) 2012-2024 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -# we don't want -z defs linker flag -%undefine _strict_symbol_defs_build +%{?scl:%scl_package php-pecl-uuid} -%if 0%{?scl:1} -%scl_package php-pecl-uuid -%endif +%bcond_without tests %global pecl_name uuid %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%if "%{php_version}" < "5.6" -%global ini_name %{pecl_name}.ini -%else %global ini_name 40-%{pecl_name}.ini -%endif #global prever RC1 +%global sources %{pecl_name}-%{version}%{?prever} +%global _configure ../%{sources}/configure Summary: Universally Unique Identifier extension for PHP Name: %{?scl_prefix}php-pecl-uuid Version: 1.2.0 -Release: 6%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 8%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: LGPL-2.1-or-later URL: https://pecl.php.net/package/uuid -Source: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +Source: https://pecl.php.net/get/%{sources}.tgz + +Patch0: %{pecl_name}-workaround.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -53,22 +50,6 @@ Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.0" -Obsoletes: php80-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.1" -Obsoletes: php81-pecl-%{pecl_name} <= %{version} -%endif -%endif - %description A wrapper around Universally Unique Identifier library (libuuid). @@ -81,11 +62,11 @@ 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 -mv %{pecl_name}-%{version}%{?prever} NTS -cd NTS +cd %{sources} +%patch -P0 -p1 -b .orig # Sanity check, really often broken extver=$(sed -n '/#define PHP_UUID_VERSION/{s/.* "//;s/".*$//;p}' php_uuid.h) @@ -95,9 +76,9 @@ if test "x${extver}" != "x%{version}%{?prever}"; then fi cd .. +mkdir NTS %if %{with_zts} -# duplicate for ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif # Drop in the bit of configuration @@ -111,19 +92,20 @@ EOF %{?dtsenable} export PHP_RPATH=no -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ - --with-php-config=%{_bindir}/php-config \ + --with-php-config=%{__phpconfig} \ --with-libdir=%{_lib} \ --with-uuid make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ - --with-php-config=%{_bindir}/zts-php-config \ + --with-php-config=%{__ztsphpconfig} \ --with-libdir=%{_lib} \ --with-uuid make %{?_smp_mflags} @@ -147,54 +129,46 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml # Documentation -cd NTS +cd %{sources} for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//') do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done %check -cd NTS +cd %{sources} + +: Minimal load test for NTS extension +%{__php} --no-php-ini \ + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' -TEST_PHP_EXECUTABLE=%{_bindir}/php \ -TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \ -NO_INTERACTION=1 \ +%if %{with tests} +: Upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{_bindir}/php -n run-tests.php +%{__php} -n run-tests.php -q --show-diff +%endif %if %{with_zts} -cd ../ZTS +: Minimal load test for NTS extension +%{__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_dir=$PWD/modules -d extension=%{pecl_name}.so" \ -NO_INTERACTION=1 \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests.php +%{__ztsphp} -n run-tests.php -q --show-diff %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 NTS/LICENSE} +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -208,6 +182,12 @@ fi %changelog +* Tue Aug 27 2024 Remi Collet - 1.2.0-8 +- workaround for recent util-linux + +* Mon Feb 19 2024 Remi Collet - 1.2.0-7 +- build out of sources tree + * Wed Aug 30 2023 Remi Collet - 1.2.0-6 - rebuild for PHP 8.3.0RC1 diff --git a/uuid-workaround.patch b/uuid-workaround.patch new file mode 100644 index 0000000..71a6147 --- /dev/null +++ b/uuid-workaround.patch @@ -0,0 +1,28 @@ +diff -up ./uuid.c.orig ./uuid.c +--- ./uuid.c.orig 2020-10-06 12:50:46.000000000 +0200 ++++ ./uuid.c 2024-08-27 15:57:06.551255840 +0200 +@@ -27,6 +27,12 @@ + + #ifdef HAVE_UUID + ++/* workround with define uuid_time uuid_time64 */ ++#ifdef uuid_time ++#undef uuid_time ++#define HAVE_TIME64 ++#endif ++ + #if PHP_VERSION_ID < 80000 + #define VALUE_ERROR(n,name,msg) php_error_docref(NULL, E_WARNING, "Argument #%d (%s) %s", n, name, msg); RETURN_FALSE + #define RETURN_THROWS() return +@@ -374,7 +380,11 @@ PHP_FUNCTION(uuid_time) + VALUE_ERROR(1, "$uuid", "UUID DCE TIME expected"); + } + ++#ifdef HAVE_TIME64 ++ RETURN_LONG(uuid_time64(u, NULL)); ++#else + RETURN_LONG(uuid_time(u, NULL)); ++#endif + } + /* }}} uuid_time */ + -- cgit