]>
Commit | Line | Data |
---|---|---|
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 | |
7 | Summary: Time travel and freezing extension | |
8 | Name: %{php_name}-pecl-%{modname} | |
9 | Version: 1.2.8 | |
10 | Release: 1 | |
11 | License: MIT | |
12 | Group: Development/Languages | |
13 | Source0: https://pecl.php.net/get/%{modname}-%{version}.tgz | |
14 | # Source0-md5: 35a5026fb16645b29b4e8ad88a0f558d | |
15 | Source1: %{modname}.ini | |
16 | URL: https://pecl.php.net/package/timecop/ | |
17 | BuildRequires: %{php_name}-cli | |
18 | BuildRequires: %{php_name}-devel | |
19 | BuildRequires: rpmbuild(macros) >= 1.666 | |
710385ce ER |
20 | %if %{with tests} |
21 | BuildRequires: %{php_name}-pcre | |
22 | %endif | |
d5c5d3c0 ER |
23 | %{?requires_php_extension} |
24 | Provides: php(%{modname}) = %{version} | |
25 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
26 | ||
27 | %description | |
28 | A PHP extension providing "time travel" and "time freezing" | |
29 | capabilities, inspired by ruby timecop gem. | |
30 | ||
31 | %prep | |
32 | %setup -qc | |
33 | mv %{modname}-%{version}/* . | |
34 | ||
35 | %build | |
36 | # Sanity check, really often broken | |
37 | extver=$(sed -n '/#define PHP_TIMECOP_VERSION/{s/.* "//;s/".*$//;p}' php_timecop.h) | |
38 | if test "x${extver}" != "x%{version}"; then | |
39 | : Error: Upstream extension version is ${extver}, expecting %{version}. | |
40 | exit 1 | |
41 | fi | |
42 | ||
43 | phpize | |
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 | |
54 | grep %{modname} modules.log | |
55 | ||
56 | %if %{with tests} | |
57 | export 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 | |
64 | rm -rf $RPM_BUILD_ROOT | |
65 | %{__make} install \ | |
66 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
67 | ||
68 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
69 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini | |
70 | ||
71 | %clean | |
72 | rm -rf $RPM_BUILD_ROOT | |
73 | ||
74 | %post | |
75 | %php_webserver_restart | |
76 | ||
77 | %postun | |
78 | if [ "$1" = 0 ]; then | |
79 | %php_webserver_restart | |
80 | fi | |
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 |