Skip to content

Commit 8cd50a6

Browse files
committed
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 <nbd@nbd.name> (cherry picked from commit 6605e45)
1 parent 7609571 commit 8cd50a6

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

include/bpf.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
1+
BPF_DEPENDS := @HAS_BPF_TOOLCHAIN +@NEED_BPF_TOOLCHAIN
22
LLVM_VER:=
33

44
CLANG_MIN_VER:=12

package/network/services/unetd/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ define Package/unetd/config
4040
bool "VXLAN support"
4141
depends on PACKAGE_unetd
4242
depends on HAS_BPF_TOOLCHAIN
43+
select NEED_BPF_TOOLCHAIN
4344
default y
4445

4546
endef

toolchain/Config.in

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ menuconfig TARGET_OPTIONS
4040

4141
choice BPF_TOOLCHAIN
4242
prompt "BPF toolchain" if DEVEL
43-
default BPF_TOOLCHAIN_BUILD_LLVM if BUILDBOT
4443
default BPF_TOOLCHAIN_PREBUILT if HAS_PREBUILT_LLVM_TOOLCHAIN
45-
default BPF_TOOLCHAIN_NONE
44+
default BPF_TOOLCHAIN_BUILD_LLVM
4645

4746
config BPF_TOOLCHAIN_NONE
4847
bool "None"
@@ -57,7 +56,7 @@ menuconfig TARGET_OPTIONS
5756
bool "Use host LLVM toolchain"
5857

5958
config BPF_TOOLCHAIN_BUILD_LLVM
60-
select USE_LLVM_BUILD
59+
select USE_LLVM_BUILD if NEED_BPF_TOOLCHAIN
6160
bool "Build LLVM toolchain for eBPF"
6261
help
6362
If enabled, a LLVM toolchain for building eBPF binaries will be built.
@@ -320,23 +319,24 @@ config GDB_PYTHON
320319
Enable the python bindings for GDB to allow using python in the gdb shell.
321320

322321
config HAS_BPF_TOOLCHAIN
322+
default y if !BPF_TOOLCHAIN_NONE
323+
bool
324+
325+
config NEED_BPF_TOOLCHAIN
323326
bool
324327

325328
config HAS_PREBUILT_LLVM_TOOLCHAIN
326329
def_bool $(shell, [ -f llvm-bpf/.llvm-version ] && echo y || echo n)
327330

328331
config USE_LLVM_HOST
329-
select HAS_BPF_TOOLCHAIN
330332
bool
331333

332334
config USE_LLVM_PREBUILT
333-
select HAS_BPF_TOOLCHAIN
334335
default y if !DEVEL && !BUILDBOT && HAS_PREBUILT_LLVM_TOOLCHAIN
335336
bool
336337

337338
config USE_LLVM_BUILD
338-
default y if !DEVEL && BUILDBOT
339-
select HAS_BPF_TOOLCHAIN
339+
default y if !DEVEL && NEED_BPF_TOOLCHAIN && (BUILDBOT || !HAS_PREBUILT_LLVM_TOOLCHAIN)
340340
bool
341341

342342
config USE_GLIBC

0 commit comments

Comments
 (0)