5 %bcond_without tests # build without tests
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}
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
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
28 %{?requires_php_extension}
29 Provides: php(%{modname}) = %{version}
30 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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.
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.
43 - Fixed allocations ie. 500k 2k cache blocks
55 # simple module load test
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 \
64 grep %{modname} modules.log
66 cat <<'EOF' > run-tests.sh
68 export NO_INTERACTION=1 REPORT_EXIT_STATUS=1 MALLOC_CHECK_=2
70 PHP_EXECUTABLE=%{__php} \
71 PHP_TEST_SHARED_SYSTEM_EXTENSIONS="spl session pcre" \
72 RUN_TESTS_SETTINGS="-q $*"
76 ./run-tests.sh -w failed.log
77 test -f failed.log -a ! -s failed.log
81 rm -rf $RPM_BUILD_ROOT
83 EXTENSION_DIR=%{php_extensiondir} \
84 INSTALL_ROOT=$RPM_BUILD_ROOT
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
93 rm -rf $RPM_BUILD_ROOT
96 %php_webserver_restart
100 %php_webserver_restart
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