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