From 9692eb37e16adaad31df9f0fcae602cc08bec295 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 26 Oct 2013 18:50:19 +0200 Subject: php-pecl-txforward: 1.0.7 - New package, but broken --- php-pecl-txforward.spec | 177 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 php-pecl-txforward.spec (limited to 'php-pecl-txforward.spec') diff --git a/php-pecl-txforward.spec b/php-pecl-txforward.spec new file mode 100644 index 0000000..e4eaf3e --- /dev/null +++ b/php-pecl-txforward.spec @@ -0,0 +1,177 @@ +# spec file for php-pecl-txforward +# +# Copyright (c) 2013 Remi Collet +# License: CC-BY-SA +# http://creativecommons.org/licenses/by-sa/3.0/ +# +# Please, preserve the changelog entries +# +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} +%{!?__pecl: %global __pecl %{_bindir}/pecl} + +%global with_zts 0%{?__ztsphp:1} +%global pecl_name txforward + +Summary: Reverse Proxy PHP compatibility layer +Name: php-pecl-%{pecl_name} +Version: 1.0.7 +Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: PHP +Group: Development/Languages +URL: http://pecl.php.net/package/%{pecl_name} +Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz + +# https://bugs.php.net/65972 Please Provides LICENSE file +# Link from the headers +Source1: http://www.php.net/license/3_01.txt + +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: php-devel +BuildRequires: php-pear + +Requires(post): %{__pecl} +Requires(postun): %{__pecl} +Requires: php(zend-abi) = %{php_zend_api} +Requires: php(api) = %{php_core_api} + +Provides: php-%{pecl_name} = %{version} +Provides: php-%{pecl_name}%{?_isa} = %{version} +Provides: php-pecl(%{pecl_name}) = %{version} +Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} + +%if 0%{?fedora} < 20 +# Filter shared private +%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} +%{?filter_setup} +%endif + + +%description +Makes reverse-proxing (web accelerator) totally invisible for php +applications. Doesn't require php code modifications to handle +X-Forwarded-For IP. +* Stills allows proxy-aware applications to work with X-Forwarded headers + and proxy IP address. +* Should work with any web server +* Should work with any proxy server + +Using this extension with on a non reverse proxied system will result in +a security issue. + + +%prep +%setup -q -c + +cp %{SOURCE1} LICENSE +mv %{pecl_name}-%{version} NTS + +cd NTS +# Fix version +sed -e '/TXFORWARDING_VERSION/s/1.07/%{version}/' -i php_txforward.h + +# Sanity check, really often broken +extver=$(sed -n '/#define TXFORWARDING_VERSION/{s/.* "//;s/".*$//;p}' php_txforward.h) +if test "x${extver}" != "x%{version}"; then + : Error: Upstream extension version is ${extver}, expecting %{version}. + exit 1 +fi +cd .. + +%if %{with_zts} +# Duplicate source tree for NTS / ZTS build +cp -pr NTS ZTS +%endif + +# Create configuration file +cat << 'EOF' | tee %{pecl_name}.ini +; Enable '%{summary}' extension module +extension=%{pecl_name}.so +EOF + + +%build +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 +rm -rf %{buildroot} + +make -C NTS install INSTALL_ROOT=%{buildroot} + +# install config file +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini + +# Install XML package description +install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml + +%if %{with_zts} +make -C ZTS install INSTALL_ROOT=%{buildroot} + +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini +%endif + +# Documentation +install -Dpm 644 LICENSE %{buildroot}%{pecl_docdir}/%{pecl_name}/LICENSE +for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + + +%post +%{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : + + +%postun +if [ $1 -eq 0 ] ; then + %{pecl_uninstall} %{pecl_name} >/dev/null || : +fi + + +%check +cd NTS +: 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} +cd ../ZTS +: Minimal load test for ZTS extension +%{__ztsphp} --no-php-ini \ + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} +%endif + + +%clean +rm -rf %{buildroot} + + +%files +%defattr(-,root,root,-) +%doc %{pecl_docdir}/%{pecl_name} +%{pecl_xmldir}/%{name}.xml +%config(noreplace) %{php_inidir}/%{pecl_name}.ini +%{php_extdir}/%{pecl_name}.so + +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%{php_ztsextdir}/%{pecl_name}.so +%endif + + +%changelog +* Sat Oct 26 2013 Remi Collet - 1.0.7-1 +- initial package, version 1.0.7 (stable) -- cgit