diff options
Diffstat (limited to 'php-pecl-bbcode.spec')
-rw-r--r-- | php-pecl-bbcode.spec | 119 |
1 files changed, 98 insertions, 21 deletions
diff --git a/php-pecl-bbcode.spec b/php-pecl-bbcode.spec index 1f69cc8..70675bf 100644 --- a/php-pecl-bbcode.spec +++ b/php-pecl-bbcode.spec @@ -1,12 +1,23 @@ -%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}} - +# spec file for php-pecl-bbcode +# +# Copyright (c) 2011-2013 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 with_zts 0%{?__ztsphp:1} %global pecl_name bbcode %global pre b1 Summary: BBCode parsing Extension Name: php-pecl-bbcode Version: 1.0.3 -Release: 0.3.%{pre}%{?dist}.1 +Release: 0.4.%{pre}%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} # pecl extension is PHP, bbcode2 is BSD, bstrlib (from bstring) is BSD License: PHP and BSD Group: Development/Languages @@ -29,19 +40,20 @@ Provides: php-%{pecl_name} = %{version}%{?pre} Provides: php-%{pecl_name}%{?_isa} = %{version}%{?pre} # 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: php55-pecl-%{pecl_name} %endif - +%if 0%{?fedora} < 20 # Filter private shared object %{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$} %{?filter_setup} +%endif %description @@ -54,54 +66,107 @@ It will force closing BBCode tags in the good order, and closing terminating tags at the end of the string this is in order to ensure HTML Validity in all case. +Documentation: http://php.net/bbcode + %prep %setup -c -q -FIC=%{pecl_name}-%{version}%{?pre}/php_bbcode.h -sed -i -e '/PHP_BBCODE_VERSION/s/1.1.0-dev/1.0.3b1/' $FIC +mv %{pecl_name}-%{version}%{?pre} NTS -extver=$(sed -n '/#define PHP_BBCODE_VERSION/{s/.* "//;s/".*$//;p}' $FIC) +cd NTS +sed -i -e '/PHP_BBCODE_VERSION/s/1.1.0-dev/1.0.3b1/' php_bbcode.h + +extver=$(sed -n '/#define PHP_BBCODE_VERSION/{s/.* "//;s/".*$//;p}' php_bbcode.h) if test "x${extver}" != "x%{version}%{?pre}"; then : Error: Upstream extension version is ${extver}, expecting %{version}%{?pre}. exit 1 fi +cd .. cat > %{pecl_name}.ini << 'EOF' ; Enable %{pecl_name} extension module extension=%{pecl_name}.so EOF +%if %{with_zts} +# Duplicate source tree for NTS / ZTS build +cp -pr NTS ZTS +%endif + %build -cd %{pecl_name}-%{version}%{?pre} -phpize -%configure +cd NTS +%{_bindir}/phpize +%configure \ + --with-php-config=%{_bindir}/php-config +make %{?_smp_mflags} + +%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 -C %{pecl_name}-%{version}%{?pre} install INSTALL_ROOT=%{buildroot} +make -C NTS install INSTALL_ROOT=%{buildroot} # Drop in the bit of configuration -install -Dpm 644 %{pecl_name}.ini %{buildroot}%{_sysconfdir}/php.d/%{pecl_name}.ini +install -Dpm 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini # Install XML package description mkdir -p %{buildroot}%{pecl_xmldir} install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml +%if %{with_zts} +make -C ZTS install 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 + %check -cd %{pecl_name}-%{version}%{?pre} -php --no-php-ini \ - --define extension_dir=modules \ - --define extension=%{pecl_name}.so \ +cd NTS +: Minimal load test for NTS extension +%{__php} --no-php-ini \ + --define extension=modules/%{pecl_name}.so \ + --modules | grep %{pecl_name} + +: Upstream test suite for NTS extension +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__php} -n run-tests.php + + +%if %{with_zts} +: Minimal load test for ZTS extension +cd ../ZTS +%{__ztsphp} --no-php-ini \ + --define extension=modules/%{pecl_name}.so \ --modules | grep %{pecl_name} -make test NO_INTERACTION=1 | tee rpmtests.log -grep -q "FAILED TEST" rpmtests.log && exit 1 +: Upstream test suite for ZTS extension +TEST_PHP_EXECUTABLE=%{__ztsphp} \ +TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +NO_INTERACTION=1 \ +REPORT_EXIT_STATUS=1 \ +%{__ztsphp} -n run-tests.php +%endif %clean @@ -120,13 +185,25 @@ fi %files %defattr(-, root, root, -) -%doc %{pecl_name}-%{version}%{?pre}/{CREDITS,LICENSE} -%config(noreplace) %{_sysconfdir}/php.d/%{pecl_name}.ini +%doc %{pecl_testdir}/%{pecl_name} +%doc %{pecl_docdir}/%{pecl_name} +%config(noreplace) %{php_inidir}/%{pecl_name}.ini %{php_extdir}/%{pecl_name}.so %{pecl_xmldir}/%{name}.xml +%if %{with_zts} +%config(noreplace) %{php_ztsinidir}/%{pecl_name}.ini +%{php_ztsextdir}/%{pecl_name}.so +%endif + %changelog +* Sun Nov 3 2013 Remi Collet <remi@fedoraproject.org> - 1.0.3-0.4.b1 +- cleaups for Copr +- install doc in pecl doc_dir +- install tests in pecl test_dir +- build ZTS extension + * Thu Jan 24 2013 Remi Collet <remi@fedoraproject.org> - 1.0.3-0.3.b1 - also provides php-bbcode |