]> git.pld-linux.org Git - projects/template-specs.git/blob - php-pecl.spec
3fff798a8bf93b27882ee1ad93ff99b541bfb79d
[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 %build
38 phpize
39 %configure
40 %{__make}
41
42 %if %{with tests}
43 # simple module load test
44 %{__php} -n -q \
45         -d extension_dir=modules \
46         -d extension=%{php_extensiondir}/spl.so \
47         -d extension=%{modname}.so \
48         -m > modules.log
49 grep %{modname} modules.log
50
51 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
52 %{__make} test \
53         PHP_EXECUTABLE=%{__php} \
54         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl" \
55
56 # or:
57 cat <<'EOF' > run-tests.sh
58 #!/bin/sh
59 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
60 exec %{__make} test \
61         PHP_EXECUTABLE=%{__php} \
62         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl pdo session" \
63         RUN_TESTS_SETTINGS="-q $*"
64 EOF
65 chmod +x run-tests.sh
66
67 ./run-tests.sh
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.040967 seconds and 2 git commands to generate.