]>
Commit | Line | Data |
---|---|---|
228ceb1c ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define php_name php%{?php_suffix} | |
6 | %define modname ds | |
7 | Summary: Data Structures | |
8 | Name: %{php_name}-pecl-%{modname} | |
9 | Version: 1.2.8 | |
9f82ebde | 10 | Release: 4 |
228ceb1c ER |
11 | License: MIT |
12 | Group: Development/Languages/PHP | |
13 | Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz | |
14 | # Source0-md5: be49f6819ff5049cd623a008243da999 | |
15 | URL: https://pecl.php.net/package/ds/ | |
16 | BuildRequires: %{php_name}-cli | |
17 | BuildRequires: %{php_name}-devel >= 4:7.0 | |
18 | BuildRequires: %{php_name}-json | |
cb52586e | 19 | BuildRequires: %{php_name}-pcre |
228ceb1c ER |
20 | BuildRequires: %{php_name}-spl |
21 | BuildRequires: rpmbuild(macros) >= 1.666 | |
22 | %if %{with tests} | |
23 | %endif | |
24 | %{?requires_php_extension} | |
25 | Requires: %{php_name}-json | |
26 | Requires: %{php_name}-spl | |
27 | Provides: php(%{modname}) = %{version} | |
28 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
29 | ||
30 | %description | |
31 | Data Structures for PHP 7. | |
32 | ||
33 | %prep | |
34 | %setup -qc | |
35 | mv %{modname}-%{version}/* . | |
36 | ||
37 | cat <<'EOF' > run-tests.sh | |
38 | #!/bin/sh | |
39 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
40 | exec %{__make} test \ | |
41 | PHP_EXECUTABLE=%{__php} \ | |
cb52586e | 42 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="pcre spl json" \ |
228ceb1c ER |
43 | RUN_TESTS_SETTINGS="-q $*" |
44 | EOF | |
45 | chmod +x run-tests.sh | |
46 | ||
47 | %build | |
48 | phpize | |
49 | %configure | |
50 | %{__make} | |
51 | ||
52 | # simple module load test | |
53 | %{__php} -n -q \ | |
54 | -d extension_dir=modules \ | |
cb52586e | 55 | -d extension=%{php_extensiondir}/pcre.so \ |
228ceb1c ER |
56 | -d extension=%{php_extensiondir}/spl.so \ |
57 | -d extension=%{php_extensiondir}/json.so \ | |
58 | -d extension=%{modname}.so \ | |
59 | -m > modules.log | |
60 | grep %{modname} modules.log | |
61 | ||
62 | %if %{with tests} | |
63 | ./run-tests.sh --show-diff | |
64 | %endif | |
65 | ||
66 | %install | |
67 | rm -rf $RPM_BUILD_ROOT | |
68 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
69 | install -d $RPM_BUILD_ROOT{%{php_sysconfdir}/conf.d,%{php_extensiondir}} | |
70 | ||
71 | %{__make} install \ | |
72 | EXTENSION_DIR=%{php_extensiondir} \ | |
73 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
74 | ||
75 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
438d3855 | 76 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/json_%{modname}.ini |
228ceb1c ER |
77 | ; Enable %{modname} extension module |
78 | extension=%{modname}.so | |
79 | EOF | |
80 | ||
81 | %clean | |
82 | rm -rf $RPM_BUILD_ROOT | |
83 | ||
84 | %post | |
85 | %php_webserver_restart | |
86 | ||
87 | %postun | |
88 | if [ "$1" = 0 ]; then | |
89 | %php_webserver_restart | |
90 | fi | |
91 | ||
92 | %files | |
93 | %defattr(644,root,root,755) | |
94 | %doc LICENSE | |
438d3855 | 95 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/*%{modname}.ini |
228ceb1c | 96 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so |