]> git.pld-linux.org Git - projects/template-specs.git/blob - php-pecl.spec
php: another version of tests run
[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:        http://pecl.php.net/get/%{modname}-%{version}.tgz
15 # Source0-md5:  -
16 URL:            http://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 %{?requires_php_extension}
21 Provides:       php(MODULE_NAME) = %{version}
22 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
23
24 %description
25
26 %description -l pl.UTF-8
27
28 %prep
29 %setup -qc
30 mv %{modname}-%{version}/* .
31
32 %build
33 phpize
34 %configure
35 %{__make}
36
37 %if %{with tests}
38 # simple module load test
39 %{__php} -n -q \
40         -d extension_dir=modules \
41         -d extension=%{modname}.so \
42         -m > modules.log
43 grep %{modname} modules.log
44
45 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
46 %{__make} test \
47         PHP_EXECUTABLE=%{__php}
48
49 # or:
50 cat <<'EOF' > run-tests.sh
51 #!/bin/sh
52 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
53 %{__make} test \
54         PHP_EXECUTABLE=%{__php} \
55         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl pdo session" \
56         RUN_TESTS_SETTINGS="-q $*"
57 EOF
58
59 chmod +x run-tests.sh
60 ./run-tests.sh -w failed.log
61 test -f failed.log -a ! -s failed.log
62 %endif
63
64 %install
65 rm -rf $RPM_BUILD_ROOT
66 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
67 install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir}}
68 install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}}
69
70 %{__make} install \
71         EXTENSION_DIR=%{php_extensiondir} \
72         INSTALL_ROOT=$RPM_BUILD_ROOT
73
74 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
75 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
76 ; Enable %{modname} extension module
77 extension=%{modname}.so
78 EOF
79
80 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
81 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
82
83 %clean
84 rm -rf $RPM_BUILD_ROOT
85
86 %post
87 %php_webserver_restart
88
89 %postun
90 if [ "$1" = 0 ]; then
91         %php_webserver_restart
92 fi
93
94 %files
95 %defattr(644,root,root,755)
96 %doc CREDITS EXPERIMENTAL
97 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
98 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
99 %{_examplesdir}/%{name}-%{version}
This page took 0.064498 seconds and 4 git commands to generate.