From 81746dd88aacd14d08629df078456b1d2df5720d Mon Sep 17 00:00:00 2001 From: slava86 Date: Wed, 16 Jun 2021 00:31:35 +0300 Subject: [PATCH] add macros and check for apiver zendver pdover, fix provides, php (zend-abi) != EVRD --- macros.php | 18 ++++++++++++++++++ php7.spec | 48 ++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 macros.php diff --git a/macros.php b/macros.php new file mode 100644 index 0000000..532d00e --- /dev/null +++ b/macros.php @@ -0,0 +1,18 @@ +# +# Interface versions exposed by PHP: +# +%php_core_api @PHP_APIVER@ +%php_zend_api @PHP_ZENDVER@ +%php_pdo_api @PHP_PDOVER@ +%php_version @PHP_VERSION@ + +# Compatibility, drop when nobody uses it +%php_api @PHP_ZENDVER@ + +%php_extdir %{_libdir}/php/modules + +%php_inidir %{_sysconfdir}/php.d + +%php_incldir %{_includedir}/php + +%__php %{_bindir}/php diff --git a/php7.spec b/php7.spec index 083bc9c..3f7157d 100644 --- a/php7.spec +++ b/php7.spec @@ -19,11 +19,17 @@ %global __requires_exclude '.*/bin/awk|.*/bin/gawk' +# API/ABI check +%define apiver 20190902 +%define zendver 20190902 +%define pdover 20170320 + Summary: The PHP7 scripting language Name: php Version: 7.4.15 -Release: 2 +Release: 3 Source0: http://ch1.php.net/distributions/php-%{version}.tar.xz +Source1: macros.php Group: Development/PHP License: PHP License URL: http://www.php.net @@ -270,7 +276,8 @@ Summary: Shared library for PHP7 Group: Development/Other Provides: %{name}-pcre = %{EVRD} Provides: %{name}-simplexml = %{EVRD} -Provides: php(zend-abi) = %{EVRD} +Provides: php(api) = %{apiver} +Provides: php(zend-abi) = %{zendver} Requires: systemd-units Requires(post): systemd-units Requires(preun): systemd-units @@ -718,6 +725,8 @@ environment. Summary: PHP Data Objects Interface Group: Development/PHP Requires: %{libname} >= %{EVRD} +Provides: %{name}-pdo-abi = %{pdover} +Provides: php(pdo-abi) = %{pdover} %description pdo PDO provides a uniform data access interface, sporting advanced features such @@ -1192,6 +1201,29 @@ export LANGUAGE=en_US.utf-8 export LANGUAGES=en_US.utf-8 %setup -qn %{name}-%{version} +# Safety check for API version change. +vapi=`sed -n '/#define PHP_API_VERSION/{s/.* //;p}' main/php.h` +if test "x${vapi}" != "x%{apiver}"; then + : Error: Upstream API version is now ${vapi}, expecting %{apiver}. + : Update the apiver macro and rebuild. + exit 1 +fi + +vzend=`sed -n '/#define ZEND_MODULE_API_NO/{s/^[^0-9]*//;p;}' Zend/zend_modules.h` +if test "x${vzend}" != "x%{zendver}"; then + : Error: Upstream Zend ABI version is now ${vzend}, expecting %{zendver}. + : Update the zendver macro and rebuild. + exit 1 +fi + +# Safety check for PDO ABI version change +vpdo=`sed -n '/#define PDO_DRIVER_API/{s/.*[ ]//;p}' ext/pdo/php_pdo_driver.h` +if test "x${vpdo}" != "x%{pdover}"; then + : Error: Upstream PDO ABI version is now ${vpdo}, expecting %{pdover}. + : Update the pdover macro and rebuild. + exit 1 +fi + %if %{build_libmagic} if ! [ -f %{_datadir}/misc/magic.mgc ]; then echo "ERROR: the %{_datadir}/misc/magic.mgc file is needed" @@ -1723,6 +1755,16 @@ rm -rf %{buildroot}%{_usrsrc}/php-devel/extensions/zlib # php-devel.i586: E: zero-length /usr/src/php-devel/extensions/pdo_firebird/EXPERIMENTAL find %{buildroot}%{_usrsrc}/php-devel -type f -size 0 -exec rm -f {} \; +mkdir -p %{buildroot}%{_sysconfdir}/rpm/macros.d/ + +# Install the macros file: +sed -e "s/@PHP_APIVER@/%{apiver}/" \ + -e "s/@PHP_ZENDVER@/%{zendver}/g" \ + -e "s/@PHP_PDOVER@/%{pdover}/" \ + -e "s/@PHP_VERSION@/%{version}/" \ + < %{SOURCE1} > macros.php +%install_macro %{name} macros.php + %if %{build_test} # do a make test export NO_INTERACTION=1 @@ -2345,6 +2387,7 @@ fi %{_includedir}/php %attr(0644,root,root) %{_mandir}/man1/php-config.1* %attr(0644,root,root) %{_mandir}/man1/phpize.1* +%{_rpmmacrodir}/*%{name}* %files openssl %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/php.d/21_openssl.ini @@ -2610,3 +2653,4 @@ fi %dir %{_libdir}/php %dir %{_libdir}/php/extensions %dir %{_datadir}/php +