summaryrefslogtreecommitdiffstats
path: root/php-pecl-ncurses.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-pecl-ncurses.spec')
-rw-r--r--php-pecl-ncurses.spec78
1 files changed, 60 insertions, 18 deletions
diff --git a/php-pecl-ncurses.spec b/php-pecl-ncurses.spec
index 4d37447..cefeaa3 100644
--- a/php-pecl-ncurses.spec
+++ b/php-pecl-ncurses.spec
@@ -1,19 +1,31 @@
-%{!?__pecl: %{expand: %%global __pecl %{_bindir}/pecl}}
+# spec file for php-pecl-ncurses
+#
+# Copyright (c) 2007-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 ncurses
+%global with_zts 0%{?__ztsphp:1}
Summary: Terminal screen handling and optimization package
Name: php-pecl-ncurses
Version: 1.0.2
-Release: 1%{?dist}.5
+Release: 5%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: PHP
Group: Development/Languages
URL: http://pecl.php.net/package/ncurses
Source: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz
-Source2: xml2changelog
# https://bugs.php.net/65862 - Please Provides LICENSE file
+# URL from ncurses.c
+Source1: http://www.php.net/license/3_01.txt
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: php-devel
@@ -41,10 +53,15 @@ 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
-# Filter private shared
+%if 0%{?fedora} < 20
+# Filter shared private
%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
%{?filter_setup}
+%endif
%description
@@ -60,49 +77,64 @@ line.
%prep
%setup -c -q
-%{_bindir}/php %{SOURCE2} package.xml >CHANGELOG
cat >%{pecl_name}.ini << 'EOF'
; Enable %{pecl_name} extension module
extension=%{pecl_name}.so
EOF
-cp -pr %{pecl_name}-%{version} %{pecl_name}-%{version}-zts
+mv %{pecl_name}-%{version} NTS
+
+cp %{SOURCE1} NTS/LICENSE
+
+%if %{with_zts}
+cp -r NTS ZTS
+%endif
%build
-cd %{pecl_name}-%{version}
+cd NTS
%{_bindir}/phpize
%configure --enable-ncursesw \
--with-php-config=%{_bindir}/php-config
make %{?_smp_mflags}
-cd ../%{pecl_name}-%{version}-zts
+%if %{with_zts}
+cd ../ZTS
%{_bindir}/zts-phpize
%configure --enable-ncursesw \
--with-php-config=%{_bindir}/zts-php-config
make %{?_smp_mflags}
+%endif
%install
rm -rf %{buildroot}
-make -C %{pecl_name}-%{version} \
- install INSTALL_ROOT=%{buildroot}
-
-make -C %{pecl_name}-%{version}-zts \
- install INSTALL_ROOT=%{buildroot}
+make -C NTS install INSTALL_ROOT=%{buildroot}
# Install XML package description
install -Dpm 644 package.xml %{buildroot}%{pecl_xmldir}/%{name}.xml
# install config file
install -Dpm 644 %{pecl_name}.ini %{buildroot}%{php_inidir}/%{pecl_name}.ini
+
+%if %{with_zts}
+make -C ZTS install INSTALL_ROOT=%{buildroot}
install -Dpm 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 LICENSE $(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}
+cd NTS
TEST_PHP_EXECUTABLE=%{__php} \
REPORT_EXIT_STATUS=1 \
@@ -112,7 +144,8 @@ NO_INTERACTION=1 \
-d extension_dir=modules \
-d extension=%{pecl_name}.so \
-cd ../%{pecl_name}-%{version}-zts
+%if %{with_zts}
+cd ../ZTS
TEST_PHP_EXECUTABLE=%{__ztsphp} \
REPORT_EXIT_STATUS=1 \
@@ -121,6 +154,7 @@ NO_INTERACTION=1 \
-n -q \
-d extension_dir=modules \
-d extension=%{pecl_name}.so \
+%endif
%clean
@@ -139,15 +173,23 @@ fi
%files
%defattr(-, root, root, -)
-%doc CHANGELOG %{pecl_name}-%{version}/{CREDITS,example1.php}
+%doc %{pecl_docdir}/%{pecl_name}
+%doc %{pecl_testdir}/%{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
+* Sat Mar 8 2014 Remi Collet <remi@fedoraproject.org> - 1.0.2-2
+- cleanups
+- install doc in pecl_docdir
+- install tests in pecl_testdir
+
* Fri Nov 30 2012 Remi Collet <remi@fedoraproject.org> - 1.0.2-1.1
- rebuild