void-packages/srcpkgs/virtualbox-ose/patches/013-Makefile.patch
Đoàn Trần Công Danh 76acfa2dd2 srcpkgs/v*: convert patches to -Np1
```sh
git grep -l '^patch_args=-Np0' "srcpkgs/$1*/template" |
while read template; do
	for p in ${template%/template}/patches/*; do
		sed -i '
			\,^[+-][+-][+-] /dev/null,b
			/^[*-]\+ [0-9]\+\(,[0-9]\+\)\? [*-]\+$/b
			s,^[*][*][*] ,&a/,
			/^--- /{
				s,\(^--- \)\(./\)*,\1a/,
				s,[.-][Oo][Rr][Ii][Gg]\([	/]\),\1,
				s/[.-][Oo][Rr][Ii][Gg]$//
				s/[.]patched[.]\([^.]\)/.\1/
				h
			}
			/^+++ -/{
				g
				s/^--- a/+++ b/
				b
			}
			s,\(^+++ \)\(./\)*,\1b/,
		' "$p"
	done
	sed -i '/^patch_args=/d' $template
done
```
2021-06-20 13:17:29 +07:00

45 lines
1.3 KiB
Diff

diff --git a/src/VBox/HostDrivers/linux/Makefile b/src/VBox/HostDrivers/linux/Makefile
index 18466b48..7c7de4e5 100644
--- a/src/VBox/HostDrivers/linux/Makefile
+++ b/src/VBox/HostDrivers/linux/Makefile
@@ -23,25 +23,25 @@
# terms and conditions of either the GPL or the CDDL or both.
#
-ifneq ($(KERNELRELEASE),)
+ifneq ($(KBUILD_EXTMOD),)
-# Building from kBuild (make -C <kernel_directory> M=`pwd`),
-# or inside a kernel source tree.
+# Building from kBuild (make -C <kernel_directory> M=`pwd`).
+# KBUILD_EXTMOD is set to $(M) in this case.
obj-m = vboxdrv/
-ifneq ($(wildcard $(CURDIR)/vboxnetflt/Makefile),)
+ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxnetflt/Makefile),)
obj-m += vboxnetflt/
endif
-ifneq ($(wildcard $(CURDIR)/vboxnetadp/Makefile),)
+ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxnetadp/Makefile),)
obj-m += vboxnetadp/
endif
-ifneq ($(wildcard $(CURDIR)/vboxpci/Makefile),)
+ifneq ($(wildcard $(KBUILD_EXTMOD)/vboxpci/Makefile),)
obj-m += vboxpci/
endif
-else # ! KERNELRELEASE
+else # ! KBUILD_EXTMOD
-# convenience Makefile without KERNELRELEASE
+# convenience Makefile without KBUILD_EXTMOD
KBUILD_VERBOSE ?=
KERN_VER ?= $(shell uname -r)
@@ -146,4 +146,4 @@ load: unload
fi; \
done
-endif # ! KERNELRELEASE
+endif # ! KBUILD_EXTMOD