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