# remirepo spec file for php-realpath-turbo # # Copyright (c) 2020-2023 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # %{?scl:%scl_package php-realpath-turbo} %bcond_without tests %global pecl_name realpath_turbo %global pack_name realpath-turbo %global gh_commit 0ccf0765dc2e645dc0f78f61311066836573bcd5 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner Whissi %global gh_project %{pecl_name} %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %global ini_name 40-%{pecl_name}.ini %global sources %{gh_project}-%{gh_commit} %global _configure ../%{sources}/configure Name: %{?scl_prefix}php-%{pack_name} Version: 2.0.0 Release: 4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: Use realpath cache despite open_basedir restriction License: BSD-2-Clause URL: https://github.com/%{gh_owner}/%{gh_project} Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pack_name}-%{version}-%{gh_short}.tar.gz Patch0: %{pack_name}-tests.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-devel >= 5.6 BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} %{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} %description When PHP's open_basedir restriction is set, PHP disables the realpath cache for security reasons. This may hurt your application performance. The realpath_turbo PHP extension re-enables the realpath cache. Warning: This could be a security problem in your environment! Please read the README for further information. 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 -q -c cd %{sources} %patch -P0 -p1 -b .pr20 # Check extension version ver=$(sed -n '/define REALPATH_TURBO_VERSION/{s/.* "//;s/".*$//;p}' realpath_turbo.h) if test "$ver" != "%{version}%{?prever}%{?gh_date:-dev}"; then : Error: Upstream VERSION version is ${ver}, expecting %{version}%{?prever}%{?gh_date:-dev}. exit 1 fi cd .. cat << 'EOF' | tee %{ini_name} ; Enable %{pecl_name} extension module extension=%{pecl_name}.so ; Configuration ;realpath_turbo.open_basedir = '' ;realpath_turbo.disable_dangerous_functions = On EOF mkdir NTS %if %{with_zts} mkdir ZTS %endif %build %{?dtsenable} cd %{sources} %{__phpize} cd ../NTS %configure --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS %configure --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif %install %{?dtsenable} make -C NTS install INSTALL_ROOT=%{buildroot} # install configuration install -Dpm 644 %{ini_name} %{buildroot}%{php_inidir}/%{ini_name} %if %{with_zts} make -C ZTS install INSTALL_ROOT=%{buildroot} install -Dpm 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} %endif %check : Minimal load test for NTS extension %{__php} --no-php-ini \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' %if %{with_zts} : Minimal load test for NTS extension %{__ztsphp} --no-php-ini \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' %endif %if %{with tests} cd %{sources} : 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 \ %{__php} -n run-tests.php -q --show-diff || ret=1 %if %{with_zts} : Upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ %{__ztsphp} -n run-tests.php -q --show-diff || ret=1 %endif exit $ret %endif %files %{!?_licensedir:%global license %%doc} %license %{sources}/LICENSE %doc %{sources}/README.md %config(noreplace) %{php_inidir}/%{ini_name} %{php_extdir}/%{pecl_name}.so %if %{with_zts} %config(noreplace) %{php_ztsinidir}/%{ini_name} %{php_ztsextdir}/%{pecl_name}.so %endif %changelog * Fri Sep 1 2023 Remi Collet - 2.0.0-4 - build out of sources tree * Tue Sep 13 2022 Remi Collet - 2.0.0-3 - add patch for test suite with PHP 8.2 from https://github.com/Whissi/realpath_turbo/pull/20 * Wed Sep 30 2020 Remi Collet - 2.0.0-2 - rebuild for PHP 8.0.0RC1 * Mon Sep 21 2020 Remi Collet - 2.0.0-1 - Initial packaging - open https://github.com/Whissi/realpath_turbo/issues/18 realpath_turbo.disable_dangerous_functions doesn't work