]> git.pld-linux.org Git - packages/php-pecl-libsodium.git/blob - php-pecl-libsodium.spec
02ee6dd6a944bf86a059a0e1170da1a8b6530a67
[packages/php-pecl-libsodium.git] / php-pecl-libsodium.spec
1 #
2 # Conditional build:
3 %bcond_without  tests           # build without tests
4
5 %define buildver   %(pkg-config --silence-errors --modversion libsodium 2>/dev/null || echo 65536)
6
7 %define         php_name        php%{?php_suffix}
8 %define         modname libsodium
9 Summary:        Wrapper for the Sodium cryptographic library
10 Name:           %{php_name}-pecl-%{modname}
11 Version:        1.0.6
12 Release:        1
13 License:        BSD
14 Group:          Development/Languages
15 Source0:        http://pecl.php.net/get/%{modname}-%{version}.tgz
16 # Source0-md5:  ad76fd81a44a7122dae9683ca18f3be6
17 URL:            http://pecl.php.net/package/libsodium
18 BuildRequires:  %{php_name}-devel >= 4:5.3
19 BuildRequires:  libsodium-devel >= 0.6.0
20 BuildRequires:  pkgconfig
21 BuildRequires:  rpmbuild(macros) >= 1.666
22 %if %{with tests}
23 BuildRequires:  %{php_name}-cli
24 BuildRequires:  %{php_name}-json
25 %endif
26 Requires:       libsodium >= %{buildver}
27 %{?requires_php_extension}
28 Provides:       php(libsodium) = %{version}
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %description
32 A simple, low-level PHP extension for libsodium.
33
34 Documentation: https://paragonie.com/book/pecl-libsodium
35
36 %prep
37 %setup -qc
38 mv %{modname}-%{version}/* .
39
40 %build
41 # Sanity check, really often broken
42 extver=$(sed -n '/#define PHP_LIBSODIUM_VERSION/{s/.* "//;s/".*$//;p}' php_libsodium.h)
43 if test "x${extver}" != "x%{version}"; then
44         : Error: Upstream extension version is ${extver}, expecting %{version}.
45         exit 1
46 fi
47
48 phpize
49 %configure
50 %{__make}
51
52 %if %{with tests}
53 : Minimal load test
54 %{__php} -n \
55         -d extension_dir=modules \
56         -d extension=%{modname}.so \
57         -m > modules.log
58 grep %{modname} modules.log
59
60 : Upstream test suite
61 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
62 %{__make} test \
63         PHP_EXECUTABLE=%{__php} \
64         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="json" \
65 %endif
66
67 %install
68 rm -rf $RPM_BUILD_ROOT
69 %{__make} install \
70         EXTENSION_DIR=%{php_extensiondir} \
71         INSTALL_ROOT=$RPM_BUILD_ROOT
72
73 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
74 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
75 ; Enable %{modname} extension module
76 extension=%{modname}.so
77 EOF
78
79 %clean
80 rm -rf $RPM_BUILD_ROOT
81
82 %post
83 %php_webserver_restart
84
85 %postun
86 if [ "$1" = 0 ]; then
87         %php_webserver_restart
88 fi
89
90 %files
91 %defattr(644,root,root,755)
92 %doc README.md LICENSE
93 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
94 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.065328 seconds and 3 git commands to generate.