aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/dkms.mkconf
blob: 3bfe2be7bbe3ff404db23636746107e928feb378 (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
#!/bin/sh

PROG=$0

pkgcfg=/etc/sysconfig/spl

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

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

cat >${filename} <<EOF
PACKAGE_NAME="${pkgname}"
PACKAGE_VERSION="${pkgver}"
PACKAGE_CONFIG="${pkgcfg}"
PRE_BUILD="configure
  --prefix=/usr
  --with-config=kernel
  \$(
    [[ -r \${PACKAGE_CONFIG} ]] \\
    && source \${PACKAGE_CONFIG} \\
    && shopt -q -s extglob \\
    && \\
    {
      if [[ \${SPL_DKMS_ENABLE_DEBUG,,} == @(y|yes) ]]
      then
        echo --enable-debug
      fi
      if [[ \${SPL_DKMS_ENABLE_DEBUG_LOG,,} == @(y|yes) ]]
      then
        echo --enable-debug-log
      fi
      if [[ \${SPL_DKMS_ENABLE_DEBUG_KMEM,,} == @(y|yes) ]]
      then
        echo --enable-debug-kmem
      fi
      if [[ \${SPL_DKMS_ENABLE_DEBUG_KMEM_TRACKING,,} == @(y|yes) ]]
      then
        echo --enable-debug-kmem-tracking
      fi
      if [[ \${SPL_DKMS_ENABLE_ATOMIC_SPINLOCKS,,} == @(y|yes) ]]
      then
        echo --enable-atomic-spinlocks
      fi
    }
  )
"
POST_INSTALL="scripts/dkms.postinst
  -n \${PACKAGE_NAME}
  -v \${PACKAGE_VERSION}
  -a \${arch}
  -k \${kernelver}
  -t \${dkms_tree}
"
AUTOINSTALL="yes"
REMAKE_INITRD="no"
MAKE[0]="make"
STRIP[0]="\$(
  [[ -r \${PACKAGE_CONFIG} ]] \\
  && source \${PACKAGE_CONFIG} \\
  && shopt -q -s extglob \\
  && [[ \${SPL_DKMS_DISABLE_STRIP,,} == @(y|yes) ]] \\
  && echo -n no
)"
STRIP[1]="\${STRIP[0]}"
BUILT_MODULE_NAME[0]="spl"
BUILT_MODULE_LOCATION[0]="module/spl/"
DEST_MODULE_LOCATION[0]="/extra/spl/spl"
BUILT_MODULE_NAME[1]="splat"
BUILT_MODULE_LOCATION[1]="module/splat/"
DEST_MODULE_LOCATION[1]="/extra/splat/splat"
EOF