aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-bpf/Makefile
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-11-04 15:16:07 +0100
committerFelix Fietkau <nbd@nbd.name>2021-11-04 16:59:22 +0100
commit2a832b3df5990f33aa3d5944733e43bf5287475c (patch)
tree205a4a2cc0956ef685b92b1b4fc611528627a367 /tools/llvm-bpf/Makefile
parenta7c0d7c06c5b353c98f6db6b0b766d2ff3dd6887 (diff)
downloadupstream-2a832b3df5990f33aa3d5944733e43bf5287475c.tar.gz
upstream-2a832b3df5990f33aa3d5944733e43bf5287475c.tar.bz2
upstream-2a832b3df5990f33aa3d5944733e43bf5287475c.zip
llvm-bpf: support creating a tarball in bin
This can be used for adding the toolchain to an existing tree without having to build it from scratch. Enable building the toolchain + tarball by default on buildbot Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'tools/llvm-bpf/Makefile')
-rw-r--r--tools/llvm-bpf/Makefile25
1 files changed, 24 insertions, 1 deletions
diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile
index ae279d26d2..a9fcc04495 100644
--- a/tools/llvm-bpf/Makefile
+++ b/tools/llvm-bpf/Makefile
@@ -24,7 +24,9 @@ CMAKE_SOURCE_SUBDIR := llvm
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
-CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/llvm-bpf
+LLVM_BPF_PREFIX = llvm-bpf-$(PKG_VERSION).$(HOST_OS)-$(HOST_ARCH)
+
+CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/$(LLVM_BPF_PREFIX)
CMAKE_HOST_OPTIONS += \
-DLLVM_ENABLE_BINDINGS=OFF \
@@ -39,4 +41,25 @@ CMAKE_HOST_OPTIONS += \
-DLLVM_TOOLCHAIN_TOOLS="llvm-objcopy;llvm-objdump;llvm-readelf;llvm-strip;llvm-ar;llvm-as;llvm-dis;llvm-link;llvm-nm;llvm-ranlib;llc;opt" \
-DCMAKE_SKIP_RPATH=OFF
+ifneq ($(CONFIG_SDK_LLVM_BPF),)
+ define Host/Install/Bin
+ echo "$(PKG_VERSION)" > $(CMAKE_HOST_INSTALL_PREFIX)/.llvm-version
+ STRIP_KMOD= PATCHELF= STRIP=strip $(SCRIPT_DIR)/rstrip.sh $(STAGING_DIR_HOST)/llvm-bpf
+ tar -C $(STAGING_DIR_HOST) \
+ -I '$(STAGING_DIR_HOST)/bin/xz -7e -T$(if $(filter 1,$(NPROC)),2,0)' \
+ -cf $(BIN_DIR)/llvm-bpf-$(PKG_VERSION).tar.xz llvm-bpf $(LLVM_BPF_PREFIX)
+ endef
+endif
+
+define Host/Install
+ rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
+ $(Host/Install/Default)
+ ln -s $(LLVM_BPF_PREFIX) $(STAGING_DIR_HOST)/llvm-bpf
+ $(Host/Install/Bin)
+endef
+
+define Host/Uninstall
+ rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
+endef
+
$(eval $(call HostBuild))