]> git.pld-linux.org Git - packages/php-pecl-libsodium.git/blame - php-pecl-libsodium.spec
up to 1.0.6
[packages/php-pecl-libsodium.git] / php-pecl-libsodium.spec
CommitLineData
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
9Summary: Wrapper for the Sodium cryptographic library
ce01d2b9
ER
10Name: %{php_name}-pecl-%{modname}
11Version: 1.0.6
9ce6e03e
ER
12Release: 1
13License: BSD
14Group: Development/Languages
15Source0: http://pecl.php.net/get/%{modname}-%{version}.tgz
ce01d2b9 16# Source0-md5: ad76fd81a44a7122dae9683ca18f3be6
9ce6e03e 17URL: http://pecl.php.net/package/libsodium
9ce6e03e
ER
18BuildRequires: %{php_name}-devel >= 4:5.3
19BuildRequires: libsodium-devel >= 0.6.0
20BuildRequires: pkgconfig
21BuildRequires: rpmbuild(macros) >= 1.666
22%if %{with tests}
23BuildRequires: %{php_name}-cli
24BuildRequires: %{php_name}-json
25%endif
26Requires: libsodium >= %{buildver}
27%{?requires_php_extension}
28Provides: php(libsodium) = %{version}
29BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31%description
32A simple, low-level PHP extension for libsodium.
33
34Documentation: https://paragonie.com/book/pecl-libsodium
35
36%prep
37%setup -qc
38mv %{modname}-%{version}/* .
39
ce01d2b9 40%build
9ce6e03e
ER
41# Sanity check, really often broken
42extver=$(sed -n '/#define PHP_LIBSODIUM_VERSION/{s/.* "//;s/".*$//;p}' php_libsodium.h)
43if test "x${extver}" != "x%{version}"; then
44 : Error: Upstream extension version is ${extver}, expecting %{version}.
45 exit 1
46fi
47
9ce6e03e
ER
48phpize
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
58grep %{modname} modules.log
59
60: Upstream test suite
61export 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
68rm -rf $RPM_BUILD_ROOT
69%{__make} install \
70 EXTENSION_DIR=%{php_extensiondir} \
71 INSTALL_ROOT=$RPM_BUILD_ROOT
72
73install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
74cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
75; Enable %{modname} extension module
76extension=%{modname}.so
77EOF
78
79%clean
80rm -rf $RPM_BUILD_ROOT
81
82%post
83%php_webserver_restart
84
85%postun
86if [ "$1" = 0 ]; then
87 %php_webserver_restart
88fi
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.137297 seconds and 4 git commands to generate.