]>
Commit | Line | Data |
---|---|---|
260423e2 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define php_name php%{?php_suffix} | |
6 | %define modname zstd | |
7 | Summary: %{modname} - Zstandard extension | |
8 | Name: %{php_name}-pecl-%{modname} | |
9 | Version: 0.8.0 | |
10 | Release: 1 | |
11 | License: PHP 3.01 | |
12 | Group: Development/Languages/PHP | |
13 | Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz | |
14 | # Source0-md5: 6ca4a5f81a2acb47d9ae4fa1d2440434 | |
15 | URL: https://pecl.php.net/package/zstd/ | |
16 | BuildRequires: %{php_name}-cli | |
17 | BuildRequires: %{php_name}-devel | |
18 | BuildRequires: rpmbuild(macros) >= 1.666 | |
c66b7e56 | 19 | BuildRequires: zstd-devel |
36ee533e | 20 | %if %{with tests} |
b2a79601 | 21 | BuildRequires: %{php_name}-openssl |
36ee533e ER |
22 | BuildRequires: %{php_name}-pcre |
23 | %endif | |
260423e2 ER |
24 | %{?requires_php_extension} |
25 | Provides: php(%{modname}) = %{version} | |
26 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
27 | ||
28 | %description | |
29 | PHP extension for compression and decompression with Zstandard | |
30 | library. | |
31 | ||
32 | %prep | |
33 | %setup -qc | |
34 | mv %{modname}-%{version}/* . | |
c66b7e56 | 35 | rm -r zstd |
260423e2 | 36 | |
36ee533e ER |
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} \ | |
2c573e84 | 42 | PHP_TEST_SHARED_SYSTEM_EXTENSIONS="openssl" \ |
36ee533e ER |
43 | RUN_TESTS_SETTINGS="-q $*" |
44 | EOF | |
45 | chmod +x run-tests.sh | |
46 | ||
eaab609c ER |
47 | xfail() { |
48 | local t=$1 | |
49 | test -f $t | |
50 | cat >> $t <<-EOF | |
51 | ||
52 | --XFAIL-- | |
53 | Skip | |
54 | EOF | |
55 | } | |
56 | ||
57 | while read line; do | |
58 | t=${line##*\[}; t=${t%\]} | |
59 | xfail $t | |
60 | done << 'EOF' | |
61 | zstd_compress(): compress level [tests/008.phpt] | |
62 | EOF | |
63 | ||
260423e2 ER |
64 | %build |
65 | phpize | |
c66b7e56 ER |
66 | %configure \ |
67 | --with-libzstd | |
260423e2 ER |
68 | %{__make} |
69 | ||
70 | # simple module load test | |
71 | %{__php} -n -q \ | |
72 | -d extension_dir=modules \ | |
73 | -d extension=%{modname}.so \ | |
74 | -m > modules.log | |
75 | grep %{modname} modules.log | |
76 | ||
36ee533e ER |
77 | %if %{with tests} |
78 | ./run-tests.sh --show-diff | |
79 | %endif | |
80 | ||
260423e2 ER |
81 | %install |
82 | rm -rf $RPM_BUILD_ROOT | |
83 | %{__make} install \ | |
84 | EXTENSION_DIR=%{php_extensiondir} \ | |
85 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
86 | ||
87 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
88 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini | |
89 | ; Enable %{modname} extension module | |
90 | extension=%{modname}.so | |
91 | EOF | |
92 | ||
f13d7196 ER |
93 | # no -devel yet |
94 | %{__rm} $RPM_BUILD_ROOT%{php_includedir}/ext/zstd/php_zstd.h | |
95 | ||
260423e2 ER |
96 | %clean |
97 | rm -rf $RPM_BUILD_ROOT | |
98 | ||
99 | %post | |
100 | %php_webserver_restart | |
101 | ||
102 | %postun | |
103 | if [ "$1" = 0 ]; then | |
104 | %php_webserver_restart | |
105 | fi | |
106 | ||
107 | %files | |
108 | %defattr(644,root,root,755) | |
c66b7e56 | 109 | %doc README.md |
260423e2 ER |
110 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini |
111 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so |