]> git.pld-linux.org Git - projects/template-specs.git/blob - php-pecl.spec
add tests
[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 -
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/modname/
17 %{?with_tests:BuildRequires:    %{php_name}-cli}
18 BuildRequires:  %{php_name}-devel
19 BuildRequires:  rpmbuild(macros) >= 1.666
20 %{?requires_php_extension}
21 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
22
23 %description
24
25 %description -l pl.UTF-8
26
27 %prep
28 %setup -qc
29 mv %{modname}-%{version}/* .
30
31 %build
32 phpize
33 %configure
34 %{__make}
35
36 %if %{with tests}
37 # simple module load test
38 %{__php} -n -q \
39         -d extension_dir=modules \
40         -d extension=%{modname}.so \
41         -m > modules.log
42 grep %{modname} modules.log
43
44 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
45 %{__make} test \
46         PHP_EXECUTABLE=%{__php}
47 %endif
48
49 %install
50 rm -rf $RPM_BUILD_ROOT
51 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
52 install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir}}
53 install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir},%{_examplesdir}/%{name}-%{version}}
54
55 %{__make} install \
56         EXTENSION_DIR=%{php_extensiondir} \
57         INSTALL_ROOT=$RPM_BUILD_ROOT
58
59 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
60 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
61 ; Enable %{modname} extension module
62 extension=%{modname}.so
63 EOF
64
65 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
66 cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
67
68 %clean
69 rm -rf $RPM_BUILD_ROOT
70
71 %post
72 %php_webserver_restart
73
74 %postun
75 if [ "$1" = 0 ]; then
76         %php_webserver_restart
77 fi
78
79 %files
80 %defattr(644,root,root,755)
81 %doc CREDITS EXPERIMENTAL
82 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
83 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
84 %{_examplesdir}/%{name}-%{version}
This page took 0.051554 seconds and 4 git commands to generate.