3 %bcond_without dist_kernel # allow non-distribution kernel
4 %bcond_without kernel # don't build kernel modules
5 %bcond_without userspace # don't build userspace programs
6 %bcond_with verbose # verbose build (V=1)
9 %undefine with_dist_kernel
13 Summary: Flashcache - A Write Back Block Cache for Linux
19 Source0: https://github.com/facebook/flashcache/tarball/1.0#/%{name}-%{version}.tgz
20 # Source0-md5: 7b997160231bc67ce3751019ca7d7de0
21 URL: https://github.com/facebook/flashcache/
23 %if %{with dist_kernel}
24 BuildRequires: kernel%{_alt_kernel}-module-build >= 3:2.6.18
25 BuildRequires: kernel%{_alt_kernel}-source
27 BuildRequires: rpmbuild(macros) >= 1.379
29 %{?with_userspace:BuildRequires: perl-tools-pod}
30 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
33 Flashcache is a write back block cache Linux kernel module.
35 Flashcache was built primarily as a block cache for InnoDB but is
36 general purpose and can be used by other applications as well.
38 %package -n kernel%{_alt_kernel}-block-flashcache
39 Summary: FlashCache is a general purpose writeback block cache for Linux
40 Release: %{rel}@%{_kernel_ver_str}
42 Requires(post,postun): /sbin/depmod
43 %if %{with dist_kernel}
44 %requires_releq_kernel
45 Requires(postun): %releq_kernel
48 %description -n kernel%{_alt_kernel}-block-flashcache
49 Flashcache Linux kernel driver.
57 %build_kernel_modules -m flashcache
58 %build_kernel_modules -m flashcache-wt -C flashcache-wt
62 # as makefile aslo tries to build kernel part, we build userspace ourselves
64 %{__cc} %{rpmldflags} %{rpmcflags} -I./ -o utils/flashcache_create utils/flashcache_create.c
65 %{__cc} %{rpmldflags} %{rpmcflags} -I./ -o utils/flashcache_destroy utils/flashcache_destroy.c
66 %{__cc} %{rpmldflags} %{rpmcflags} -I./ -o utils/flashcache_load utils/flashcache_load.c
71 rm -rf $RPM_BUILD_ROOT
73 %install_kernel_modules -m flashcache,flashcache-wt -d kernel/block
77 # as makefile aslo tries to build kernel part, we build userspace ourselves
78 install -d $RPM_BUILD_ROOT%{_sbindir}
79 install -p src/utils/flashcache_create $RPM_BUILD_ROOT%{_sbindir}
80 install -p src/utils/flashcache_destroy $RPM_BUILD_ROOT%{_sbindir}
81 install -p src/utils/flashcache_load $RPM_BUILD_ROOT%{_sbindir}
85 rm -rf $RPM_BUILD_ROOT
87 %post -n kernel%{_alt_kernel}-block-flashcache
88 %depmod %{_kernel_ver}
90 %postun -n kernel%{_alt_kernel}-block-flashcache
91 %depmod %{_kernel_ver}
94 %defattr(644,root,root,755)
96 %attr(755,root,root) %{_sbindir}/flashcache_create
97 %attr(755,root,root) %{_sbindir}/flashcache_destroy
98 %attr(755,root,root) %{_sbindir}/flashcache_load
101 %files -n kernel%{_alt_kernel}-block-flashcache
102 %defattr(644,root,root,755)
103 /lib/modules/%{_kernel_ver}/kernel/block/*.ko*