File zfs.spec of Package zfs

#
# spec file for package zfs
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           zfs
Version:        0.6.2
Release:        0
Summary:        The ZFS filesystem and utilities
License:        CDDL-1.0 and GPL-2.0+
Group:          System/Filesystems
Url:            http://zfsonlinux.org/

#Github-URL:	http://github.com/zfsonlinux/zfs
#Git-Clone:	git://github.com/zfsonlinux/zfs
#DL-URL:	http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-0.6.2.tar.gz
Source:         %name-%version.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  fdupes
BuildRequires:  kernel-devel
BuildRequires:  kernel-syms
BuildRequires:  modutils
BuildRequires:  pkg-config
BuildRequires:  spl-km-devel
BuildRequires:  xz
BuildRequires:  pkgconfig(blkid)
BuildRequires:  pkgconfig(libselinux)
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(zlib)
# Files collide, but zypper does not recognize that (bnc#673720)
Conflicts:      zfs-fuse

%kernel_module_package -n zfs -p %name-preamble

%description
ZFS is a combined file system and logical volume manager designed by
Sun Microsystems. The features of ZFS include protection against data
corruption, support for high storage capacities, integration of the
concepts of filesystem and volume management, snapshots and
copy-on-write clones, continuous integrity checking and automatic
repair, RAID-Z and native NFSv4 ACLs.

ZFS on Linux, which is also known as ZoL, includes fully functional
and stable SPA, DMU, ZVOL, and ZPL layers.

%package -n libnvpair1
Summary:        A tools library for manipulating <name, value> pairs
License:        CDDL-1.0
Group:          System/Libraries

%description -n libnvpair1
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

The nvpair library provides routines packing an unpacking nv pairs
for transporting data across process boundaries, transporting between
kernel and userland, and possibly saving onto disk files.

%package -n libuutil1
Summary:        ZFS utility library
License:        CDDL-1.0
Group:          System/Libraries

%description -n libuutil1
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

The uutil library contains various utility and wrapper functions used
by the ZFS userland.

%package -n libzfs1
Summary:        ZFS filesystem access library
License:        CDDL-1.0
Group:          System/Libraries

%description -n libzfs1
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

%package -n libzpool1
Summary:        Zpool interface
License:        CDDL-1.0
Group:          System/Libraries

%description -n libzpool1
ZFS is an advanced file system and volume manager which was
originally developed by Sun Microsystems.

The zpool library contains
- Emulation of kernel services in userland
- Routines needed by more than one client of libzpool

%package devel
Summary:        Development files for the ZFS userspace utilities
License:        CDDL-1.0
Group:          Development/Libraries/C and C++
Requires:       libnvpair1 = %version
Requires:       libuutil1 = %version
Requires:       libzfs1 = %version
Requires:       libzpool1 = %version

%description devel
ZFS is a combined file system and logical volume manager designed by
Sun Microsystems. The features of ZFS include protection against data
corruption, support for high storage capacities, integration of the
concepts of filesystem and volume management, snapshots and
copy-on-write clones, continuous integrity checking and automatic
repair, RAID-Z and native NFSv4 ACLs.

This subpackage contains the development header files and libraries.
needed for compilation of third-party programs.

%prep
%setup -q

%build
for flavor in %flavors_to_build; do
	rm -Rf "../obj-$flavor";
	cp -a . "../obj-$flavor";
	pushd "../obj-$flavor/";
	%configure --with-config=kernel --with-linux="/usr/src/linux" \
		--with-linux-obj="/usr/src/linux-obj/%_target_cpu/$flavor";
	make %{?_smp_mflags};
	popd;
done
%configure --with-config=user --disable-static
make %{?_smp_mflags};

%install
b="%buildroot";
for flavor in %flavors_to_build; do
	pushd "../obj-$flavor/";
	make install DESTDIR="$b" %{?_smp_mflags};
	popd;
done;
make install DESTDIR="$b" %{?_smp_mflags};
rm -f "$b/%_libdir"/*.la;
rm -Rf "$b/usr/src";
mkdir -p "$b/%_sbindir";
ln -s "%_initddir/zfs" "$b/%_sbindir/rczfs";
%fdupes %buildroot/%_prefix

%preun
%stop_on_removal zfs

%postun
%insserv_cleanup
%restart_on_update zfs

%post   -n libnvpair1 -p /sbin/ldconfig
%postun -n libnvpair1 -p /sbin/ldconfig
%post   -n libuutil1 -p /sbin/ldconfig
%postun -n libuutil1 -p /sbin/ldconfig
%post   -n libzfs1 -p /sbin/ldconfig
%postun -n libzfs1 -p /sbin/ldconfig
%post   -n libzpool1 -p /sbin/ldconfig
%postun -n libzpool1 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%_initddir/zfs
%dir %_sysconfdir/zfs
%config %_sysconfdir/zfs/*.example
%_bindir/arcstat.py
%_sbindir/fsck.zfs
%_sbindir/rczfs
%_sbindir/z*
%_mandir/man?/*.*
%_datadir/zfs
/sbin/mount.zfs
%_prefix/lib/dracut
%_prefix/lib/udev

%files -n libnvpair1
%defattr(-,root,root)
%_libdir/libnvpair.so.1*

%files -n libuutil1
%defattr(-,root,root)
%_libdir/libuutil.so.1*

%files -n libzfs1
%defattr(-,root,root)
%_libdir/libzfs.so.1*

%files -n libzpool1
%defattr(-,root,root)
%_libdir/libzpool.so.1*

%files devel
%defattr(-,root,root)
%_includedir/libspl
%_includedir/libzfs
%_libdir/libnvpair.so
%_libdir/libuutil.so
%_libdir/libzfs.so
%_libdir/libzpool.so

%changelog