2021-10-17 15:50:53 +00:00
|
|
|
#
|
|
|
|
# Copyright (C) 2006-2016 OpenWrt.org
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
#
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
|
|
|
|
PKG_NAME:=llvm-project
|
2024-06-19 16:43:51 +00:00
|
|
|
PKG_VERSION:=18.1.7
|
2021-10-17 15:50:53 +00:00
|
|
|
|
|
|
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
|
|
|
|
PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
|
2024-06-19 16:43:51 +00:00
|
|
|
PKG_HASH:=74446ab6943f686391954cbda0d77ae92e8a60c432eff437b8666e121d748ec4
|
2023-09-18 22:10:03 +00:00
|
|
|
PKG_CPE_ID:=cpe:/a:llvm:llvm
|
2021-10-17 15:50:53 +00:00
|
|
|
|
|
|
|
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src
|
|
|
|
|
|
|
|
CMAKE_BINARY_SUBDIR := build
|
|
|
|
CMAKE_SOURCE_SUBDIR := llvm
|
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/host-build.mk
|
|
|
|
include $(INCLUDE_DIR)/cmake.mk
|
|
|
|
|
2024-09-20 14:55:45 +00:00
|
|
|
ifneq ($(HOST_OS),Linux)
|
|
|
|
HOST_CFLAGS := $(filter-out -I$(STAGING_DIR_HOST)/include,$(HOST_CFLAGS))
|
|
|
|
HOST_CXXFLAGS := $(filter-out -I$(STAGING_DIR_HOST)/include,$(HOST_CXXFLAGS))
|
|
|
|
endif
|
|
|
|
|
2021-11-04 14:16:07 +00:00
|
|
|
LLVM_BPF_PREFIX = llvm-bpf-$(PKG_VERSION).$(HOST_OS)-$(HOST_ARCH)
|
|
|
|
|
|
|
|
CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/$(LLVM_BPF_PREFIX)
|
2021-11-02 18:38:12 +00:00
|
|
|
|
2021-10-17 15:50:53 +00:00
|
|
|
CMAKE_HOST_OPTIONS += \
|
|
|
|
-DLLVM_TARGETS_TO_BUILD=BPF \
|
2024-06-19 16:43:51 +00:00
|
|
|
-DLLVM_DEFAULT_TARGET_TRIPLE=bpf \
|
|
|
|
-DLLVM_ENABLE_PROJECTS="clang;lld" \
|
2021-11-02 18:38:12 +00:00
|
|
|
-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
|
|
|
|
-DLLVM_LINK_LLVM_DYLIB=ON \
|
|
|
|
-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" \
|
2024-06-19 16:43:51 +00:00
|
|
|
-DLLVM_INCLUDE_BENCHMARKS=OFF \
|
|
|
|
-DLLVM_INCLUDE_DOCS=OFF \
|
|
|
|
-DLLVM_INCLUDE_EXAMPLES=OFF \
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
|
|
|
-DLLVM_ENABLE_BINDINGS=OFF \
|
|
|
|
-DLLVM_ENABLE_IDE=OFF \
|
|
|
|
-DLLVM_ENABLE_LIBEDIT=OFF \
|
|
|
|
-DLLVM_ENABLE_LIBPFM=OFF \
|
|
|
|
-DLLVM_ENABLE_LIBXML2=OFF \
|
|
|
|
-DLLVM_ENABLE_OCAMLDOC=OFF \
|
|
|
|
-DLLVM_ENABLE_TERMINFO=OFF \
|
|
|
|
-DLLVM_ENABLE_Z3_SOLVER=OFF \
|
|
|
|
-DLLVM_ENABLE_ZLIB=OFF \
|
|
|
|
-DLLVM_ENABLE_ZSTD=OFF \
|
|
|
|
-DLLVM_PARALLEL_LINK_JOBS=1 \
|
2021-11-02 18:38:12 +00:00
|
|
|
-DCMAKE_SKIP_RPATH=OFF
|
2021-10-17 15:50:53 +00:00
|
|
|
|
2021-11-04 14:16:07 +00:00
|
|
|
define Host/Install
|
|
|
|
rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
|
|
|
|
$(Host/Install/Default)
|
|
|
|
ln -s $(LLVM_BPF_PREFIX) $(STAGING_DIR_HOST)/llvm-bpf
|
2021-11-22 09:43:43 +00:00
|
|
|
STRIP_KMOD= PATCHELF= STRIP=strip $(SCRIPT_DIR)/rstrip.sh $(STAGING_DIR_HOST)/llvm-bpf
|
|
|
|
echo "$(PKG_VERSION)" > $(CMAKE_HOST_INSTALL_PREFIX)/.llvm-version
|
2021-11-04 14:16:07 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
define Host/Uninstall
|
|
|
|
rm -rf $(STAGING_DIR_HOST)/llvm-bpf*
|
|
|
|
endef
|
|
|
|
|
2021-10-17 15:50:53 +00:00
|
|
|
$(eval $(call HostBuild))
|