]> git.pld-linux.org Git - packages/php-stumblecache.git/blob - php-stumblecache.spec
new, version 1.0.0-dev
[packages/php-stumblecache.git] / php-stumblecache.spec
1 # TODO
2 # - add php55 support
3
4 # Conditional build:
5 %bcond_without  tests           # build without tests
6
7 %define         php_name        php%{?php_suffix}
8 %define         modname stumblecache
9 Summary:        StumbleCache is a mmap backed caching extension for PHP
10 Name:           %{php_name}-%{modname}
11 Version:        1.0.0
12 Release:        0.1
13 License:        PHP 3.01
14 Group:          Development/Languages/PHP
15 Source0:        https://github.com/stumbleupon/stumblecache/archive/master/%{modname}-%{version}.tar.gz
16 # Source0-md5:  9dc64c217d4e0ae0bd6da7aece246ea4
17 URL:            https://github.com/stumbleupon/stumblecache
18 BuildRequires:  %{php_name}-devel
19 BuildRequires:  %{php_name}-pecl-igbinary-devel >= 1.1.2
20 BuildRequires:  rpmbuild(macros) >= 1.666
21 %if %{with tests}
22 BuildRequires:  %{php_name}-cli
23 BuildRequires:  %{php_name}-pcre
24 BuildRequires:  %{php_name}-pecl-igbinary
25 BuildRequires:  %{php_name}-session
26 BuildRequires:  %{php_name}-spl
27 %endif
28 %{?requires_php_extension}
29 Provides:       php(%{modname}) = %{version}
30 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
31
32 %description
33 Stumblecache is a high performance shared memory cache that scales to
34 tens of gigabytes of cache, thousands of requests per second, and high
35 update rates. It was created to allow Stumbleupon to cache large
36 amounts of short ttl url data on our webserver and worker tiers.
37
38 You can think of it as a replacement for the user caching portion of
39 apc, though different tradeoffs have been made and stumblecache will
40 be less space efficient in most cases.
41
42 - MMAP based
43 - Fixed allocations ie. 500k 2k cache blocks
44
45 %prep
46 %setup -qc
47 mv %{modname}-*/* .
48
49 %build
50 phpize
51 %configure
52 %{__make}
53
54 %if %{with tests}
55 # simple module load test
56 %{__php} -n -q \
57         -d extension_dir=modules \
58         -d extension=%{php_extensiondir}/spl.so \
59         -d extension=%{php_extensiondir}/session.so \
60         -d extension=%{php_extensiondir}/igbinary.so \
61         -d extension=%{php_extensiondir}/pcre.so \
62         -d extension=%{modname}.so \
63         -m > modules.log
64 grep %{modname} modules.log
65
66 cat <<'EOF' > run-tests.sh
67 #!/bin/sh
68 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
69 %{__make} test \
70         PHP_EXECUTABLE=%{__php} \
71         PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl session pcre" \
72         RUN_TESTS_SETTINGS="-q $*"
73 EOF
74
75 chmod +x run-tests.sh
76 ./run-tests.sh -w failed.log
77 test -f failed.log -a ! -s failed.log
78 %endif
79
80 %install
81 rm -rf $RPM_BUILD_ROOT
82 %{__make} install \
83         EXTENSION_DIR=%{php_extensiondir} \
84         INSTALL_ROOT=$RPM_BUILD_ROOT
85
86 install -d $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d
87 cat <<'EOF' > $RPM_BUILD_ROOT%{php_sysconfdir}/conf.d/%{modname}.ini
88 ; Enable %{modname} extension module
89 extension=%{modname}.so
90 EOF
91
92 %clean
93 rm -rf $RPM_BUILD_ROOT
94
95 %post
96 %php_webserver_restart
97
98 %postun
99 if [ "$1" = 0 ]; then
100         %php_webserver_restart
101 fi
102
103 %files
104 %defattr(644,root,root,755)
105 %doc CREDITS EXPERIMENTAL
106 %config(noreplace) %verify(not md5 mtime size) %{php_sysconfdir}/conf.d/%{modname}.ini
107 %attr(755,root,root) %{php_extensiondir}/%{modname}.so
This page took 0.090818 seconds and 3 git commands to generate.