]> git.pld-linux.org Git - packages/php-pecl-timecop.git/blame - php-pecl-timecop.spec
tests require pcre
[packages/php-pecl-timecop.git] / php-pecl-timecop.spec
CommitLineData
d5c5d3c0
ER
1#
2# Conditional build:
3%bcond_without tests # build without tests
4
5%define php_name php%{?php_suffix}
6%define modname timecop
7Summary: Time travel and freezing extension
8Name: %{php_name}-pecl-%{modname}
9Version: 1.2.8
10Release: 1
11License: MIT
12Group: Development/Languages
13Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz
14# Source0-md5: 35a5026fb16645b29b4e8ad88a0f558d
15Source1: %{modname}.ini
16URL: https://pecl.php.net/package/timecop/
17BuildRequires: %{php_name}-cli
18BuildRequires: %{php_name}-devel
19BuildRequires: rpmbuild(macros) >= 1.666
710385ce
ER
20%if %{with tests}
21BuildRequires: %{php_name}-pcre
22%endif
d5c5d3c0
ER
23%{?requires_php_extension}
24Provides: php(%{modname}) = %{version}
25BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
26
27%description
28A PHP extension providing "time travel" and "time freezing"
29capabilities, inspired by ruby timecop gem.
30
31%prep
32%setup -qc
33mv %{modname}-%{version}/* .
34
35%build
36# Sanity check, really often broken
37extver=$(sed -n '/#define PHP_TIMECOP_VERSION/{s/.* "//;s/".*$//;p}' php_timecop.h)
38if test "x${extver}" != "x%{version}"; then
39 : Error: Upstream extension version is ${extver}, expecting %{version}.
40 exit 1
41fi
42
43phpize
44%configure \
45 --with-libdir=%{_lib} \
46 --enable-timecop
47%{__make}
48
49# simple module load test
50%{__php} -n -q \
51 -d extension_dir=modules \
d5c5d3c0
ER
52 -d extension=%{modname}.so \
53 -m > modules.log
54grep %{modname} modules.log
55
56%if %{with tests}
57export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
58%{__make} test \
59 PHP_EXECUTABLE=%{__php} \
60 PHP_TEST_SHARED_SYSTEM_EXTENSIONS=""
61%endif
62
63%install
64rm -rf $RPM_BUILD_ROOT
65%{__make} install \
66 INSTALL_ROOT=$RPM_BUILD_ROOT
67
68install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
69cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
70
71%clean
72rm -rf $RPM_BUILD_ROOT
73
74%post
75%php_webserver_restart
76
77%postun
78if [ "$1" = 0 ]; then
79 %php_webserver_restart
80fi
81
82%files
83%defattr(644,root,root,755)
84%doc LICENSE
85%config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
86%attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.135992 seconds and 4 git commands to generate.