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