From e0934fefa0a0313c7d69b72547217155400dcbc6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sun, 2 Mar 2014 14:22:23 +0100 Subject: php-pecl-geoip: cleanups --- 3_01.txt | 68 ++++++++++++++++++++++++++++++++++++++++++ php-pecl-geoip.spec | 86 ++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 133 insertions(+), 21 deletions(-) create mode 100644 3_01.txt diff --git a/3_01.txt b/3_01.txt new file mode 100644 index 0000000..6059c80 --- /dev/null +++ b/3_01.txt @@ -0,0 +1,68 @@ +-------------------------------------------------------------------- + The PHP License, version 3.01 +Copyright (c) 1999 - 2014 The PHP Group. All rights reserved. +-------------------------------------------------------------------- + +Redistribution and use in source and binary forms, with or without +modification, is permitted provided that the following conditions +are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. The name "PHP" must not be used to endorse or promote products + derived from this software without prior written permission. For + written permission, please contact group@php.net. + + 4. Products derived from this software may not be called "PHP", nor + may "PHP" appear in their name, without prior written permission + from group@php.net. You may indicate that your software works in + conjunction with PHP by saying "Foo for PHP" instead of calling + it "PHP Foo" or "phpfoo" + + 5. The PHP Group may publish revised and/or new versions of the + license from time to time. Each version will be given a + distinguishing version number. + Once covered code has been published under a particular version + of the license, you may always continue to use it under the terms + of that version. You may also choose to use such covered code + under the terms of any subsequent version of the license + published by the PHP Group. No one other than the PHP Group has + the right to modify the terms applicable to covered code created + under this License. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes PHP software, freely available from + ". + +THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND +ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP +DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------- + +This software consists of voluntary contributions made by many +individuals on behalf of the PHP Group. + +The PHP Group can be contacted via Email at group@php.net. + +For more information on the PHP Group and the PHP project, +please see . + +PHP includes the Zend Engine, freely available at +. diff --git a/php-pecl-geoip.spec b/php-pecl-geoip.spec index 4466bd1..56a028e 100644 --- a/php-pecl-geoip.spec +++ b/php-pecl-geoip.spec @@ -1,10 +1,13 @@ -%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} +%{!?__pecl: %global __pecl %{_bindir}/pecl} +%{!?__php: %global __php %{_bindir}/php} -%define pecl_name geoip +%define pecl_name geoip +%global with_zts 0%{?__ztsphp:1} Name: php-pecl-geoip Version: 1.0.8 -Release: 3%{?dist}.5 +Release: 6%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} Summary: Extension to map IP addresses to geographic places Group: Development/Languages License: PHP @@ -15,11 +18,13 @@ Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz Patch1: geoip-tests.patch # https://bugs.php.net/65859 - Please Provides LICENSE file +# URL from geopip.c header +Source1: http://www.php.net/license/3_01.txt BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: GeoIP-devel BuildRequires: php-devel -BuildRequires: php-pear >= 1:1.4.0 +BuildRequires: php-pear Requires: php(zend-abi) = %{php_zend_api} Requires: php(api) = %{php_core_api} @@ -40,10 +45,15 @@ Obsoletes: php54-pecl-%{pecl_name} %if "%{php_version}" > "5.5" Obsoletes: php55u-pecl-%{pecl_name} %endif +%if "%{php_version}" > "5.6" +Obsoletes: php56u-pecl-%{pecl_name} +%endif -# Filter private shared +%if 0%{?fedora} < 20 +# Filter shared private %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} +%endif %description @@ -56,14 +66,17 @@ database %prep %setup -c -q -extver=$(sed -n '/#define PHP_GEOIP_VERSION/{s/.* "//;s/".*$//;p}' %{pecl_name}-%{version}/php_geoip.h) +mv %{pecl_name}-%{version} NTS + +cd NTS +cp %{SOURCE1} LICENSE +%patch1 -p0 -b .tests + +extver=$(sed -n '/#define PHP_GEOIP_VERSION/{s/.* "//;s/".*$//;p}' php_geoip.h) if test "x${extver}" != "x%{version}"; then : Error: Upstream version is ${extver}, expecting %{version}. exit 1 fi - -cd %{pecl_name}-%{version} -%patch1 -p0 -b .tests cd .. cat > %{pecl_name}.ini << 'EOF' @@ -71,16 +84,18 @@ cat > %{pecl_name}.ini << 'EOF' extension=%{pecl_name}.so EOF -cp -pr %{pecl_name}-%{version} %{pecl_name}-%{version}-zts +%if %{with_zts} +cp -pr NTS ZTS +%endif %build -cd %{pecl_name}-%{version} +cd NTS %{_bindir}/phpize %configure --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} -cd ../%{pecl_name}-%{version}-zts +cd ../ZTS %{_bindir}/zts-phpize %configure --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} @@ -89,23 +104,42 @@ make %{?_smp_mflags} %install rm -rf %{buildroot} -make -C %{pecl_name}-%{version} \ - install INSTALL_ROOT=%{buildroot} +make -C NTS install INSTALL_ROOT=%{buildroot} -make -C %{pecl_name}-%{version}-zts \ - install INSTALL_ROOT=%{buildroot} +%if %{with_zts} +make -C ZTS install INSTALL_ROOT=%{buildroot} +install -Dpm644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini +%endif # Install XML package description install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml # install config file install -Dpm644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini -install -Dpm644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini + +# Test & Documentation +for i in $(grep 'role="test"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_testdir}/%{pecl_name}/$i +done +for i in LICENSE $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done %check -cd %{pecl_name}-%{version} +: Minimal load test for NTS extension +%{__php} -n \ + -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + -m | grep %{pecl_name} + +%if %{with_zts} +: Minimal load test for ZTS extension +%{__ztsphp} -n \ + -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + -m | grep %{pecl_name} +%endif +cd NTS TEST_PHP_EXECUTABLE=%{__php} \ REPORT_EXIT_STATUS=1 \ NO_INTERACTION=1 \ @@ -118,6 +152,7 @@ NO_INTERACTION=1 \ %clean rm -rf %{buildroot} + %post %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || : @@ -129,15 +164,24 @@ fi %files %defattr(-,root,root,-) -%doc %{pecl_name}-%{version}/{README,ChangeLog} +%doc %{pecl_docdir}/%{pecl_name} +%doc %{pecl_testdir}/%{pecl_name} %config(noreplace) %{php_inidir}/%{pecl_name}.ini -%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini %{php_extdir}/%{pecl_name}.so -%{php_ztsextdir}/%{pecl_name}.so %{pecl_xmldir}/%{name}.xml +%if %{with_zts} +%{php_ztsextdir}/%{pecl_name}.so +%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%endif %changelog +* Sun Mar 2 2014 Remi Collet - 1.0.8-6 +- cleaups +- install doc in pecl_docdir +- install tests in pecl_testdir +- add missing License file + * Fri Nov 30 2012 Remi Collet - 1.0.8-3.1 - also provides php-geoip -- cgit