]>
Commit | Line | Data |
---|---|---|
863d2177 ER |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without tests # build without tests | |
4 | ||
5 | %define php_name php%{?php_suffix} | |
6 | %define modname gearman | |
7 | Summary: PHP wrapper to libgearman | |
8 | Name: %{php_name}-pecl-%{modname} | |
9 | Version: 1.1.2 | |
10 | Release: 1 | |
11 | License: PHP | |
12 | Group: Development/Tools | |
13 | Source0: http://pecl.php.net/get/%{modname}-%{version}.tgz | |
14 | # Source0-md5: fb3bc8df2d017048726d5654459e8433 | |
15 | URL: http://gearman.org/ | |
16 | BuildRequires: %{php_name}-devel | |
17 | BuildRequires: autoconf | |
18 | BuildRequires: automake | |
19 | BuildRequires: libgearman-devel >= 1.1.0 | |
20 | BuildRequires: libtool | |
21 | BuildRequires: rpmbuild(macros) >= 1.666 | |
22 | Provides: php(gearman) = %{version} | |
23 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
24 | ||
25 | %description | |
26 | This extension uses libgearman library to provide API for | |
27 | communicating with gearmand, and writing clients and workers | |
28 | ||
29 | %prep | |
30 | %setup -qc | |
31 | mv %{modname}-%{version}/* . | |
32 | ||
33 | # Upstream often forgets to change this | |
34 | extver=$(sed -n '/#define PHP_GEARMAN_VERSION/{s/.* "//;s/".*$//;p}' php_gearman.h) | |
35 | if test "x${extver}" != "x%{version}"; then | |
36 | : Error: Upstream version is ${extver}, expecting %{version}. | |
37 | exit 1 | |
38 | fi | |
39 | ||
40 | %build | |
41 | phpize | |
42 | %configure | |
43 | %{__make} | |
44 | ||
45 | %if %{with tests} | |
46 | # simple module load test | |
47 | %{__php} -n -q \ | |
48 | -d extension_dir=modules \ | |
49 | -d extension=%{modname}.so \ | |
50 | -m > modules.log | |
51 | grep %{modname} modules.log | |
52 | ||
53 | export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2 | |
54 | %{__make} test \ | |
55 | PHP_EXECUTABLE=%{__php} | |
56 | %endif | |
57 | ||
58 | %install | |
59 | rm -rf $RPM_BUILD_ROOT | |
60 | %{__make} install \ | |
61 | EXTENSION_DIR=%{php_extensiondir} \ | |
62 | INSTALL_ROOT=$RPM_BUILD_ROOT | |
63 | ||
64 | install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
65 | cp -a examples/* $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version} | |
66 | ||
67 | install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d | |
68 | cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini | |
69 | ; Enable %{modname} extension module | |
70 | extension=%{modname}.so | |
71 | EOF | |
72 | ||
73 | %clean | |
74 | rm -rf $RPM_BUILD_ROOT | |
75 | ||
b13f4020 ER |
76 | %post |
77 | %php_webserver_restart | |
78 | ||
79 | %postun | |
80 | if [ "$1" = 0 ]; then | |
81 | %php_webserver_restart | |
82 | fi | |
83 | ||
863d2177 ER |
84 | %files |
85 | %defattr(644,root,root,755) | |
86 | %doc README CREDITS LICENSE ChangeLog | |
87 | %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini | |
88 | %attr(755,root,root) %{php_extensiondir}/%{modname}.so | |
89 | %{_examplesdir}/%{name}-%{version} |