]> git.pld-linux.org Git - projects/template-specs.git/blame - php-pecl.spec
pecl: add example how to make failed tests as XFAIL
[projects/template-specs.git] / php-pecl.spec
CommitLineData
fc1df23f
ER
1#
2# Conditional build:
3%bcond_without tests # build without tests
4
9ec83f18 5%define php_name php%{?php_suffix}
abe712a7 6%define modname MODULE_NAME
fc1df23f
ER
7Summary: %{modname} -
8Summary(pl.UTF-8): %{modname} -
9ec83f18 9Name: %{php_name}-pecl-%{modname}
a7223ec4
AG
10Version: 1.0
11Release: 1
4099af7d 12License: PHP 3.01
a7223ec4 13Group: Development/Languages/PHP
e80c7459 14Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
dc5e1efb 15# Source0-md5: -
e80c7459 16URL: https://pecl.php.net/package/MODULE_NAME/
512c7faf 17%{?with_tests:BuildRequires: %{php_name}-cli}
9ec83f18 18BuildRequires: %{php_name}-devel
3ad11c3e 19BuildRequires: rpmbuild(macros) >= 1.666
930a1dff
ER
20%if %{with tests}
21BuildRequires: %{php_name}-cli
22BuildRequires: %{php_name}-pcre
23%endif
672c5afc 24%{?requires_php_extension}
0ca2f24d 25Requires: %{php_name}-spl
7abd4293 26Provides: php(%{modname}) = %{version}
a7223ec4
AG
27BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
28
a7223ec4
AG
29%description
30
9be49f18 31%description -l pl.UTF-8
a7223ec4 32
a7223ec4 33%prep
05e722ff 34%setup -qc
fc1df23f 35mv %{modname}-%{version}/* .
a7223ec4 36
2f89de89
ER
37xfail() {
38 local t=$1
39 test -f $t
40 cat >> $t <<-EOF
41
42 --XFAIL--
43 Skip
44 EOF
45}
46
47# failed tests. investigate later
48while read line; do
49 t=${line##*\[}; t=${t%\]}
50 xfail $t
51done << 'EOF'
52Test for blowfish compatibility [tests/blowfish.phpt]
53Bug #8040 (MCRYPT_MODE_* do not seem to exist) [tests/bug8040.phpt]
54EOF
55
a7223ec4 56%build
a7223ec4
AG
57phpize
58%configure
59%{__make}
60
512c7faf
ER
61%if %{with tests}
62# simple module load test
63%{__php} -n -q \
64 -d extension_dir=modules \
82804f07 65 -d extension=%{php_extensiondir}/spl.so \
512c7faf
ER
66 -d extension=%{modname}.so \
67 -m > modules.log
68grep %{modname} modules.log
69
70export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
71%{__make} test \
bb69cd23
ER
72 PHP_EXECUTABLE=%{__php} \
73 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl" \
023d6644
ER
74
75# or:
76cat <<'EOF' > run-tests.sh
77#!/bin/sh
78export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
67c04377 79exec %{__make} test \
023d6644
ER
80 PHP_EXECUTABLE=%{__php} \
81 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl pdo session" \
82 RUN_TESTS_SETTINGS="-q $*"
83EOF
023d6644 84chmod +x run-tests.sh
67c04377
ER
85
86./run-tests.sh
512c7faf
ER
87%endif
88
a7223ec4
AG
89%install
90rm -rf $RPM_BUILD_ROOT
f6dd55ea 91install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
9c71ffdc
ER
92install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir}}
93install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}}
a7223ec4 94
852624ea 95%{__make} install \
0ec203b9
ER
96 EXTENSION_DIR=%{php_extensiondir} \
97 INSTALL_ROOT=$RPM_BUILD_ROOT
01c11931
ER
98
99install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
fc1df23f
ER
100cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
101; Enable %{modname} extension module
102extension=%{modname}.so
ceb2ba66 103EOF
a7223ec4 104
68c7fa4c 105install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
9c71ffdc
ER
106cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
107
a7223ec4
AG
108%clean
109rm -rf $RPM_BUILD_ROOT
110
111%post
6e284c47 112%php_webserver_restart
a7223ec4 113
ceb2ba66
AG
114%postun
115if [ "$1" = 0 ]; then
6e284c47 116 %php_webserver_restart
a7223ec4
AG
117fi
118
119%files
120%defattr(644,root,root,755)
f8cfa67b 121%doc CREDITS EXPERIMENTAL
fc1df23f
ER
122%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
123%attr(755,root,root) %{php_extensiondir}/%{modname}.so
9c71ffdc 124%{_examplesdir}/%{name}-%{version}
This page took 0.178241 seconds and 4 git commands to generate.