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