1 %define buildver %(pkg-config --silence-errors --modversion libsodium 2>/dev/null || echo 65536)
5 %bcond_without tests # build without tests
7 %define php_name php%{?php_suffix}
8 %define modname libsodium
9 Summary: Wrapper for the Sodium cryptographic library
10 Name: php-pecl-%{modname}
14 Group: Development/Languages
15 Source0: http://pecl.php.net/get/%{modname}-%{version}.tgz
16 # Source0-md5: b4083271f4fe0a94b8ae69320878a5e8
17 URL: http://pecl.php.net/package/libsodium
18 # See https://github.com/jedisct1/libsodium-php/pull/70
19 Patch0: %{modname}-pr70.patch
20 Patch1: tests-php53.patch
21 BuildRequires: %{php_name}-devel >= 4:5.3
22 BuildRequires: libsodium-devel >= 0.6.0
23 BuildRequires: pkgconfig
24 BuildRequires: rpmbuild(macros) >= 1.666
26 BuildRequires: %{php_name}-cli
27 BuildRequires: %{php_name}-json
29 Requires: libsodium >= %{buildver}
30 %{?requires_php_extension}
31 Provides: php(libsodium) = %{version}
32 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
35 A simple, low-level PHP extension for libsodium.
37 Documentation: https://paragonie.com/book/pecl-libsodium
41 mv %{modname}-%{version}/* .
46 # Sanity check, really often broken
47 extver=$(sed -n '/#define PHP_LIBSODIUM_VERSION/{s/.* "//;s/".*$//;p}' php_libsodium.h)
48 if test "x${extver}" != "x%{version}"; then
49 : Error: Upstream extension version is ${extver}, expecting %{version}.
61 -d extension_dir=modules \
62 -d extension=%{modname}.so \
64 grep %{modname} modules.log
67 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
69 PHP_EXECUTABLE=%{__php} \
70 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="json" \
74 rm -rf $RPM_BUILD_ROOT
76 EXTENSION_DIR=%{php_extensiondir} \
77 INSTALL_ROOT=$RPM_BUILD_ROOT
79 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
80 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
81 ; Enable %{modname} extension module
82 extension=%{modname}.so
86 rm -rf $RPM_BUILD_ROOT
89 %php_webserver_restart
93 %php_webserver_restart
97 %defattr(644,root,root,755)
98 %doc README.md LICENSE
99 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
100 %attr(755,root,root) %{php_extensiondir}/%{modname}.so