From 48d2d7720cf6e9e170bb3ac1679b2591d253aed7 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 17 Mar 2014 09:33:05 +0100 Subject: php-pecl-gnupg: cleanups, doc in pecl_docdir, zts optional --- php-pecl-gnupg.spec | 100 +++++++++++++++++++++++++++++++++++++--------------- vars.inc | 38 -------------------- 2 files changed, 72 insertions(+), 66 deletions(-) delete mode 100644 vars.inc diff --git a/php-pecl-gnupg.spec b/php-pecl-gnupg.spec index 4f216bb..4a26fdb 100644 --- a/php-pecl-gnupg.spec +++ b/php-pecl-gnupg.spec @@ -1,18 +1,22 @@ # spec file for php-pecl-gnupg # -# Copyright (c) 2013-2014 Remi Collet +# Copyright (c) 2012-2014 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/3.0/ # # Please, preserve the changelog entries # -%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} -%global pecl_name gnupg +%{!?php_inidir: %global php_inidir %{_sysconfdir}/php.d} +%{!?__pecl: %global __pecl %{_bindir}/pecl} +%{!?__php: %global __php %{_bindir}/php} + +%global pecl_name gnupg +%global with_zts 0%{?__ztsphp:1} Summary: Wrapper around the gpgme library Name: php-pecl-gnupg Version: 1.3.3 -Release: 1%{?dist}.1 +Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} License: BSD Group: Development/Languages @@ -42,6 +46,7 @@ Provides: php-%{pecl_name}%{?_isa} = %{version} Provides: php-pecl(%{pecl_name}) = %{version} Provides: php-pecl(%{pecl_name})%{?_isa} = %{version} +%if "%{?vendor}" == "Remi Collet" # Other third party repo stuff Obsoletes: php53-pecl-%{pecl_name} Obsoletes: php53u-pecl-%{pecl_name} @@ -49,10 +54,16 @@ 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 +%endif -# Filter private shared +%if 0%{?fedora} < 20 +# Filter shared private %{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$} %{?filter_setup} +%endif %description @@ -70,14 +81,10 @@ cat >%{pecl_name}.ini << 'EOF' extension=%{pecl_name}.so EOF -cd %{pecl_name}-%{version}/ +mv %{pecl_name}-%{version} NTS +cd NTS %patch0 -p3 -b .svn -%if 0%{?rhel} == 5 -# GnuPG seems to old -rm -f tests/gnupg_{oo,res}_listsignatures.phpt -%endif - # Check extension version extver=$(sed -n '/#define PHP_GNUPG_VERSION/{s/.* "//;s/".*$//;p}' php_gnupg.h) if test "x${extver}" != "x%{version}"; then @@ -86,45 +93,57 @@ if test "x${extver}" != "x%{version}"; then fi cd .. +%if %{with_zts} # Build ZTS extension if ZTS devel available (fedora >= 17) -cp -r %{pecl_name}-%{version} %{pecl_name}-zts +cp -r NTS ZTS +%endif %build export PHP_RPATH=no export CFLAGS="$RPM_OPT_FLAGS -D_FILE_OFFSET_BITS=64 -DGNUPG_PATH='\"/usr/bin/gpg\"'" -cd %{pecl_name}-%{version} +cd NTS %{_bindir}/phpize %configure \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/php-config make %{?_smp_mflags} -cd ../%{pecl_name}-zts +%if %{with_zts} +cd ../ZTS %{_bindir}/zts-phpize %configure \ --with-libdir=%{_lib} \ --with-php-config=%{_bindir}/zts-php-config make %{?_smp_mflags} +%endif %install rm -rf %{buildroot} -make install -C %{pecl_name}-%{version} \ - INSTALL_ROOT=%{buildroot} - -make install -C %{pecl_name}-zts \ - INSTALL_ROOT=%{buildroot} +make install -C NTS INSTALL_ROOT=%{buildroot} # Drop in the bit of configuration -install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini 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 install -C ZTS INSTALL_ROOT=%{buildroot} +install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini +%endif + +# 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 $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') +do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +done + %clean rm -rf %{buildroot} @@ -141,29 +160,45 @@ fi %check -cd %{pecl_name}-%{version} +sed -e 's:GnuPG v1.%d.%d (GNU/Linux):GnuPG v%s:' \ + -i ?TS/tests/gnupg_*_export.phpt +%if 0%{?rhel} == 5 +# GnuPG seems to old +rm -f ?TS/tests/gnupg_{oo,res}_listsignatures.phpt +%endif unset GPG_AGENT_INFO # ignore test result on EL-6 which only have gnupg2 -%if 0%{?rhel} == 6 +%if 0%{?rhel} >= 6 status=0 %else status=1 %endif -# run full test suite +cd NTS +: Check if build NTS extension can be loaded +%{__php} -n -q \ + -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +: Run upstream test suite for NTS extension TEST_PHP_EXECUTABLE=%{_bindir}/php \ REPORT_EXIT_STATUS=$status \ NO_INTERACTION=1 \ -php run-tests.php \ +%{__php} run-tests.php \ -n -q \ -d extension_dir=modules \ -d extension=%{pecl_name}.so -cd ../%{pecl_name}-zts +%if %{with_zts} +cd ../ZTS +: Check if build ZTS extension can be loaded +%{__php} -n -q \ + -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep %{pecl_name} -# run full test suite +: Run upstream test suite for ZTS extension TEST_PHP_EXECUTABLE=%{__ztsphp} \ REPORT_EXIT_STATUS=$status \ NO_INTERACTION=1 \ @@ -171,21 +206,31 @@ NO_INTERACTION=1 \ -n -q \ -d extension_dir=modules \ -d extension=%{pecl_name}.so +%endif %files %defattr(-, root, root, -) -%doc %{pecl_name}-%{version}/{LICENSE,README} +%doc %{pecl_docdir}/%{pecl_name} +%doc %{pecl_testdir}/%{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 +* Mon Mar 17 2014 Remi Collet - 1.3.3-2 +- cleanups +- make ZTS build optional +- install doc in pecl_docdir +- install tests in pecl_testdir + * Wed Jul 17 2013 Remi Collet - 1.3.3-1 - update to 1.3.3 @@ -208,4 +253,3 @@ NO_INTERACTION=1 \ https://bugs.php.net/60914 - bad version https://bugs.php.net/60915 - php 5.4 build fails https://bugs.php.net/60916 - force use of /usr/bin/gpg - diff --git a/vars.inc b/vars.inc deleted file mode 100644 index 1d4de35..0000000 --- a/vars.inc +++ /dev/null @@ -1,38 +0,0 @@ - -- cgit