]> git.pld-linux.org Git - packages/php-pecl-zstd.git/blob - php-pecl-zstd.spec
6e5b82b1b291f9220db0321cc5824f9e3842381f
[packages/php-pecl-zstd.git] / php-pecl-zstd.spec
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
19 BuildRequires:  zstd-devel
20 %if %{with tests}
21 BuildRequires:  %{php_name}-pcre
22 %endif
23 %{?requires_php_extension}
24 Provides:       php(%{modname}) = %{version}
25 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26
27 %description
28 PHP extension for compression and decompression with Zstandard
29 library.
30
31 %prep
32 %setup -qc
33 mv %{modname}-%{version}/* .
34 rm -r zstd
35
36 cat <<'EOF' > run-tests.sh
37 #!/bin/sh
38 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
39 exec %{__make} test \
40         PHP_EXECUTABLE=%{__php} \
41         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="" \
42         RUN_TESTS_SETTINGS="-q $*"
43 EOF
44 chmod +x run-tests.sh
45
46 %build
47 phpize
48 %configure \
49         --with-libzstd
50 %{__make}
51
52 # simple module load test
53 %{__php} -n -q \
54         -d extension_dir=modules \
55         -d extension=%{modname}.so \
56         -m > modules.log
57 grep %{modname} modules.log
58
59 %if %{with tests}
60 ./run-tests.sh --show-diff
61 %endif
62
63 %install
64 rm -rf $RPM_BUILD_ROOT
65 %{__make} install \
66         EXTENSION_DIR=%{php_extensiondir} \
67         INSTALL_ROOT=$RPM_BUILD_ROOT
68
69 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
70 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
71 ; Enable %{modname} extension module
72 extension=%{modname}.so
73 EOF
74
75 # no -devel yet
76 %{__rm} $RPM_BUILD_ROOT%{php_includedir}/ext/zstd/php_zstd.h
77
78 %clean
79 rm -rf $RPM_BUILD_ROOT
80
81 %post
82 %php_webserver_restart
83
84 %postun
85 if [ "$1" = 0 ]; then
86         %php_webserver_restart
87 fi
88
89 %files
90 %defattr(644,root,root,755)
91 %doc README.md
92 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
93 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.111787 seconds and 3 git commands to generate.