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