mirror_zfs/scripts/dkms.mkconf
Tom Prince de2a22fcb3 Install header during post-build rather than post-install.
New versions of dkms clean up the build directory after installing.

It appears that this was always intended, but had rm -rf "/path/to/build/*"
(note the quotes), which prevented it from working.

Also, the build step is already installing stuff into the directory where
these files go, so installing our stuff there as part of build rather than
install makes sense.

Signed-off-by: Tom Prince <tom.prince@clusterhq.com>
Signed-off-by: Richard Yao <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #399
2014-10-09 12:00:25 -07:00

84 lines
2.0 KiB
Bash
Executable File

#!/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
--with-linux=\${kernel_source_dir}
--with-linux-obj=\${kernel_source_dir}
\$(
[[ -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_BUILD="scripts/dkms.postbuild
-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