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