2 %{!?version: %define version @VERSION@}
3 %{!?kdir: %define kdir %(dir=$(echo "%configure_args" | sed -ne 's/.*--with-linux=\\([^ ][^ ]*\\).*$/\\1/p'); if [ -n "$dir" ]; then echo "$dir"; else echo "/lib/modules/$(uname -r)/build"; fi)}
5 %{!?kobjdir: %define kobjdir %(dir=$(echo "%configure_args" | sed -ne 's/.*--with-linux-obj=\\([^ ][^ ]*\\).*$/\\1/p'); if [ -n "$dir" ]; then echo "$dir"; else echo "%kdir"; fi)}
7 # as an alternative to this implementation we could simply "make -C $kdir kernelversion"
8 %{!?kversion: %define kversion %(if test -s %kobjdir/include/linux/utsrelease.h ; then LINUXRELEASEHEADER=utsrelease.h; else LINUXRELEASEHEADER=version.h; fi; sed -ne '/^#define UTS_RELEASE/s/.*"\\(.*\\)"$/\\1/p' %kobjdir/include/linux/$LINUXRELEASEHEADER)}
10 %{!?downstream_release: %define downstream_release "@DOWNSTREAM_RELEASE@"}
12 %define buildid %(if [ -n "@BUILDID@" ]; then echo "_@BUILDID@"; fi)
14 %{!?release: %define release %(if [ -n "%downstream_release" ]; then echo -n "%{downstream_release}_"; fi; release=$(echo %kversion | tr '-' '_'); echo ${release})}
16 # always append the buildid, even when the caller defines %release
17 %define fullrelease %{release}%{buildid}
19 Summary: ldiskfs backend file system
22 Release: %{fullrelease}
24 Group: Development/Kernel
25 Source: lustre-ldiskfs-%{version}.tar.gz
26 URL: http://www.sun.com/software/products/lustre/index.xml
27 BuildRoot: %{_tmppath}/lustre-ldiskfs-%{version}-root
28 Requires: modutils >= 2.4.10, ldiskfsprogs >= 1.41.12.2.ora1
31 Provides the ldiskfs backend file system kernel module, used by
32 servers in the Lustre file system, for Linux %{kversion}.
41 # if RPM_BUILD_NCPUS unset, set it
42 if [ -z "$RPM_BUILD_NCPUS" ] ; then
43 RPM_BUILD_NCPUS=$(egrep -c "^cpu[0-9]+" /proc/stat 2>/dev/null || echo 0 :)
44 if [ $RPM_BUILD_NCPUS -eq 0 ] ; then
47 if [ $RPM_BUILD_NCPUS -gt 8 ] ; then
52 rm -rf $RPM_BUILD_ROOT
54 # Set an explicit path to our Linux tree, if we can.
55 cd $RPM_BUILD_DIR/lustre-ldiskfs-%{version}
56 CONFIGURE_ARGS="%{?configure_args} --with-release=%release"
58 # if %%kdir was given, make sure it's not in the configure arguments
59 if [ -n "%kdir" ]; then
60 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux=[^ ][^ ]* \?//')
63 if [ -n "%kobjdir" ]; then
64 CONFIGURE_ARGS=$(echo $CONFIGURE_ARGS | sed -e 's/"\?--with-linux-obj=[^ ][^ ]* \?//')
67 # we need to eval "configure" because $CONFIGURE_ARGS could have a quoted
68 # string in it which we don't want word splitted by the shell
69 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#')
71 eval ./configure %{?configure_args} \
72 %{?kdir: --with-linux=%kdir} %{?kobjdir: --with-linux-obj=%kobjdir} \
73 --sysconfdir=%{_sysconfdir} \
77 make -j $RPM_BUILD_NCPUS -s
80 make install DESTDIR=$RPM_BUILD_ROOT
83 %attr(-, root, root) /lib/modules/%{kversion}/updates/kernel/fs/lustre-ldiskfs
86 if [ -f /boot/System.map-%{kversion} ]; then
87 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
89 depmod -ae %{kversion} || exit 0
93 if [ -f /boot/System.map-%{kversion} ]; then
94 depmod -ae -F /boot/System.map-%{kversion} %{kversion} || exit 0
96 depmod -ae %{kversion} || exit 0
100 rm -rf $RPM_BUILD_ROOT