summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-03-17 09:33:05 +0100
committerRemi Collet <fedora@famillecollet.com>2014-03-17 09:33:05 +0100
commit48d2d7720cf6e9e170bb3ac1679b2591d253aed7 (patch)
tree13d9be7e7ec587b53025dfa83cabe1c98ce78f19
parent6336cb708187f744e01ab7a9ef5be48fa9ce0f19 (diff)
php-pecl-gnupg: cleanups, doc in pecl_docdir, zts optional
-rw-r--r--php-pecl-gnupg.spec100
-rw-r--r--vars.inc38
2 files changed, 72 insertions, 66 deletions
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 <remi@fedoraproject.org> - 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 <remi@fedoraproject.org> - 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 @@
-<?php
-putenv("GNUPGHOME=".dirname(__FILE__));
-error_reporting (E_ALL);
-$fingerprint = "64DF06E42FCF2094590CDEEE2E96F141B3DD2B2E";
-$passphrase = "blabla";
-
-$plaintext = "foo bar";
-
-$testkey =<<<EOF
------BEGIN PGP PRIVATE KEY BLOCK-----
-Version: GnuPG v1.4.3 (GNU/Linux)
-
-lQHhBENQAKwRBADpy828KU+0SuoetJTrJ5dR86PiO3CsH8K6QRP7wY82Eh/9NTJ3
-afRj0FN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