rpm: Keep debug symbols if configured with '--enable-debuginfo'
[zfs.git] / scripts / dkms.mkconf
blob0bd383420435ada1bc92fca51666ac35e546769b
1 #!/bin/sh
3 PROG=$0
5 pkgcfg=/etc/sysconfig/zfs
7 while 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
15 done
17 if [ -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
23 exec cat >"${filename}" <<EOF
24 PACKAGE_NAME="${pkgname}"
25 PACKAGE_VERSION="${pkgver}"
26 PACKAGE_CONFIG="${pkgcfg}"
27 NO_WEAK_MODULES="yes"
28 PRE_BUILD="configure
29 --prefix=/usr
30 --with-config=kernel
31 --with-linux=\$(
32 if [ -e "\${kernel_source_dir/%build/source}" ]
33 then
34 echo "\${kernel_source_dir/%build/source}"
35 else
36 echo "\${kernel_source_dir}"
39 --with-linux-obj="\${kernel_source_dir}"
40 \$(
41 [[ -n \"\${ICP_ROOT}\" ]] && \\
43 echo --with-qat=\"\${ICP_ROOT}\"
46 \$(
47 [[ -r \${PACKAGE_CONFIG} ]] \\
48 && source \${PACKAGE_CONFIG} \\
49 && shopt -q -s extglob \\
50 && \\
52 if [[ \${ZFS_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]]
53 then
54 echo --enable-debug
56 if [[ \${ZFS_DKMS_ENABLE_DEBUGINFO,,} == @(y|yes) ]]
57 then
58 echo --enable-debuginfo
63 POST_BUILD="scripts/dkms.postbuild
64 -n \${PACKAGE_NAME}
65 -v \${PACKAGE_VERSION}
66 -a \${arch}
67 -k \${kernelver}
68 -t \${dkms_tree}
70 AUTOINSTALL="yes"
71 MAKE[0]="make"
72 STRIP[0]="\$(
73 [[ -r \${PACKAGE_CONFIG} ]] \\
74 && source \${PACKAGE_CONFIG} \\
75 && shopt -q -s extglob \\
76 && [[ \${ZFS_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
77 && echo -n no
79 STRIP[1]="\${STRIP[0]}"
80 BUILT_MODULE_NAME[0]="zfs"
81 BUILT_MODULE_LOCATION[0]="module/"
82 DEST_MODULE_LOCATION[0]="/extra"
83 BUILT_MODULE_NAME[1]="spl"
84 BUILT_MODULE_LOCATION[1]="module/"
85 DEST_MODULE_LOCATION[1]="/extra"
86 EOF