From 6cb5dcabf9d6122c98578cad49f17d40cc32d264 Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Fri, 29 Sep 2023 17:40:53 -0400 Subject: [PATCH] dkms: allow limiting jobs, add missing dep some less-powerful platforms may be overwhelmed by the default `-j$(nproc)`. Allow overriding this by setting `DKMS_JOBS` in `/etc/default/dkms` `bc` is needed for `make prepare0` on kernel 6.1+, which is run on cross. --- srcpkgs/dkms/files/dkms.default | 2 ++ srcpkgs/dkms/files/kernel.d/dkms.postinst | 9 ++++++--- srcpkgs/dkms/template | 11 ++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 srcpkgs/dkms/files/dkms.default diff --git a/srcpkgs/dkms/files/dkms.default b/srcpkgs/dkms/files/dkms.default new file mode 100644 index 00000000000..60312bf9720 --- /dev/null +++ b/srcpkgs/dkms/files/dkms.default @@ -0,0 +1,2 @@ +# number of parallel jobs to use for DKMS compilation (default: $(nproc)) +#DKMS_JOBS= diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst index 66d22981b51..6e4d3b3149a 100644 --- a/srcpkgs/dkms/files/kernel.d/dkms.postinst +++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst @@ -17,10 +17,13 @@ if [ ! -e /lib/modules/${VERSION}/build/include ] ; then exit 0 fi +[ -r /etc/default/dkms ] && . /etc/default/dkms +: "${DKMS_JOBS:=$(nproc)}" + export IGNORE_CC_MISMATCH=1 if [ ! -f /lib/modules/${VERSION}/build/scripts/basic/fixdep ] || [ ! -f /lib/modules/${VERSION}/build/scripts/mod/modpost ]; then - yes "" | make -j $(nproc) -C /lib/modules/${VERSION}/build prepare0 + yes "" | make -j "${DKMS_JOBS}" -C /lib/modules/${VERSION}/build prepare0 fi # Check available DKMS modules @@ -68,7 +71,7 @@ while [ $# -gt 1 ]; do fi # Build the module echo -n "Building DKMS module: ${module}-${modulever}... " - /usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} + /usr/bin/dkms build -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} rval=$? # If the module was skipped or failed, go to the next module. if [ $rval -eq 0 ]; then @@ -87,7 +90,7 @@ while [ $# -gt 1 ]; do if [ $(echo "$status"|grep -c ": built") -eq 1 ] && [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then echo -n "Installing DKMS module: ${module}-${modulever}... " - /usr/bin/dkms install --force -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} + /usr/bin/dkms install --force -j "${DKMS_JOBS}" -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} rval=$? # If the module failed installation, go to the next module. if [ $rval -eq 0 ]; then diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template index 34ee6c4afab..4c86485bc01 100644 --- a/srcpkgs/dkms/template +++ b/srcpkgs/dkms/template @@ -1,9 +1,9 @@ # Template file for 'dkms' pkgname=dkms version=3.0.10 -revision=2 -conf_files="/etc/dkms/framework.conf" -depends="bash kmod gcc make coreutils xbps-triggers>=0.123_1" +revision=3 +conf_files="/etc/dkms/framework.conf /etc/default/dkms" +depends="bash kmod gcc bc make coreutils xbps-triggers>=0.123_1" short_desc="Dynamic Kernel Module Support" maintainer="Orphaned " license="GPL-2.0-or-later" @@ -35,6 +35,7 @@ do_install() { vcompletion dkms.bash-completion bash dkms vinstall dkms_framework.conf 644 etc/dkms framework.conf # Kernel hooks. - vinstall ${FILESDIR}/kernel.d/dkms.postinst 754 etc/kernel.d/post-install 10-dkms - vinstall ${FILESDIR}/kernel.d/dkms.prerm 754 etc/kernel.d/pre-remove 10-dkms + vinstall "${FILESDIR}/kernel.d/dkms.postinst" 754 etc/kernel.d/post-install 10-dkms + vinstall "${FILESDIR}/kernel.d/dkms.prerm" 754 etc/kernel.d/pre-remove 10-dkms + vinstall "${FILESDIR}/dkms.default" 644 etc/default dkms }