summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-03-12 10:15:55 +0100
committerRemi Collet <fedora@famillecollet.com>2014-03-12 10:15:55 +0100
commit0317f8124ac5e55c35855b6910111c0e096b49e6 (patch)
treeea5bdf10682aae79b48a12d6fc6dd9f7372fd386
parent2971c1a0ba22a79b1b4ee81d13f22ce8efe54d27 (diff)
php-pecl-oauth: cleanups
-rw-r--r--php-pecl-oauth.spec77
1 files changed, 59 insertions, 18 deletions
diff --git a/php-pecl-oauth.spec b/php-pecl-oauth.spec
index 8b16d40..6cb1e0f 100644
--- a/php-pecl-oauth.spec
+++ b/php-pecl-oauth.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}
-%global pecl_name oauth
+%global pecl_name oauth
+%global with_zts 0%{?__ztsphp:1}
Name: php-pecl-oauth
Version: 1.2.3
-Release: 1%{?dist}.4
+Release: 4%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
Summary: PHP OAuth consumer extension
Group: Development/Languages
License: BSD
@@ -14,6 +17,7 @@ Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: php-devel
BuildRequires: php-pear
+BuildRequires: pcre-devel
# curl instead of libcurl for old release
BuildRequires: curl-devel
@@ -27,19 +31,24 @@ 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
+%if "%{php_version}" > "5.4"
# Other third party repo stuff
Obsoletes: php53-pecl-%{pecl_name}
Obsoletes: php53u-pecl-%{pecl_name}
-%if "%{php_version}" > "5.4"
Obsoletes: php54-pecl-%{pecl_name}
%endif
%if "%{php_version}" > "5.5"
Obsoletes: php55u-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
@@ -50,39 +59,62 @@ user names and passwords.
%prep
%setup -q -c
-cp -r %{pecl_name}-%{version} %{pecl_name}-%{version}-zts
+mv %{pecl_name}-%{version} NTS
+
+# Sanity check, really often broken
+extver=$(sed -n '/#define PHP_OAUTH_VERSION/{s/.* //;s/".*$//;p}' NTS/php_oauth.h)
+if test "x${extver}" != "x%{version}"; then
+ : Error: Upstream extension version is ${extver}, expecting %{version}.
+ exit 1
+fi
cat >%{pecl_name}.ini << 'EOF'
; Enable %{pecl_name} extension module
extension=%{pecl_name}.so
EOF
+%if %{with_zts}
+# duplicate for ZTS build
+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
+%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 install -C %{pecl_name}-%{version} INSTALL_ROOT=%{buildroot}
-make install -C %{pecl_name}-%{version}-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_inidir}/%{pecl_name}.ini
-install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{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
+cd NTS
+for i in $(grep 'role="doc"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
+do install -Dpm 644 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+done
+
%clean
rm -rf %{buildroot}
@@ -99,28 +131,37 @@ fi
%check
+: Minimal load test for NTS extension
%{__php} -n \
- -d extension_dir=%{pecl_name}-%{version}/modules \
- -d extension=%{pecl_name}.so \
+ -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \
--modules | grep OAuth
+%if %{with_zts}
+: Minimal load test for ZTS extension
%{__ztsphp} -n \
- -d extension_dir=%{pecl_name}-%{version}-zts/modules \
- -d extension=%{pecl_name}.so \
+ -d extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \
--modules | grep OAuth
+%endif
%files
%defattr(-,root,root,-)
-%doc %{pecl_name}-%{version}/LICENSE %{pecl_name}-%{version}/examples
+%doc %{pecl_docdir}/%{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}
+%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%{php_ztsextdir}/%{pecl_name}.so
+%endif
+
%changelog
+* Wed Mar 12 2014 Remi Collet <remi@fedoraproject.org> - 1.2.3-4
+- cleanups
+- move doc in pecl_docdir
+
* Fri Nov 30 2012 Remi Collet <remi@fedoraproject.org> - 1.2.3-1.1
- also provides php-oauth