Whamcloud - gitweb
LU-11304 misc: update all url links to whamcloud
[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         SPL_VERSION=$(dkms status -m spl -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
23         if [ -z $SPL_VERSION ] ; then
24                 echo "spl-dkms package must already be installed and built under DKMS control"
25                 exit 1
26         fi
27         ZFS_VERSION=$(dkms status -m zfs -k $3 -a $5 | awk -F', ' '{print $2; exit 0}' | grep -v ': added$')
28         if [ -z $ZFS_VERSION ] ; then
29                 echo "zfs-dkms package must already be installed and built under DKMS control"
30                 exit 1
31         fi
32
33         SERVER="--enable-server $LDISKFS \
34                 --with-linux=$4 --with-linux-obj=$4 \
35                 --with-spl=$6/spl-${SPL_VERSION} \
36                 --with-spl-obj=$7/spl/${SPL_VERSION}/$3/$5 \
37                 --with-zfs=$6/zfs-${ZFS_VERSION} \
38                 --with-zfs-obj=$7/zfs/${ZFS_VERSION}/$3/$5"
39
40         KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
41         ;;
42
43     lustre-ldiskfs)
44         SERVER="--enable-server --without-zfs --without-spl \
45                 --with-linux=$4 --with-linux-obj=$4"
46
47         KERNEL_STUFF="--with-linux=$4 --with-linux-obj=$4"
48         ;;
49 esac
50
51 PACKAGE_CONFIG="/etc/sysconfig/lustre"
52 DKMS_CONFIG_OPTS=$(
53     [[ -r ${PACKAGE_CONFIG} ]] \
54     && source ${PACKAGE_CONFIG} \
55     && shopt -q -s extglob \
56     && \
57     {
58       if [[ ${LUSTRE_DKMS_DISABLE_CDEBUG,,} == @(y|yes) ]]
59       then
60         echo --disable-libcfs-cdebug
61       fi
62       if [[ ${LUSTRE_DKMS_DISABLE_TRACE,,} == @(y|yes) ]]
63       then
64         echo --disable-libcfs-trace
65       fi
66       if [[ ${LUSTRE_DKMS_DISABLE_ASSERT,,} == @(y|yes) ]]
67       then
68         echo --disable-libcfs-assert
69       fi
70     }
71   )
72
73 rpm -qa | grep krb5-devel >/dev/null
74 if [ $? == 0 ] ; then
75         GSS="--enable-gss"
76 else
77         GSS="--disable-gss"
78 fi
79
80 # run a configure pass to clean "--enable-dist" only effect and also to
81 # ensure local/on-target environment to be taken into account for
82 # dkms.mkconf script customizations and before next build/MAKE step
83 ./configure --prefix=/usr --enable-modules --disable-iokit --disable-snmp \
84         --disable-doc --disable-utils --disable-tests --disable-maintainer-mode \
85         $KERNEL_STUFF $GSS $SERVER $DKMS_CONFIG_OPTS \
86         --disable-manpages --disable-mpitests
87
88 if [ $? != 0 ] ; then
89         echo "configure error, check $7/$1/$2/build/config.log"
90         exit 1
91 fi