# remirepo spec file for php-pecl-mysqlnd-ngen # # Copyright (c) 2021 Remi Collet # License: CC-BY-SA # 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 %if 0%{?scl:1} %global sub_prefix %{scl_prefix} %scl_package php-pecl-mysqlnd-ngen %endif %global mysql_sock %(mysql_config --socket 2>/dev/null || echo /var/lib/mysql/mysql.sock) %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global pecl_name mysqlnd_ngen %global upstream_version 8.0.25 %global upstream_verid 80025 #global upstream_prever RC Summary: Extended version of mysqlnd,mysqli and pdo Name: %{?sub_prefix}php-pecl-mysqlnd-ngen Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: PHP URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz Patch0: %{pecl_name}-fix.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 8 BuildRequires: %{?scl_prefix}php-pdo BuildRequires: %{?scl_prefix}php-pear BuildRequires: pkgconfig(libsasl2) BuildRequires: pkgconfig(zlib) BuildRequires: pkgconfig(krb5) Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-mysqlnd%{?_isa} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} Conflicts: %{?scl_prefix}php-mysqlnd < %{version} Provides: %{?scl_prefix}php-mysqlnd = %{version} Provides: %{?scl_prefix}php-mysqlnd%{?_isa} = %{version} Provides: %{?scl_prefix}php-mysqli = %{version} Provides: %{?scl_prefix}php-mysqli%{?_isa} = %{version} Provides: %{?scl_prefix}php-pdo_mysql = %{version} Provides: %{?scl_prefix}php-pdo_mysql%{?_isa} = %{version} # Notice pecl_name != name 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}" > "8.0" Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif %endif %description This package is an enhanced version of mysqlnd, it includes PDO and Mysqli as well. The purpose of releasing this version of mysqlnd is to make available new features that can take longer to be rolled out to the official php repo. Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. %prep %setup -qc mv %{pecl_name}-%{upstream_version}%{?upstream_prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -e '/providesextension>my/d' \ -i package.xml pushd NTS # Fix the build %patch0 -p1 -b .fix # Use proper headers sed -e 's:ext/mysqlnd/:../mysqlnd/:' -i */*.c */*.h # Use proper version sed -e 's:PHP_VERSION_ID:%{upstream_verid}:' \ -e 's:PHP_VERSION:"%{upstream_version}":' -i */*.h popd %if %{with_zts} # duplicate for ZTS build cp -pr NTS ZTS %endif # Create configuration files cat > mysqlnd.ini << 'EOF' ; Enable mysqlnd extension modules extension=mysqlnd.so ;mysqlnd.collect_statistics = 1 ;mysqlnd.collect_memory_statistics = 0 ;mysqlnd.debug = ;mysqlnd.trace_alloc = ;mysqlnd.net_cmd_buffer_size = 4096 ;mysqlnd.net_read_buffer_size = 32768 ;mysqlnd.net_read_timeout = 86400 ;mysqlnd.log_mask = 0 ;mysqlnd.mempool_default_size = 16000 ;mysqlnd.sha256_server_public_key = ;mysqlnd.fetch_data_copy = 0 EOF cat > pdo_mysql.ini << 'EOF' ; Enable pdo_mysql extension modules extension=pdo_mysql.so ; configuration ;pdo_mysql.default_socket = '/var/lib/mysql/mysql.sock' EOF cat > mysqli.ini << 'EOF' ; Enable mysqli extension modules extension=mysqli.so ;mysqli.max_links = -1 ;mysqli.max_persistent =1 ;mysqli.allow_persistent -1 ;mysqli.rollback_on_cached_plink = 0 ;mysqli.default_host = ;mysqli.default_user = ;mysqli.default_pw = ;mysqli.default_port = 3306 ;mysqli.default_socket = '/var/lib/mysql/mysql.sock' ;mysqli.reconnect = 0 ;mysqli.allow_local_infile = 0 EOF %build %{?dtsenable} pushd NTS pushd mysqlnd %{_bindir}/phpize %configure \ --enable-mysqlnd \ --enable-mysqlnd-compression-support \ --enable-mysqlnd-sasl-support \ --enable-mysqlnd-ldap-krb-support \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} popd pushd mysqli %{_bindir}/phpize %configure \ --with-mysqli \ --with-mysql-sock=%{mysql_sock} \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} popd pushd pdo_mysql %{_bindir}/phpize %configure \ --with-pdo-mysql \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} popd popd %if %{with_zts} pushd ZTS pushd mysqlnd %{_bindir}/phpize %configure \ --enable-mysqlnd \ --enable-mysqlnd-compression-support \ --enable-mysqlnd-sasl-support \ --enable-mysqlnd-ldap-krb-support \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} popd pushd mysqli %{_bindir}/phpize %configure \ --with-mysqli \ --with-mysql-sock=%{mysql_sock} \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} popd pushd pdo_mysql %{_bindir}/phpize %configure \ --with-pdo-mysql \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} popd popd %endif %install %{?dtsenable} # Install the NTS stuff make -C NTS/mysqlnd install INSTALL_ROOT=%{buildroot} make -C NTS/mysqli install INSTALL_ROOT=%{buildroot} make -C NTS/pdo_mysql install INSTALL_ROOT=%{buildroot} install -D -m 644 mysqlnd.ini %{buildroot}%{php_inidir}/20-mysqlnd.ini install -D -m 644 mysqli.ini %{buildroot}%{php_inidir}/30-mysqli.ini install -D -m 644 pdo_mysql.ini %{buildroot}%{php_inidir}/30-pdo_mysql.ini # Install XML package description install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml # Install the ZTS stuff %if %{with_zts} make -C ZTS/mysqlnd install INSTALL_ROOT=%{buildroot} make -C ZTS/mysqli install INSTALL_ROOT=%{buildroot} make -C ZTS/pdo_mysql install INSTALL_ROOT=%{buildroot} install -D -m 644 mysqlnd.ini %{buildroot}%{php_ztsinidir}/20-mysqlnd.ini install -D -m 644 mysqli.ini %{buildroot}%{php_ztsinidir}/30-mysqli.ini install -D -m 644 pdo_mysql.ini %{buildroot}%{php_ztsinidir}/30-pdo_mysql.ini %endif # Documentation for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') do [ -f NTS/$i ] && install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done %check : Minimal load test for NTS extensions %{_bindir}/php --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/mysqlnd.so \ --modules | grep '^mysqlnd$' %{_bindir}/php --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/mysqlnd.so \ --define extension=%{buildroot}%{php_extdir}/mysqli.so \ --modules | grep '^mysqli$' %{_bindir}/php --no-php-ini \ --define extension=pdo.so \ --define extension=%{buildroot}%{php_extdir}/mysqlnd.so \ --define extension=%{buildroot}%{php_extdir}/pdo_mysql.so \ --modules | grep '^pdo_mysql$' %if %{with_zts} : Minimal load test for ZTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/mysqlnd.so \ --modules | grep '^mysqlnd$' %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/mysqlnd.so \ --define extension=%{buildroot}%{php_ztsextdir}/mysqli.so \ --modules | grep '^mysqli$' %{__ztsphp} --no-php-ini \ --define extension=pdo.so \ --define extension=%{buildroot}%{php_ztsextdir}/mysqlnd.so \ --define extension=%{buildroot}%{php_ztsextdir}/pdo_mysql.so \ --modules | grep '^pdo_mysql$' %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.txt} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/*.ini %{php_extdir}/*.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/*.ini %{php_ztsextdir}/*.so %endif %changelog * Mon May 10 2021 Remi Collet - 8.0.25-1 - initial package, version 8.0.25