]> git.pld-linux.org Git - packages/php-pecl-zstd.git/blob - php-pecl-zstd.spec
XFAIL tests failing on x32
[packages/php-pecl-zstd.git] / php-pecl-zstd.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # build without tests
4 %bcond_without  tests_online    # build without online tests
5
6 %if 0%{?_pld_builder:1}
7 %undefine       with_tests_online
8 %endif
9
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
24 BuildRequires:  zstd-devel
25 %if %{with tests}
26 BuildRequires:  %{php_name}-openssl
27 BuildRequires:  %{php_name}-pcre
28 %endif
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}/* .
40 rm -r zstd
41
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} \
47         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="openssl" \
48         RUN_TESTS_SETTINGS="-q $*"
49 EOF
50 chmod +x run-tests.sh
51
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]
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
73 EOF
74
75 %build
76 phpize
77 %configure \
78         --with-libzstd
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
88 %if %{with tests}
89 %{!?tests_online:SKIP_ONLINE_TESTS=1} \
90 ./run-tests.sh --show-diff
91 %endif
92
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
105 # no -devel yet
106 %{__rm} $RPM_BUILD_ROOT%{php_includedir}/ext/zstd/php_zstd.h
107
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)
121 %doc README.md
122 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
123 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.103777 seconds and 3 git commands to generate.