From 96941780cc9fdad46905d96285e5fd1d448bab3f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 17 Sep 2020 14:51:27 +0200 Subject: drop mod_php for ZTS (have never be suported) use %bcond_without for dtrace, libgd, firebird, lsws, libpcre, zts so can be disable during rebuild use %bcond_with for libpcre, oci8, zip and debug so can be enable during rebuild --- php.ztsmodconf | 9 --- php80.spec | 225 +++++++++++++++++++++++++++++---------------------------- 2 files changed, 115 insertions(+), 119 deletions(-) delete mode 100644 php.ztsmodconf diff --git a/php.ztsmodconf b/php.ztsmodconf deleted file mode 100644 index 7ce38bf..0000000 --- a/php.ztsmodconf +++ /dev/null @@ -1,9 +0,0 @@ - - - - - # ZTS module is not supported, so FPM should be preferred - LoadModule php_module modules/libphp-zts.so - - - diff --git a/php80.spec b/php80.spec index 68ba431..2dbee97 100644 --- a/php80.spec +++ b/php80.spec @@ -14,7 +14,7 @@ # Extension version %global fileinfover 1.0.5 %global oci8ver 3.0.0 -%global zipver 1.19.0 +%global zipver 1.19.1-dev # Adds -z now to the linker flags %global _hardened_build 1 @@ -31,43 +31,35 @@ %endif %global oraclelib 19.1 -# Build for LiteSpeed Web Server (LSAPI) -%global with_lsws 1 +# Build for LiteSpeed Web Server (LSAPI), you can disable using --without tests +%bcond_without lsws -# Regression tests take a long time, you can skip 'em with this -%bcond_without tests +# Regression tests take a long time, you can skip 'em using --without tests +%bcond_without tests # Use the arch-specific mysql_config binary to avoid mismatch with the # arch detection heuristic used by bindir/mysql_config. %global mysql_config %{_libdir}/mysql/mysql_config # Optional components; pass "--with mssql" etc to rpmbuild. -%global with_oci8 %{?_with_oci8:1}%{!?_with_oci8:0} +%bcond_with oci8 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 -%global with_libpcre 1 +# switch to bundled library using --without libpcre +%bcond_without libpcre %else -%global with_libpcre 0 +# switch to system library using --with libpcre +%bcond_with libpcre %endif -# until firebird available in EPEL -%if 0%{?rhel} == 8 -%global with_firebird 0 -%else -%global with_firebird 1 -%endif - -# Build ZTS extension or only NTS -%global with_zts 1 +# Build firebird extensions, you can disable using --without firebird +%bcond_without firebird -# Debuild build -%global with_debug %{?_with_debug:1}%{!?_with_debug:0} +# Build ZTS extension or only NTS using --without zts +%bcond_without zts -%if 0%{?__isa_bits:1} -%global isasuffix -%{__isa_bits} -%else -%global isasuffix %nil -%endif +# Debug build, using --with debug +%bcond_with debug # /usr/sbin/apsx with httpd < 2.4 and defined as /usr/bin/apxs with httpd >= 2.4 %{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}} @@ -93,10 +85,9 @@ %global with_nginx 0 %endif -%global with_dtrace 1 -%global with_libgd 1 -%global with_libzip 1 -%global with_zip 0 +%bcond_without dtrace +%bcond_without libgd +%bcond_with zip %global upver 8.0.0 %global rcver beta4 @@ -105,7 +96,7 @@ Summary: PHP scripting language for creating dynamic web sites Name: php Version: %{upver}%{?rcver:~%{lower}} -Release: 3%{?dist} +Release: 4%{?dist} # All files licensed under PHP version 3.01, except # Zend is licensed under Zend # TSRM is licensed under BSD @@ -125,7 +116,6 @@ Source6: php-fpm.service Source7: php-fpm.logrotate Source8: php-fpm.sysconfig Source9: php.modconf -Source10: php.ztsmodconf Source11: php.conf2 Source12: php-fpm.wants Source13: nginx-fpm.conf @@ -192,7 +182,7 @@ BuildRequires: pkgconfig(sqlite3) >= 3.7.4 BuildRequires: pkgconfig(zlib) >= 1.2.0.4 BuildRequires: smtpdaemon BuildRequires: pkgconfig(libedit) -%if %{with_libpcre} +%if %{with libpcre} BuildRequires: pkgconfig(libpcre2-8) >= 10.30 %else Provides: bundled(pcre2) = 10.32 @@ -205,7 +195,7 @@ BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?dtsprefix}gcc-c++ BuildRequires: libtool BuildRequires: libtool-ltdl-devel -%if %{with_dtrace} +%if %{with dtrace} BuildRequires: %{?dtsprefix}systemtap-sdt-devel %endif #BuildRequires: bison @@ -221,7 +211,7 @@ Obsoletes: mod_php80 %endif # Avoid obsoleting php54 from RHSCL Obsoletes: php54 > 5.4 -%if %{with_zts} +%if %{with zts} Obsoletes: php-zts < 5.3.7 Provides: php-zts = %{version}-%{release} Provides: php-zts%{?_isa} = %{version}-%{release} @@ -340,7 +330,7 @@ PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites. -%if %{with_lsws} +%if %{with lsws} %package litespeed Summary: LiteSpeed Web Server PHP support Requires: php-common%{?_isa} = %{version}-%{release} @@ -440,14 +430,14 @@ Requires: libtool Requires: krb5-devel%{?_isa} Requires: libxml2-devel%{?_isa} Requires: openssl-devel%{?_isa} >= 1.0.1 -%if %{with_libpcre} +%if %{with libpcre} Requires: pcre2-devel%{?_isa} %endif Requires: zlib-devel%{?_isa} Obsoletes: php-pecl-pdo-devel Obsoletes: php-pecl-json-devel < %{version} Obsoletes: php-pecl-jsonc-devel < %{version} -%if %{with_zts} +%if %{with zts} Provides: php-zts-devel = %{version}-%{release} Provides: php-zts-devel%{?_isa} = %{version}-%{release} %endif @@ -684,7 +674,7 @@ Obsoletes: php80-soap The php-soap package contains a dynamic shared object that will add support to PHP for using the SOAP web services protocol. -%if %{with_firebird} +%if %{with firebird} %package pdo-firebird Summary: PDO driver for Interbase/Firebird databases # All files licensed under PHP version 3.01 @@ -706,7 +696,7 @@ The php-pdo-firebird package contains the PDO driver for Interbase/Firebird databases. %endif -%if %{with_oci8} +%if %{with oci8} %package oci8 Summary: A module for PHP applications that use OCI8 databases # All files licensed under PHP version 3.01 @@ -825,14 +815,14 @@ support for multi-byte string handling to PHP. %package gd Summary: A module for PHP applications for using the gd graphics library # All files licensed under PHP version 3.01 -%if %{with_libgd} +%if %{with libgd} License: PHP %else # bundled libgd is licensed under BSD License: PHP and BSD %endif Requires: php-common%{?_isa} = %{version}-%{release} -%if %{with_libgd} +%if %{with libgd} BuildRequires: pkgconfig(gdlib) >= 2.1.1 %if 0%{?fedora} <= 19 && 0%{?rhel} <= 7 Requires: gd-last%{?_isa} >= 2.1.1 @@ -1032,7 +1022,7 @@ Obsoletes: php80-enchant The php-enchant package contains a dynamic shared object that will add support for using the enchant library to PHP. -%if %{with_zip} +%if %{with zip} %package zip Summary: ZIP archive management extension for PHP # All files licensed under PHP version 3.0.1 @@ -1050,9 +1040,7 @@ Obsoletes: php73-zip, php73w-zip Obsoletes: php74-zip, php74w-zip Obsoletes: php80-zip %endif -%if %{with_libzip} BuildRequires: pkgconfig(libzip) >= 0.11 -%endif %description zip The php-zip package provides an extension that will add @@ -1104,9 +1092,38 @@ in pure PHP. %prep -%{?gpgverify:%{gpgverify} --keyring='%{SOURCE20}' --signature='%{SOURCE21}' --data='%{SOURCE0}'} +: Building %{name}-%{version}-%{release} +%if %{with lsws} +: With Litespeed SAPI +%endif +%if %{with oci8} +: With Oracle extensions +%endif +%if %{with firebird} +: With Firebird extension +%endif +%if %{with zip} +: With Zip extension +%endif +%if %{with tests} +: Run Test suite +%endif +%if %{with libpcre} +: Use System libpcre +%else +: Use Bundled libpcre +%endif +%if %{with zts} +: Enable ZTS build +%endif +%if %{with debug} +: Enable Debug build +%endif +%if %{with dtrace} +: Enable Dtrace build +%endif -: CIBLE = %{name}-%{version}-%{release} oci8=%{with_oci8} libzip=%{with_libzip} +%{?gpgverify:%{gpgverify} --keyring='%{SOURCE20}' --signature='%{SOURCE21}' --data='%{SOURCE0}'} %setup -q -n php-%{upver}%{?rcver} @@ -1150,8 +1167,8 @@ cp ext/date/lib/LICENSE.rst timelib_LICENSE # Multiple builds for multiple SAPIs mkdir build-cgi build-apache build-embedded \ -%if %{with_zts} - build-zts build-ztscli \ +%if %{with zts} + build-ztscli \ %endif build-fpm @@ -1224,14 +1241,12 @@ if test "$ver" != "%{oci8ver}"; then exit 1 fi -%if %{with_zip} ver=$(sed -n '/#define PHP_ZIP_VERSION /{s/.* "//;s/".*$//;p}' ext/zip/php_zip.h) if test "$ver" != "%{zipver}"; then : Error: Upstream ZIP version is now ${ver}, expecting %{zipver}. : Update the %{zipver} macro and rebuild. exit 1 fi -%endif # https://bugs.php.net/63362 - Not needed but installed headers. # Drop some Windows specific headers to avoid installation, @@ -1284,7 +1299,7 @@ cat $(aclocal --print-ac-dir)/{libtool,ltoptions,ltsugar,ltversion,lt~obsolete}. # Regenerate configure scripts (patches change config.m4's) touch configure.ac ./buildconf --force -%if %{with_debug} +%if %{with debug} LDFLAGS="-fsanitize=address" export LDFLAGS CFLAGS=$(echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-pointer-sign -fsanitize=address -ggdb | sed 's/-mstackrealign//') @@ -1334,7 +1349,7 @@ ln -sf ../configure --without-gdbm \ --with-openssl \ --with-system-ciphers \ -%if %{with_libpcre} +%if %{with libpcre} --with-external-pcre \ %endif --with-zlib \ @@ -1346,10 +1361,10 @@ ln -sf ../configure %endif --with-mhash \ --without-password-argon2 \ -%if %{with_dtrace} +%if %{with dtrace} --enable-dtrace \ %endif -%if %{with_debug} +%if %{with debug} --enable-debug \ %endif $* @@ -1374,7 +1389,7 @@ build --libdir=%{_libdir}/php \ --enable-mbstring=shared \ --enable-mbregex \ --enable-gd=shared \ -%if %{with_libgd} +%if %{with libgd} --with-external-gd \ %else --with-webp \ @@ -1401,7 +1416,7 @@ build --libdir=%{_libdir}/php \ --enable-mysqlnd=shared \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=%{mysql_sock} \ -%if %{with_oci8} +%if %{with oci8} %ifarch x86_64 --with-oci8=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client64/lib,%{oraclever} \ --with-pdo-oci=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client64/lib,%{oraclever} \ @@ -1410,7 +1425,7 @@ build --libdir=%{_libdir}/php \ --with-pdo-oci=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client/lib,%{oraclever} \ %endif %endif -%if %{with_firebird} +%if %{with firebird} --with-pdo-firebird=shared \ %endif --enable-dom=shared \ @@ -1429,7 +1444,7 @@ build --libdir=%{_libdir}/php \ --with-pdo-sqlite=shared \ --with-pdo-dblib=shared,%{_prefix} \ --with-sqlite3=shared \ -%if %{with_zip} +%if %{with zip} --with-zip=shared \ %endif --without-readline \ @@ -1467,7 +1482,7 @@ without_shared="--disable-gd \ pushd build-apache build --with-apxs2=%{_httpd_apxs} \ --libdir=%{_libdir}/php \ -%if %{with_lsws} +%if %{with lsws} --enable-litespeed \ %endif --without-mysqli \ @@ -1494,7 +1509,7 @@ build --enable-embed \ ${without_shared} popd -%if %{with_zts} +%if %{with zts} # Build a special thread-safe (mainly for modules) pushd build-ztscli @@ -1512,7 +1527,7 @@ build --includedir=%{_includedir}/php-zts \ --enable-mbstring=shared \ --enable-mbregex \ --enable-gd=shared \ -%if %{with_libgd} +%if %{with libgd} --with-external-gd \ %else --with-webp \ @@ -1540,7 +1555,7 @@ build --includedir=%{_includedir}/php-zts \ --with-mysqli=shared,mysqlnd \ --with-mysql-sock=%{mysql_sock} \ --enable-mysqlnd-threading \ -%if %{with_oci8} +%if %{with oci8} %ifarch x86_64 --with-oci8=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client64/lib,%{oraclever} \ --with-pdo-oci=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client64/lib,%{oraclever} \ @@ -1549,7 +1564,7 @@ build --includedir=%{_includedir}/php-zts \ --with-pdo-oci=shared,instantclient,%{_libdir}/oracle/%{oraclever}/client/lib,%{oraclever} \ %endif %endif -%if %{with_firebird} +%if %{with firebird} --with-pdo-firebird=shared \ %endif --enable-dom=shared \ @@ -1568,7 +1583,7 @@ build --includedir=%{_includedir}/php-zts \ --with-pdo-sqlite=shared \ --with-pdo-dblib=shared,%{_prefix} \ --with-sqlite3=shared \ -%if %{with_zip} +%if %{with zip} --with-zip=shared \ %endif --without-readline \ @@ -1587,26 +1602,20 @@ build --includedir=%{_includedir}/php-zts \ --with-enchant=shared popd -# Build a special thread-safe Apache SAPI -pushd build-zts -build --with-apxs2=%{_httpd_apxs} \ - --includedir=%{_includedir}/php-zts \ - --libdir=%{_libdir}/php-zts \ - --enable-zts \ - --with-config-file-scan-dir=%{_sysconfdir}/php-zts.d \ - --without-mysql \ - --disable-pdo \ - ${without_shared} -popd - ### NOTE!!! EXTENSION_DIR was changed for the -zts build, so it must remain ### the last SAPI to be built. %endif %check +: Ensure proper NTS/ZTS build +$RPM_BUILD_ROOT%{_bindir}/php -n -v | grep NTS +%if %{with zts} +$RPM_BUILD_ROOT%{_bindir}/zts-php -n -v | grep ZTS +%endif + %if %{with tests} -cd build-apache +cd build-fpm # Run tests, using the CLI SAPI export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 @@ -1633,7 +1642,7 @@ unset NO_INTERACTION REPORT_EXIT_STATUS MALLOC_CHECK_ %install %{?dtsenable} -%if %{with_zts} +%if %{with zts} # Install the extensions for the ZTS version make -C build-ztscli install \ INSTALL_ROOT=$RPM_BUILD_ROOT @@ -1665,17 +1674,9 @@ install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/php/preload install -m 755 -d $RPM_BUILD_ROOT%{_httpd_moddir} install -m 755 build-apache/libs/libphp.so $RPM_BUILD_ROOT%{_httpd_moddir}/libphp.so -%if %{with_zts} -# install the ZTS DSO -install -m 755 build-zts/libs/libphp.so $RPM_BUILD_ROOT%{_httpd_moddir}/libphp-zts.so -%endif - # Apache config fragment # Dual config file with httpd >= 2.4 (fedora >= 18) install -D -m 644 %{SOURCE9} $RPM_BUILD_ROOT%{_httpd_modconfdir}/20-php.conf -%if %{with_zts} && 0%{?fedora} < 27 && 0%{?rhel} < 8 -cat %{SOURCE10} >>$RPM_BUILD_ROOT%{_httpd_modconfdir}/20-php.conf -%endif install -D -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_confdir}/php.conf %if %{with_httpd2410} @@ -1694,7 +1695,7 @@ EOF %endif install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/php.d -%if %{with_zts} +%if %{with zts} install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d %endif install -m 755 -d $RPM_BUILD_ROOT%{_localstatedir}/lib/php @@ -1707,7 +1708,7 @@ install -m 755 -d $RPM_BUILD_ROOT%{_docdir}/pecl install -m 755 -d $RPM_BUILD_ROOT%{_datadir}/tests/pecl %endif -%if %{with_lsws} +%if %{with lsws} install -m 755 build-apache/sapi/litespeed/php $RPM_BUILD_ROOT%{_bindir}/lsphp %endif @@ -1781,7 +1782,7 @@ for mod in pgsql odbc ldap snmp imap \ simplexml bz2 calendar ctype exif ftp gettext gmp iconv \ sockets tokenizer opcache \ pdo \ -%if %{with_zip} +%if %{with zip} zip \ %endif sqlite3 \ @@ -1791,10 +1792,10 @@ for mod in pgsql odbc ldap snmp imap \ sodium \ posix shmop sysvshm sysvsem sysvmsg xml \ pdo_mysql pdo_pgsql pdo_odbc pdo_sqlite pdo_dblib \ -%if %{with_oci8} +%if %{with oci8} oci8 pdo_oci \ %endif -%if %{with_firebird} +%if %{with firebird} pdo_firebird \ %endif xmlreader xmlwriter @@ -1819,7 +1820,7 @@ do # some extensions have their own config file if [ -f ${ini} ]; then cp -p ${ini} $RPM_BUILD_ROOT%{_sysconfdir}/php.d/${ini} - %if %{with_zts} + %if %{with zts} cp -p ${ini} $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/${ini} %endif else @@ -1827,7 +1828,7 @@ do ; Enable ${mod} extension module extension=${mod} EOF -%if %{with_zts} +%if %{with zts} cat > $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/${ini} < files.${mod} <> files.pgsql cat files.pdo_odbc >> files.odbc -%if %{with_oci8} +%if %{with oci8} cat files.pdo_oci >> files.oci8 %endif @@ -1876,7 +1877,7 @@ cat files.curl files.phar files.fileinfo \ # The default Zend OPcache blacklist file install -m 644 %{SOURCE51} $RPM_BUILD_ROOT%{_sysconfdir}/php.d/opcache-default.blacklist -%if %{with_zts} +%if %{with zts} install -m 644 %{SOURCE51} $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/opcache-default.blacklist sed -e '/blacklist_filename/s/php.d/php-zts.d/' \ -i $RPM_BUILD_ROOT%{_sysconfdir}/php-zts.d/10-opcache.ini @@ -1887,7 +1888,7 @@ sed -e "s/@PHP_APIVER@/%{apiver}-%{__isa_bits}/" \ -e "s/@PHP_ZENDVER@/%{zendver}-%{__isa_bits}/" \ -e "s/@PHP_PDOVER@/%{pdover}-%{__isa_bits}/" \ -e "s/@PHP_VERSION@/%{upver}/" \ -%if ! %{with_zts} +%if %{without zts} -e "/zts/d" \ %endif < %{SOURCE3} > macros.php @@ -1974,9 +1975,6 @@ fi %files %{_httpd_moddir}/libphp.so -%if %{with_zts} -%{_httpd_moddir}/libphp-zts.so -%endif %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/session %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/wsdlcache %attr(0770,root,apache) %dir %{_localstatedir}/lib/php/opcache @@ -1993,7 +1991,7 @@ fi %dir %{_sysconfdir}/php.d %dir %{_libdir}/php %dir %{_libdir}/php/modules -%if %{with_zts} +%if %{with zts} %dir %{_sysconfdir}/php-zts.d %dir %{_libdir}/php-zts %dir %{_libdir}/php-zts/modules @@ -2019,7 +2017,7 @@ fi %{_mandir}/man1/phar.1* %{_mandir}/man1/phar.phar.1* %{_mandir}/man1/phpize.1* -%if %{with_zts} +%if %{with zts} %{_bindir}/zts-php %{_mandir}/man1/zts-php.1* %{_mandir}/man1/zts-phpize.1* @@ -2028,7 +2026,7 @@ fi %files dbg %{_bindir}/phpdbg %{_mandir}/man1/phpdbg.1* -%if %{with_zts} +%if %{with zts} %{_bindir}/zts-phpdbg %{_mandir}/man1/zts-phpdbg.1* %endif @@ -2070,7 +2068,7 @@ fi %dir %{_datadir}/fpm %{_datadir}/fpm/status.html -%if %{with_lsws} +%if %{with lsws} %files litespeed %{_bindir}/lsphp %endif @@ -2079,14 +2077,14 @@ fi %{_bindir}/php-config %{_includedir}/php %{_libdir}/php/build -%if %{with_zts} +%if %{with zts} %{_bindir}/zts-php-config %{_includedir}/php-zts %{_bindir}/zts-phpize %{_libdir}/php-zts/build +%{_mandir}/man1/zts-php-config.1* %endif %{_mandir}/man1/php-config.1* -%{_mandir}/man1/zts-php-config.1* %{macrosdir}/macros.php %files embedded @@ -2113,20 +2111,20 @@ fi %files pspell -f files.pspell %files intl -f files.intl %files process -f files.process -%if %{with_firebird} +%if %{with firebird} %files pdo-firebird -f files.pdo_firebird %endif %files enchant -f files.enchant %files mysqlnd -f files.mysqlnd %files opcache -f files.opcache %config(noreplace) %{_sysconfdir}/php.d/opcache-default.blacklist -%if %{with_zts} +%if %{with zts} %config(noreplace) %{_sysconfdir}/php-zts.d/opcache-default.blacklist %endif -%if %{with_oci8} +%if %{with oci8} %files oci8 -f files.oci8 %endif -%if %{with_zip} +%if %{with zip} %files zip -f files.zip %endif %files sodium -f files.sodium @@ -2135,6 +2133,13 @@ fi %changelog +* Thu Sep 17 2020 Remi Collet - 8.0.0~beta4-4 +- drop mod_php for ZTS (have never be suported) +- use %%bcond_without for dtrace, libgd, firebird, lsws, libpcre, zts + so can be disable during rebuild +- use %%bcond_with for libpcre, oci8, zip and debug + so can be enable during rebuild + * Thu Sep 17 2020 Remi Collet - 8.0.0~beta4-3 - properly use --enable-zts for ZTS builds @@ -2148,7 +2153,7 @@ fi - json is now build statically - use system nikic/php-parser if available to generate C headers from PHP stub -- switch from "runselftest" option to bcond_without tests +- switch from "runselftest" option to %bcond_without tests - enchant: use libenchant-2 instead of libenchant - rename 15-php.conf to 20-php.conf to ensure load order - oci8 version is now 3.0.0 -- cgit