aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dkms.mkconf
blob: 046ce9edcefe86cbfb08faf05f18eaa24facb58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/sh

PROG=$0

pkgcfg=/etc/sysconfig/zfs

while getopts "n:v:c:f:" opt; do
	case $opt in
		n) pkgname=$OPTARG  ;;
		v) pkgver=$OPTARG   ;;
		c) pkgcfg=$OPTARG   ;;
		f) filename=$OPTARG ;;
    *) err=1            ;;
	esac
done

if [ -z "${pkgname}" ] || [ -z "${pkgver}" ] || [ -z "${filename}" ] ||
    [ -n "${err}" ]; then
	echo "Usage: $PROG -n <pkgname> -v <pkgver> -c <pkgcfg> -f <filename>"
	exit 1
fi

exec cat >"${filename}" <<EOF
PACKAGE_NAME="${pkgname}"
PACKAGE_VERSION="${pkgver}"
PACKAGE_CONFIG="${pkgcfg}"
NO_WEAK_MODULES="yes"
PRE_BUILD="configure
  --disable-dependency-tracking
  --prefix=/usr
  --with-config=kernel
  --with-linux=\$(
    if [ -e "\${kernel_source_dir/%build/source}" ]
    then
      echo "\${kernel_source_dir/%build/source}"
    else
      echo "\${kernel_source_dir}"
    fi
  )
  --with-linux-obj="\${kernel_source_dir}"
  \$(
    [[ -n \"\${ICP_ROOT}\" ]] && \\
    {
      echo --with-qat=\"\${ICP_ROOT}\"
    }
  )
  \$(
    [[ -r \${PACKAGE_CONFIG} ]] \\
    && source \${PACKAGE_CONFIG} \\
    && shopt -q -s extglob \\
    && \\
    {
      if [[ \${ZFS_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]]
      then
        echo --enable-debug
      fi
      if [[ \${ZFS_DKMS_ENABLE_DEBUGINFO,,} == @(y|yes) ]]
      then
        echo --enable-debuginfo
      fi
    }
  )
"
POST_BUILD="scripts/dkms.postbuild
  -n \${PACKAGE_NAME}
  -v \${PACKAGE_VERSION}
  -a \${arch}
  -k \${kernelver}
  -t \${dkms_tree}
"
AUTOINSTALL="yes"
MAKE[0]="make"
STRIP[0]="\$(
  [[ -r \${PACKAGE_CONFIG} ]] \\
  && source \${PACKAGE_CONFIG} \\
  && shopt -q -s extglob \\
  && [[ \${ZFS_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
  && echo -n no
)"
STRIP[1]="\${STRIP[0]}"
BUILT_MODULE_NAME[0]="zfs"
BUILT_MODULE_LOCATION[0]="module/"
DEST_MODULE_LOCATION[0]="/extra"
BUILT_MODULE_NAME[1]="spl"
BUILT_MODULE_LOCATION[1]="module/"
DEST_MODULE_LOCATION[1]="/extra"
EOF