summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-pecl-uuid.spec71
1 files changed, 57 insertions, 14 deletions
diff --git a/php-pecl-uuid.spec b/php-pecl-uuid.spec
index c22b2d2..1315d34 100644
--- a/php-pecl-uuid.spec
+++ b/php-pecl-uuid.spec
@@ -1,11 +1,22 @@
-%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+# spec file for php-pecl-uuid
+#
+# Copyright (c) 2012-2014 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}
+%{!?__php: %global __php %{_bindir}/php}
%global pecl_name uuid
+%global with_zts 0%{?__ztsphp:1}
Summary: Universally Unique Identifier extension for PHP
Name: php-pecl-uuid
Version: 1.0.3
-Release: 3%{?dist}.5
+Release: 7%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: LGPLv2+
Group: Development/Languages
URL: http://pecl.php.net/package/uuid
@@ -41,20 +52,26 @@ 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"
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
+%if "%{php_version}" > "5.6"
+Obsoletes: php56u-pecl-%{pecl_name}
+%endif
+%endif
-
-# Filter private shared
+%if 0%{?fedora} < 20
+# Filter private shared object
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
+%endif
%description
@@ -64,7 +81,8 @@ A wrapper around Universally Unique Identifier library (libuuid).
%prep
%setup -q -c
-cd %{pecl_name}-%{version}
+mv %{pecl_name}-%{version} NTS
+cd NTS
cp %{SOURCE1} LICENSE
%patch0 -p3 -b .ereg
@@ -79,8 +97,10 @@ if test "x${extver}" != "x%{version}"; then
fi
cd ..
+%if %{with_zts}
# duplicate for ZTS build
-cp -pr %{pecl_name}-%{version} %{pecl_name}-zts
+cp -pr NTS ZTS
+%endif
# Drop in the bit of configuration
cat > %{pecl_name}.ini << 'EOF'
@@ -92,33 +112,46 @@ EOF
%build
export PHP_RPATH=no
-cd %{pecl_name}-%{version}
+cd NTS
%{_bindir}/phpize
%configure --with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}
-cd ../%{pecl_name}-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}
# Install the NTS stuff
-make -C %{pecl_name}-%{version} install INSTALL_ROOT=%{buildroot}
+make -C NTS install INSTALL_ROOT=%{buildroot}
install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
+%if %{with_zts}
# Install the ZTS stuff
-make -C %{pecl_name}-zts install INSTALL_ROOT=%{buildroot}
+make -C ZTS install INSTALL_ROOT=%{buildroot}
install -D -m 644 %{pecl_name}.ini %{buildroot}%{php_ztsinidir}/%{pecl_name}.ini
+%endif
# Install the package XML file
install -D -m 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
+# Test & Documentation
+cd NTS
+for i in $(grep 'role="test"' ../package.xml | sed -e 's/^.*name="//;s/".*$//')
+do install -Dpm 644 $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 $i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
+done
+
%check
-cd %{pecl_name}-%{version}
+cd NTS
TEST_PHP_EXECUTABLE=%{_bindir}/php \
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
@@ -126,13 +159,15 @@ NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
%{_bindir}/php -n run-tests.php
-cd ../%{pecl_name}-zts
+%if %{with_zts}
+cd ../ZTS
TEST_PHP_EXECUTABLE=%{__ztsphp} \
TEST_PHP_ARGS="-n -d extension_dir=$PWD/modules -d extension=%{pecl_name}.so" \
NO_INTERACTION=1 \
REPORT_EXIT_STATUS=1 \
%{__ztsphp} -n run-tests.php
+%endif
%post
@@ -151,17 +186,25 @@ rm -rf %{buildroot}
%files
%defattr(-, root, root, 0755)
-%doc %{pecl_name}-%{version}/{CREDITS,LICENSE}
+%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}
%{php_ztsextdir}/%{pecl_name}.so
%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini
+%endif
%changelog
+* Fri Mar 14 2014 Remi Collet <remi@fedoraproject.org> - 1.0.3-7
+- cleanups
+- install doc in pecl_docdir
+- install tests in pecl_testdir
+
* Sat Nov 24 2012 Remi Collet <remi@fedoraproject.org> - 1.0.3-3
- add LICENSE from upstream SVN
- also provides php-uuid