Răsfoiți Sursa

build: conditionally build llvm bpf toolchain by default

Unless another toolchain is present (or selected), build the bpf toolchain
whenever a package is selected that needs it.

Signed-off-by: Felix Fietkau <[email protected]>
(cherry picked from commit 6605e45676815156f0c47d4117ee401e6616fcac)
Felix Fietkau 8 luni în urmă
părinte
comite
8cd50a6aec
3 a modificat fișierele cu 9 adăugiri și 8 ștergeri
  1. 1 1
      include/bpf.mk
  2. 1 0
      package/network/services/unetd/Makefile
  3. 7 7
      toolchain/Config.in

+ 1 - 1
include/bpf.mk

@@ -1,4 +1,4 @@
-BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
+BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN
 LLVM_VER:=
 LLVM_VER:=
 
 
 CLANG_MIN_VER:=12
 CLANG_MIN_VER:=12

+ 1 - 0
package/network/services/unetd/Makefile

@@ -40,6 +40,7 @@ define Package/unetd/config
 		bool "VXLAN support"
 		bool "VXLAN support"
 		depends on PACKAGE_unetd
 		depends on PACKAGE_unetd
 		depends on HAS_BPF_TOOLCHAIN
 		depends on HAS_BPF_TOOLCHAIN
+		select NEED_BPF_TOOLCHAIN
 		default y
 		default y
 
 
 endef
 endef

+ 7 - 7
toolchain/Config.in

@@ -40,9 +40,8 @@ menuconfig TARGET_OPTIONS
 
 
 	choice BPF_TOOLCHAIN
 	choice BPF_TOOLCHAIN
 		prompt "BPF toolchain" if DEVEL
 		prompt "BPF toolchain" if DEVEL
-		default BPF_TOOLCHAIN_BUILD_LLVM if BUILDBOT
 		default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN
 		default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN
-		default BPF_TOOLCHAIN_NONE
+		default BPF_TOOLCHAIN_BUILD_LLVM
 
 
 		config BPF_TOOLCHAIN_NONE
 		config BPF_TOOLCHAIN_NONE
 			bool "None"
 			bool "None"
@@ -57,7 +56,7 @@ menuconfig TARGET_OPTIONS
 			bool "Use host LLVM toolchain"
 			bool "Use host LLVM toolchain"
 
 
 		config BPF_TOOLCHAIN_BUILD_LLVM
 		config BPF_TOOLCHAIN_BUILD_LLVM
-			select USE_LLVM_BUILD
+			select USE_LLVM_BUILD if NEED_BPF_TOOLCHAIN
 			bool "Build LLVM toolchain for eBPF"
 			bool "Build LLVM toolchain for eBPF"
 			help
 			help
 			  If enabled, a LLVM toolchain for building eBPF binaries will be built.
 			  If enabled, a LLVM toolchain for building eBPF binaries will be built.
@@ -320,23 +319,24 @@ config GDB_PYTHON
 	  Enable the python bindings for GDB to allow using python in the gdb shell.
 	  Enable the python bindings for GDB to allow using python in the gdb shell.
 
 
 config HAS_BPF_TOOLCHAIN
 config HAS_BPF_TOOLCHAIN
+	default y if !BPF_TOOLCHAIN_NONE
+	bool
+
+config NEED_BPF_TOOLCHAIN
 	bool
 	bool
 
 
 config HAS_PREBUILT_LLVM_TOOLCHAIN
 config HAS_PREBUILT_LLVM_TOOLCHAIN
 	def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n)
 	def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n)
 
 
 config USE_LLVM_HOST
 config USE_LLVM_HOST
-	select HAS_BPF_TOOLCHAIN
 	bool
 	bool
 
 
 config USE_LLVM_PREBUILT
 config USE_LLVM_PREBUILT
-	select HAS_BPF_TOOLCHAIN
 	default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN
 	default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN
 	bool
 	bool
 
 
 config USE_LLVM_BUILD
 config USE_LLVM_BUILD
-	default y if !DEVEL && BUILDBOT
-	select HAS_BPF_TOOLCHAIN
+	default y if !DEVEL && NEED_BPF_TOOLCHAIN && (BUILDBOT || !HAS_PREBUILT_LLVM_TOOLCHAIN)
 	bool
 	bool
 
 
 config USE_GLIBC
 config USE_GLIBC