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