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