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