summaryrefslogtreecommitdiffstats
path: root/zfs.spec.in
blob: db486693fabaac094179c80eeaeb12ed34c9618e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# The following block is used to allow the source RPM to be rebuilt 
# against arbitrary kernels.  It ensure the release name is correct
# and the proper build/install requires are set.
%if 0%{?require_kver:1}
%define kver %{require_kver}
%else
%define _kdir %((echo X; ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null)|sed -e 's/linux-//' | tail -1)
%define kver %(basename %{_kdir})
%endif

# Each distro has its own kernel package naming convention.
%if 0%{?ch4}
%define kstr chaos-kernel
%define kdev chaos-kernel-devel
%define kdir /usr/src/kernels/%{kver}
%else
%define kstr kernel
%define kdev kernel-devel
%define kdir /usr/src/kernels/%{kver}
%endif

%define debug_package %{nil}

# The kernel version should only be appended to a binary RPM.
# When building a source RPM it must be kernel version agnostic.
%define name     @PACKAGE@
%define version  @VERSION@

%if %{?build_src_rpm:1}0
%define release  @ZFS_META_RELEASE@
%else
%define release  @ZFS_META_RELEASE@_%(echo %{kver} | sed -e 's/-/_/g')
%endif

%if 0%{?require_kver:1}
%define k_buildrequires   %{kdev}=%{kver}
%define spl_buildrequires spl-devel>=@VERSION@
%else
%define k_buildrequires   %{kdev}
%define spl_buildrequires spl-devel
%endif

Summary:         ZFS File System
Group:           Utilities/System
Name:            %{name}
Version:         %{version}
Release:         %{release}
License:         @LICENSE@
URL:             git://eris.llnl.gov/zfs.git
BuildRoot:       %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
Source:          %{name}-%{version}.tar.gz
Requires:        %{kstr} = %{kver}
Requires:        spl >= @VERSION@
BuildRequires:   %{k_buildrequires}
BuildRequires:   %{spl_buildrequires}

%description
The %{name} package contains kernel modules and support utilities for
the %{name} file system.

%package devel
Summary:         ZFS File System Headers and Symbols
Group:           Development/Libraries
Requires:        %{kstr} = %{kver}
Requires:        spl >= @VERSION@
BuildRequires:   %{k_buildrequires}
BuildRequires:   %{spl_buildrequires}

%description devel
The %{name}-devel package contains the header files and Module.symvers
symbols needed for building additional modules which use %{name}.

%prep
%setup
%build
%configure --with-linux=%{kdir} --with-spl=%{kdir}/include/spl
make

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%doc AUTHORS ChangeLog COPYING COPYRIGHT DISCLAIMER GIT
%doc OPENSOLARIS.LICENSE README TODO ZFS.RELEASE
%{_sbindir}/*
%{_libdir}/*
/lib/modules/*

%files devel
%defattr(-,root,root)
%{kdir}/include/zfs/*

%post
if [ -f /boot/System.map-%{kver} ]; then
	depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
else
	depmod -ae %{kver} || exit 0
fi

%postun
if [ -f /boot/System.map-%{kver} ]; then
	depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
else
	depmod -ae %{kver} || exit 0
fi