summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-09-21 17:03:50 +0200
committerRemi Collet <remi@remirepo.net>2020-09-21 17:03:50 +0200
commitabc14e1387b3471c13807d1663a7928a0932e322 (patch)
tree01d6974fbe4f91cfb63850a73797774bb65a1f7c
New package
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--PHPINFO11
-rw-r--r--REFFLECTION12
-rw-r--r--php-realpath-turbo.spec184
5 files changed, 220 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/PHPINFO b/PHPINFO
new file mode 100644
index 0000000..297bd41
--- /dev/null
+++ b/PHPINFO
@@ -0,0 +1,11 @@
+
+realpath_turbo
+
+realpath_turbo support => enabled
+Version => 2.0.0
+Build Date => Sep 21 2020 16:39:39
+Creator => Artur Graniszewski
+
+Directive => Local Value => Master Value
+realpath_turbo.open_basedir => no value => no value
+realpath_turbo.disable_dangerous_functions => On => On
diff --git a/REFFLECTION b/REFFLECTION
new file mode 100644
index 0000000..56337d2
--- /dev/null
+++ b/REFFLECTION
@@ -0,0 +1,12 @@
+Extension [ <persistent> extension #16 realpath_turbo version 2.0.0 ] {
+
+ - INI {
+ Entry [ realpath_turbo.open_basedir <SYSTEM> ]
+ Current = ''
+ }
+ Entry [ realpath_turbo.disable_dangerous_functions <SYSTEM> ]
+ Current = '1'
+ }
+ }
+}
+
diff --git a/php-realpath-turbo.spec b/php-realpath-turbo.spec
new file mode 100644
index 0000000..f514ecf
--- /dev/null
+++ b/php-realpath-turbo.spec
@@ -0,0 +1,184 @@
+# remirepo spec file for php-realpath-turbo
+#
+# Copyright (c) 2020 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+%if 0%{?scl:1}
+%scl_package php-realpath-turbo
+%endif
+
+%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
+
+Name: %{?scl_prefix}php-%{pack_name}
+Version: 2.0.0
+Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+
+Summary: Use realpath cache despite open_basedir restriction
+
+License: BSD
+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
+
+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}}
+
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1}
+# Other third party repo stuff
+%if "%{php_version}" > "7.3"
+Obsoletes: php73-%{pack_name} <= %{version}
+%endif
+%if "%{php_version}" > "7.4"
+Obsoletes: php74-%{pack_name} <= %{version}
+%endif
+%if "%{php_version}" > "8.0"
+Obsoletes: php80-%{pack_name} <= %{version}
+%endif
+%endif
+
+%if 0%{?fedora} < 20 && 0%{?rhel} < 7
+# Filter private shared
+%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
+%{?filter_setup}
+%endif
+
+
+%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
+mv %{gh_project}-%{gh_commit} NTS
+
+cd NTS
+# 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
+
+
+%if %{with_zts}
+# Duplicate source tree for NTS / ZTS build
+cp -pr NTS ZTS
+%endif
+
+
+%build
+%{?dtsenable}
+
+cd NTS
+%{_bindir}/phpize
+%configure --with-php-config=%{_bindir}/php-config
+make %{?_smp_mflags}
+
+%if %{with_zts}
+cd ../ZTS
+%{_bindir}/zts-phpize
+%configure --with-php-config=%{_bindir}/zts-php-config
+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 NTS
+: Upstream test suite for NTS extension
+TEST_PHP_EXECUTABLE=%{__php} \
+TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+%{__php} -n run-tests.php --show-diff || ret=1
+
+%if %{with_zts}
+cd ../ZTS
+: Upstream test suite for ZTS extension
+TEST_PHP_EXECUTABLE=%{__ztsphp} \
+TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so" \
+NO_INTERACTION=1 \
+REPORT_EXIT_STATUS=1 \
+%{__ztsphp} -n run-tests.php --show-diff || ret=1
+%endif
+
+exit $ret
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license NTS/LICENSE
+%doc NTS/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
+* Mon Sep 21 2020 Remi Collet <remi@remirepo.net> - 2.0.0-1
+- Initial packaging