add macros and check for apiver zendver pdover,

fix provides,
php (zend-abi) != EVRD
This commit is contained in:
slava86 2021-06-16 00:31:35 +03:00
parent dfee747c59
commit 81746dd88a
2 changed files with 64 additions and 2 deletions

18
macros.php Normal file
View file

@ -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

View file

@ -19,11 +19,17 @@
%global __requires_exclude '.*/bin/awk|.*/bin/gawk' %global __requires_exclude '.*/bin/awk|.*/bin/gawk'
# API/ABI check
%define apiver 20190902
%define zendver 20190902
%define pdover 20170320
Summary: The PHP7 scripting language Summary: The PHP7 scripting language
Name: php Name: php
Version: 7.4.15 Version: 7.4.15
Release: 2 Release: 3
Source0: http://ch1.php.net/distributions/php-%{version}.tar.xz Source0: http://ch1.php.net/distributions/php-%{version}.tar.xz
Source1: macros.php
Group: Development/PHP Group: Development/PHP
License: PHP License License: PHP License
URL: http://www.php.net URL: http://www.php.net
@ -270,7 +276,8 @@ Summary: Shared library for PHP7
Group: Development/Other Group: Development/Other
Provides: %{name}-pcre = %{EVRD} Provides: %{name}-pcre = %{EVRD}
Provides: %{name}-simplexml = %{EVRD} Provides: %{name}-simplexml = %{EVRD}
Provides: php(zend-abi) = %{EVRD} Provides: php(api) = %{apiver}
Provides: php(zend-abi) = %{zendver}
Requires: systemd-units Requires: systemd-units
Requires(post): systemd-units Requires(post): systemd-units
Requires(preun): systemd-units Requires(preun): systemd-units
@ -718,6 +725,8 @@ environment.
Summary: PHP Data Objects Interface Summary: PHP Data Objects Interface
Group: Development/PHP Group: Development/PHP
Requires: %{libname} >= %{EVRD} Requires: %{libname} >= %{EVRD}
Provides: %{name}-pdo-abi = %{pdover}
Provides: php(pdo-abi) = %{pdover}
%description pdo %description pdo
PDO provides a uniform data access interface, sporting advanced features such 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 export LANGUAGES=en_US.utf-8
%setup -qn %{name}-%{version} %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 %{build_libmagic}
if ! [ -f %{_datadir}/misc/magic.mgc ]; then if ! [ -f %{_datadir}/misc/magic.mgc ]; then
echo "ERROR: the %{_datadir}/misc/magic.mgc file is needed" 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 # 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 {} \; 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} %if %{build_test}
# do a make test # do a make test
export NO_INTERACTION=1 export NO_INTERACTION=1
@ -2345,6 +2387,7 @@ fi
%{_includedir}/php %{_includedir}/php
%attr(0644,root,root) %{_mandir}/man1/php-config.1* %attr(0644,root,root) %{_mandir}/man1/php-config.1*
%attr(0644,root,root) %{_mandir}/man1/phpize.1* %attr(0644,root,root) %{_mandir}/man1/phpize.1*
%{_rpmmacrodir}/*%{name}*
%files openssl %files openssl
%attr(0644,root,root) %config(noreplace) %{_sysconfdir}/php.d/21_openssl.ini %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/php.d/21_openssl.ini
@ -2610,3 +2653,4 @@ fi
%dir %{_libdir}/php %dir %{_libdir}/php
%dir %{_libdir}/php/extensions %dir %{_libdir}/php/extensions
%dir %{_datadir}/php %dir %{_datadir}/php