xref: /freebsd/sys/contrib/openzfs/scripts/dkms.mkconf (revision ec0ea6efa1ad229d75c394c1a9b9cac33af2b1d3)
1#!/bin/sh
2
3PROG=$0
4
5pkgcfg=/etc/sysconfig/zfs
6
7while getopts "n:v:c:f:" opt; do
8	case $opt in
9		n) pkgname=$OPTARG  ;;
10		v) pkgver=$OPTARG   ;;
11		c) pkgcfg=$OPTARG   ;;
12		f) filename=$OPTARG ;;
13    *) err=1            ;;
14	esac
15done
16
17if [ -z "${pkgname}" ] || [ -z "${pkgver}" ] || [ -z "${filename}" ] ||
18    [ -n "${err}" ]; then
19	echo "Usage: $PROG -n <pkgname> -v <pkgver> -c <pkgcfg> -f <filename>"
20	exit 1
21fi
22
23exec cat >"${filename}" <<EOF
24PACKAGE_NAME="${pkgname}"
25PACKAGE_VERSION="${pkgver}"
26PACKAGE_CONFIG="${pkgcfg}"
27NO_WEAK_MODULES="yes"
28PRE_BUILD="configure
29  --prefix=/usr
30  --with-config=kernel
31  --with-linux=\$(
32    case \`lsb_release -is\` in
33      (Debian|Devuan)
34        if [[ -e \${kernel_source_dir/%build/source} ]]
35        then
36          echo \${kernel_source_dir/%build/source}
37        else
38          # A kpkg exception for Proxmox 2.0
39          echo \${kernel_source_dir}
40        fi
41      ;;
42      (*)
43        echo \${kernel_source_dir}
44      ;;
45    esac
46  )
47  --with-linux-obj=\${kernel_source_dir}
48  \$(
49    [[ -n \"\${ICP_ROOT}\" ]] && \\
50    {
51      echo --with-qat=\"\${ICP_ROOT}\"
52    }
53  )
54  \$(
55    [[ -r \${PACKAGE_CONFIG} ]] \\
56    && source \${PACKAGE_CONFIG} \\
57    && shopt -q -s extglob \\
58    && \\
59    {
60      if [[ \${ZFS_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]]
61      then
62        echo --enable-debug
63      fi
64      if [[ \${ZFS_DKMS_ENABLE_DEBUGINFO,,} == @(y|yes) ]]
65      then
66        echo --enable-debuginfo
67      fi
68    }
69  )
70"
71POST_BUILD="scripts/dkms.postbuild
72  -n \${PACKAGE_NAME}
73  -v \${PACKAGE_VERSION}
74  -a \${arch}
75  -k \${kernelver}
76  -t \${dkms_tree}
77"
78AUTOINSTALL="yes"
79MAKE[0]="make"
80STRIP[0]="\$(
81  [[ -r \${PACKAGE_CONFIG} ]] \\
82  && source \${PACKAGE_CONFIG} \\
83  && shopt -q -s extglob \\
84  && [[ \${ZFS_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
85  && echo -n no
86)"
87STRIP[1]="\${STRIP[0]}"
88STRIP[2]="\${STRIP[0]}"
89STRIP[3]="\${STRIP[0]}"
90STRIP[4]="\${STRIP[0]}"
91STRIP[5]="\${STRIP[0]}"
92STRIP[6]="\${STRIP[0]}"
93STRIP[7]="\${STRIP[0]}"
94STRIP[8]="\${STRIP[0]}"
95BUILT_MODULE_NAME[0]="zavl"
96BUILT_MODULE_LOCATION[0]="module/avl/"
97DEST_MODULE_LOCATION[0]="/extra/avl/avl"
98BUILT_MODULE_NAME[1]="znvpair"
99BUILT_MODULE_LOCATION[1]="module/nvpair/"
100DEST_MODULE_LOCATION[1]="/extra/nvpair/znvpair"
101BUILT_MODULE_NAME[2]="zunicode"
102BUILT_MODULE_LOCATION[2]="module/unicode/"
103DEST_MODULE_LOCATION[2]="/extra/unicode/zunicode"
104BUILT_MODULE_NAME[3]="zcommon"
105BUILT_MODULE_LOCATION[3]="module/zcommon/"
106DEST_MODULE_LOCATION[3]="/extra/zcommon/zcommon"
107BUILT_MODULE_NAME[4]="zfs"
108BUILT_MODULE_LOCATION[4]="module/zfs/"
109DEST_MODULE_LOCATION[4]="/extra/zfs/zfs"
110BUILT_MODULE_NAME[5]="icp"
111BUILT_MODULE_LOCATION[5]="module/icp/"
112DEST_MODULE_LOCATION[5]="/extra/icp/icp"
113BUILT_MODULE_NAME[6]="zlua"
114BUILT_MODULE_LOCATION[6]="module/lua/"
115DEST_MODULE_LOCATION[6]="/extra/lua/zlua"
116BUILT_MODULE_NAME[7]="spl"
117BUILT_MODULE_LOCATION[7]="module/spl/"
118DEST_MODULE_LOCATION[7]="/extra/spl/spl"
119BUILT_MODULE_NAME[8]="zzstd"
120BUILT_MODULE_LOCATION[8]="module/zstd/"
121DEST_MODULE_LOCATION[8]="/extra/zstd/zzstd"
122EOF
123