Whamcloud - gitweb
LU-11939 tgt: Do not assert during grant cleanup
[fs/lustre-release.git] / lustre-dkms_pre-build.sh
1 #!/bin/bash
2 # $1 : $module
3 # $2 : $module_version
4 # $3 : $kernelver
5 # $4 : $kernel_source_dir
6 # $5 : $arch
7 # $6 : $source_tree
8 # $7 : $dkms_tree
9
10 case $1 in
11     lustre-client)
12         SERVER="--disable-server"
13         KERNEL_STUFF=""
14         ;;
15
16     lustre-zfs|lustre-all)
17         LDISKFS=""
18         if [ "$1" == "lustre-zfs" ]; then
19             LDISKFS="--disable-ldiskfs"
20         fi
21
22         # ZFS and SPL are version locked
23         ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
24         if [ -z $ZFS_VERSION ] ; then
25                 echo "zfs-dkms package must already be installed and built under DKMS control"
26                 exit 1
27         fi
28
29         SERVER="--enable-server $LDISKFS \
30                 --with-linux=$4 --with-linux-obj=$4 \
31                 --with-spl=$6/spl-${ZFS_VERSION} \
32                 --with-spl-obj=$7/spl/${ZFS_VERSION}/$3/$5 \
33                 --with-zfs=$6/zfs-${ZFS_VERSION} \
34                 --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5"
35
36         KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
37         ;;
38
39     lustre-ldiskfs)
40         SERVER="--enable-server --without-zfs --without-spl \
41                 --with-linux=$4 --with-linux-obj=$4"
42
43         KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
44         ;;
45 esac
46
47 PACKAGE_CONFIG="/etc/sysconfig/lustre"
48 DKMS_CONFIG_OPTS=$(
49     [[ -r ${PACKAGE_CONFIG} ]] \
50     && source ${PACKAGE_CONFIG} \
51     && shopt -q -s extglob \
52     && \
53     {
54       if [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]]
55       then
56         echo --disable-libcfs-cdebug
57       fi
58       if [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]]
59       then
60         echo --disable-libcfs-trace
61       fi
62       if [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]]
63       then
64         echo --disable-libcfs-assert
65       fi
66     }
67   )
68
69 rpm -qa | grep krb5-devel >/dev/null
70 if [ $? == 0 ] ; then
71         GSS="--enable-gss"
72 else
73         GSS="--disable-gss"
74 fi
75
76 # run a configure pass to clean "--enable-dist" only effect and also to
77 # ensure local/on-target environment to be taken into account for
78 # dkms.mkconf script customizations and before next build/MAKE step
79 ./configure --prefix=/usr --enable-modules --disable-iokit --disable-snmp \
80         --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \
81         $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \
82         --disable-manpages --disable-mpitests
83
84 if [ $? != 0 ] ; then
85         echo "configure error, check $7/$1/$2/build/config.log"
86         exit 1
87 fi