Subversion Repositories livecd

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

# -------------------------------------------------------------------------------------------
#
# How to build for normal kernel
#
#  rpmbuild -ba --target i686   --define 'kernel 2.6.18-1.2747.el5' unionfs.spec
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' unionfs.spec
#
# How to build for normal kernel and XEN kernel
#
#  rpmbuild -ba --target i686   --define 'kernel 2.6.18-1.2747.el5' --define 'buildxen 1' unionfs.spec
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' --define 'buildxen 1' unionfs.spec
#
#
# How to build for normal kernel and PAE kernel
#
#  rpmbuild -ba --target i686   --define 'kernel 2.6.18-1.2747.el5' --define 'buildPAE 1' unionfs.spec
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' --define 'buildPAE 1' unionfs.spec
#
# How to build for all kernel (normal, xen, PAE)
#
#  rpmbuild -ba --target i686   --define 'kernel 2.6.18-1.2747.el5' --define 'buildall 1' unionfs.spec
#  rpmbuild -ba --target x86_64 --define 'kernel 2.6.18-1.2747.el5' --define 'buildall 1' unionfs.spec
#
#
# How to build for the running kernel:
#
#  rpmbuild -ba --target i686   unionfs.spec
#  rpmbuild -ba --target x86_64 unionfs.spec
#
# -------------------------------------------------------------------------------------------

%{!?buildxen:%define buildxen 0}
%{!?buildPAE:%define buildPAE 0}

%{?buildall:%define buildxen 1}
%{?buildall:%define buildPAE 1}

%{?!kernel:%define kernel %(rpm -q kernel-devel | tail -1 | sed -e 's|kernel-devel-||')}

%define kversion %(echo "%{kernel}" | sed -e 's|-.*||')
%define krelease %(echo "%{kernel}" | sed -e 's|.*-||')

%define kernel_src_path %{_usrsrc}/kernels/%{kernel}-%{_target_cpu}
%define kernel_xen_src_path %{_usrsrc}/kernels/%{kernel}-xen-%{_target_cpu}
%define kernel_PAE_src_path %{_usrsrc}/kernels/%{kernel}-PAE-%{_target_cpu}

%define kernel_moduledir /lib/modules/%{kernel}
%define kernel_xen_moduledir /lib/modules/%{kernel}xen
%define kernel_PAE_moduledir /lib/modules/%{kernel}PAE

%define pkg_name unionfs
%define kmdl_name kernel-module-%{pkg_name}-%{kernel}

# -------------------------------------------------------------------------------------------

Summary:        A Stackable Unification File System
Name:           %{pkg_name}
Version:        1.4
Release:        2.sl5.psi
Epoch:          0
Packager:       Urs Beyerle <urs.beyerle@psi.ch>
License:        GPL
Group:          System Environment/Kernel
Source0:        ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs/%{name}-%{version}.tar.gz
URL:            http://www.am-utils.org/project-unionfs.html
Patch0:         unionfs-1.4-unionfs.h.patch
Patch1:         unionfs-1.4-stale_inode.c.patch
Patch2:         unionfs-1.4-Makefile.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Requires:       kernel-module-%{pkg_name} >= %{version}-%{release}
BuildRequires:  kernel-devel = %{kernel}, e2fsprogs-devel
%if %{buildxen}
BuildRequires:  kernel-xen-devel = %{kernel}
%endif
%if %{buildPAE}
BuildRequires:  kernel-PAE-devel = %{kernel}
%endif

%description
This project builds a stackable unification file system, which 
can appear to merge the contents of several directories (branches), 
while keeping their physical content separate. Unionfs is useful 
for unified source tree management, merged contents of split 
CD-ROM, merged separate software package directories, data grids, 
and more. Unionfs allows any mix of read-only and read-write 
branches, as well as insertion and deletion of branches anywhere 
in the fan-out. To maintain unix semantics, Unionfs handles 
elimination of duplicates, partial-error conditions, and more. 
Unionfs is part of the larger FiST project.

Kernel modules for unionfs are in kernel-module-%{pkg_name} rpms.

%package -n     %{kmdl_name}
Summary:        kernel modules for %{name}.
Group:          System Environment/Kernel
License:        GPL
Provides:       kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
Requires:       %{pkg_name}

%description -n %{kmdl_name}
Kernel modules for %{name}.

%if %{buildxen}
%package -n     %{kmdl_name}xen
Summary:        xen kernel modules for %{name}.
Group:          System Environment/Kernel
License:        GPL
Provides:       kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
Requires:       %{pkg_name}

%description -n %{kmdl_name}xen
XEN kernel modules for %{name}.
%endif

%if %{buildPAE}
%package -n     %{kmdl_name}PAE
Summary:        PAE kernel modules for %{name}.
Group:          System Environment/Kernel
License:        GPL
Provides:       kernel-module-%{pkg_name} = %{epoch}:%{version}-%{release}
Requires:       %{pkg_name}

%description -n %{kmdl_name}PAE
PAE kernel modules for %{name}.
%endif

%prep
%setup -q

%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
echo -e "\nDriver version: %{version}\nKernel version: %{kernel}\n"

### kernel
make clean
KVERS="%{kernel}" PREFIX=${RPM_BUILD_ROOT}%{_prefix} make unionfs.ko

INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}/kernel"
mkdir -p "${INST_MODLIB}/fs/unionfs"
install -p -m 744 unionfs.ko "${INST_MODLIB}/fs/unionfs/"

### XEN kernel
%if %{buildxen}
make clean
KVERS="%{kernel}xen" PREFIX=${RPM_BUILD_ROOT}%{_prefix} make unionfs.ko
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}xen/kernel"
mkdir -p "${INST_MODLIB}/fs/unionfs"
install -p -m 744 unionfs.ko "${INST_MODLIB}/fs/unionfs/"
%endif

### PAE kernel
%if %{buildPAE}
make clean
KVERS="%{kernel}PAE" PREFIX=${RPM_BUILD_ROOT}%{_prefix} make unionfs.ko
INST_MODLIB="${RPM_BUILD_ROOT}/lib/modules/%{kernel}PAE/kernel"
mkdir -p "${INST_MODLIB}/fs/unionfs"
install -p -m 744 unionfs.ko "${INST_MODLIB}/fs/unionfs/"
%endif

### build statically linked unionctl
make clean
cp -a Makefile Makefile.ori
sed -i "s|^CC.*=.*gcc|CC      = 'gcc -static'|" Makefile
make utils
mv -f utils/unionctl utils/unionctl.static
mv -f Makefile.ori Makefile

### build utils
make clean
make utils


%install
mkdir -p ${RPM_BUILD_ROOT}/%{_prefix}/sbin
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man4
mkdir -p ${RPM_BUILD_ROOT}/%{_mandir}/man8

cp -a utils/unionctl ${RPM_BUILD_ROOT}/%{_prefix}/sbin
cp -a utils/unionctl.static ${RPM_BUILD_ROOT}/%{_prefix}/sbin
cp -a utils/uniondbg ${RPM_BUILD_ROOT}/%{_prefix}/sbin
cp -a utils/unionimap ${RPM_BUILD_ROOT}/%{_prefix}/sbin

cp man/unionfs.4 ${RPM_BUILD_ROOT}/%{_mandir}/man4
cp man/unionctl.8 ${RPM_BUILD_ROOT}/%{_mandir}/man8
cp man/uniondbg.8 ${RPM_BUILD_ROOT}/%{_mandir}/man8
cp man/unionimap.8 ${RPM_BUILD_ROOT}/%{_mandir}/man8


%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

%postun -n %{kmdl_name}
depmod -a %{kernel} >/dev/null 2>&1 || :        

%post -n %{kmdl_name}
depmod -a %{kernel} >/dev/null 2>&1 || :

%if %{buildxen}
%postun -n %{kmdl_name}xen
depmod -a %{kernel}xen >/dev/null 2>&1 || :

%post -n %{kmdl_name}xen
depmod -a %{kernel}xen >/dev/null 2>&1 || :
%endif

%if %{buildPAE}
%postun -n %{kmdl_name}PAE
depmod -a %{kernel}PAE >/dev/null 2>&1 || :

%post -n %{kmdl_name}PAE
depmod -a %{kernel}PAE >/dev/null 2>&1 || :
%endif


%files 
%defattr(-,root,root,-)
%doc AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README
%{_prefix}/sbin/*
%{_mandir}/man4/*
%{_mandir}/man8/*

%files -n %{kmdl_name}
%defattr(-,root,root,-)
/lib/modules/%{kernel}/kernel/fs/unionfs

%if %{buildxen}
%files -n %{kmdl_name}xen
%defattr(-,root,root,-)
/lib/modules/%{kernel}xen/kernel/fs/unionfs
%endif

%if %{buildPAE}
%files -n %{kmdl_name}PAE
%defattr(-,root,root,-)
/lib/modules/%{kernel}PAE/kernel/fs/unionfs
%endif


%changelog
* Wed Jan 10 2007 Urs Beyerle <urs.beyerle@psi.ch>  1.4-2.sl5.psi
- buildsmp removed
- buildxen added (default buildxen=0)
- buildPAE added (default buildPAE=0
- buildall added

* Tue Jan 09 2007 Urs Beyerle <urs.beyerle@psi.ch>  1.4-1.sl5.psi
- add patches to build with SL5 kernel
- add BuildRequires: e2fsprogs-devel
- made some small changes in build and install sections
- add man/unionimap.8
- change gcc -static to 'gcc -static' in the sed command
- build for SL5 alpha

* Mon Oct 16 2006 Urs Beyerle <urs.beyerle@psi.ch>  1.1.5-2.sl4.psi
- add unionctl.static (statically linked unionctl), needed for LiveCD

* Thu Aug 31 2006 Urs Beyerle <urs.beyerle@psi.ch>  1.1.5-1.sl4.psi
- inital build.