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
%else
%define DRACUTLIBDIR /usr/lib/dracut
%endif

# Common info
Name:          %{realname}
Version:       0.0.0
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-2.0
Group:         System/Filesystems
URL:           http://bcache.evilpiepirate.org/
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

%description
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.

Included:

make-bcache
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
support).

bcache-super-show
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)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%patch -p1

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

%install
%{__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 \
 DRACUTLIBDIR=%{DRACUTLIBDIR}

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

%files
%defattr(-,root,root)
%doc COPYING README
%{_sbindir}/*
%doc %{_mandir}/man8/*
%dir %{DRACUTLIBDIR}/modules.d/90bcache
%dir %{DRACUTLIBDIR}/modules.d
%dir %{DRACUTLIBDIR}
%dir /usr/lib/udev/rules.d
%dir /usr/lib/udev
/usr/lib/udev/bcache-register
/usr/lib/udev/probe-bcache
/usr/lib/udev/rules.d/69-bcache.rules
%{DRACUTLIBDIR}/modules.d/90bcache/module-setup.sh
%exclude /usr/share/initramfs-tools/hooks/bcache
%exclude /usr/lib/initcpio/install/bcache

%changelog