]> git.pld-linux.org Git - packages/php-pecl-zstd.git/blob - php-pecl-zstd.spec
49666aa79a68b7aea576596ea1065c07a7170774
[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 EOF
68
69 %build
70 phpize
71 %configure \
72         --with-libzstd
73 %{__make}
74
75 # simple module load test
76 %{__php} -n -q \
77         -d extension_dir=modules \
78         -d extension=%{modname}.so \
79         -m > modules.log
80 grep %{modname} modules.log
81
82 %if %{with tests}
83 %{!?tests_online:SKIP_ONLINE_TESTS=1} \
84 ./run-tests.sh --show-diff
85 %endif
86
87 %install
88 rm -rf $RPM_BUILD_ROOT
89 %{__make} install \
90         EXTENSION_DIR=%{php_extensiondir} \
91         INSTALL_ROOT=$RPM_BUILD_ROOT
92
93 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
94 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
95 ; Enable %{modname} extension module
96 extension=%{modname}.so
97 EOF
98
99 # no -devel yet
100 %{__rm} $RPM_BUILD_ROOT%{php_includedir}/ext/zstd/php_zstd.h
101
102 %clean
103 rm -rf $RPM_BUILD_ROOT
104
105 %post
106 %php_webserver_restart
107
108 %postun
109 if [ "$1" = 0 ]; then
110         %php_webserver_restart
111 fi
112
113 %files
114 %defattr(644,root,root,755)
115 %doc README.md
116 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
117 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.091397 seconds and 2 git commands to generate.