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