File bcache-tools.spec of Package bcache-tools

%define realname bcache-tools
%define srcext   tar.bz2

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

%if 0%{?rhel}
%define DRACUTLIBDIR %{_datadir}/dracut
%define DRACUTLIBDIR /usr/lib/dracut

# Common info
Name:          %{realname}
Version:       0.0.0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-2.0
Group:         System/Filesystems
Summary:       Userspace tools required for bcache

# Install-time parameters
Requires:      udev dracut

# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(blkid)
BuildRoot:     %{_tmppath}/%{name}-root
Source:        %{realname}-%{version}%{?extraver}.%{srcext}
Patch:         gcc-5.patch

Bcache is a Linux kernel block layer cache. It allows one or more fast disk
drives such as flash-based solid state drives (SSDs) to act as a cache for one
or more slower hard disk drives.


Formats a block device for use with bcache. A device can be formatted for use
as a cache or as a backing device (requires yet to be implemented kernel

Prints the bcache superblock of a cache device or a backing device.

Udev rules
The first half of the rules do auto-assembly and add uuid symlinks
to cache and backing devices.  The second half of the rules add symlinks to
cached devices, which are the devices created by the bcache kernel module.

Initramfs support
Currently initramfs-tools, mkinitcpio and dracut are supported.

# Preparation step (unpackung and patching if necessary)
%setup -q -n %{realname}-%{version}%{?extraver}
%patch -p1

%{__sed} -ri '/^CFLAGS/ s/=.+$/=%{optflags}/' Makefile
%{__make} %{?_smp_mflags} \
 PREFIX=%{_prefix} \
 UDEVLIBDIR=/usr/lib/udev \

%{__install} -d -m755 %{buildroot}%{_sbindir}
%{__install} -d -m755 %{buildroot}/usr/lib/udev/rules.d
%{__install} -d -m755 %{buildroot}%{_mandir}/man8
%{__make} install DESTDIR=%{buildroot} \
 PREFIX=%{_prefix} \
 UDEVLIBDIR=/usr/lib/udev \

[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%doc %{_mandir}/man8/*
%dir %{DRACUTLIBDIR}/modules.d/90bcache
%dir %{DRACUTLIBDIR}/modules.d
%dir /usr/lib/udev/rules.d
%dir /usr/lib/udev
%exclude /usr/share/initramfs-tools/hooks/bcache
%exclude /usr/lib/initcpio/install/bcache