Release: https://github.com/llvm/llvm-project/releases/tag/llvmorg-20.1.5 Major Changes and Fixes: -- CMake 3.20 minimum required -- Issue encountered during standalone LLVM build: CMake Error at CMakeLists.txt:8 (include): include could not find requested file: This error is due to the line: include(${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake) Upstream commit [1] harmonized policy handling by introducing this shared include for all LLVM sub-projects. However, in the LLVM CMakeLists, LLVM_COMMON_CMAKE_UTILS is set unconditionally, preventing external override — which is required in Buildroot when building from separated archives. To solve this: We apply a patch to wrap the assignment of LLVM_COMMON_CMAKE_UTILS in an `if(NOT DEFINED ...)` block, allowing Buildroot to set the path externally. In the `llvm-cmake` package, we also **adjust the installation path** of the CMake modules: instead of installing directly into `lib/cmake/llvm`, we now install them under `lib/cmake/llvm/Modules` to match the expected layout. This ensures that: LLVM can include `${LLVM_COMMON_CMAKE_UTILS}/Modules/CMakePolicy.cmake` without errors. -- Also the Clang build system has removed support for the GCC_INSTALL_PREFIX option, raising a fatal error when attempting to use it: CMake Error at CMakeLists.txt:211 (message): GCC_INSTALL_PREFIX is deprecated and will be removed. Use configuration files (https://clang.llvm.org/docs/UsersManual.html#configuration-files) to specify the default --gcc-install-dir= or --gcc-triple=. --gcc-toolchain= is discouraged. See https://github.com/llvm/llvm-project/pull/77537 for details. Remove the use of GCC_INSTALL_PREFIX and replace it with a Clang configuration file as recommended by upstream. A configuration file is now automatically generated at: $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/$(GNU_TARGET_NAME).cfg It contains: --gcc-install-dir=<path to external toolchain's lib/gcc/...> --target=<GNU target triplet> We dynamically detect the GCC install path by scanning $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)/lib/gcc/<target>/<version>/ The Clang toolchain wrapper was also updated to add --config=<file> when BR_CLANG_CONFIG_FILE is defined. -- Fix LLVM_MAIN_SRC_DIR path: set(LLVM_MAIN_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../llvm" CACHE PATH ...) This path isn't correct when using standalone archive builds. We explicitly pass LLVM_MAIN_SRC_DIR=$(BUILD_DIR)/llvm-$(LLVM_PROJECT_VERSION) to fix the path. [2] -- Add LLVM_ENABLE_RUNTIMES: Upstream added LLVM_ENABLE_RUNTIMES for runtimes [3] -- Removed LLVM_INCLUDE_GO_TESTS: Upstream dropped this option; we remove it too [4] -- Disable TensorFlow Lite integration: LLVM_HAVE_TFLITE is added to the CMakelist We now explicitly disable it to avoid unexpected TensorFlow Lite dependency. -- Clang introduced CLANG_ENABLE_LIBXML2 [5] We now explicitly disable it by setting CLANG_ENABLE_LIBXLM2=OFF since we set LLVM_ENABLE_LIBXML2 to OFF in LLVM -- Host-python3, which is now always needed by Clang’s resource bundling script. [6] -- Clang explicitly request to disable llvm tests when llvm_gtest is missing.[7] CMake Error at CMakeLists.txt:126 (message): llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF -- Also update the installation path in COMPILER_RT_SETUP_RUNTIME_LIBS to use CLANG_VERSION_MAJOR instead of HOST_CLANG_VERSION, ensuring that the runtime files are placed correctly in the /lib/clang/<major>/ folder. [8] -- Add llvm-runtimes dependency libunwind needs runtimes [9] -- Fix for libclc out of tree patch Due to upstream changes in libclc, the old patch no longer applies. Only the fix related to invoking './prepare_builtins' directly is still relevant and preserved, as it is required to avoid a build failure when the binary is not in PATH. -- Upstream commit [10] removed the use of llvm-config in libclc and replaced it with proper use of LLVM_CMAKE_DIR. We now pass -DLLVM_CMAKE_DIR instead of DLLVM_CONFIG -- Libclc expects to invoke some LLVM tools. We explicitly set LIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR to ensure it finds these tools. [11] -- Remove LLAsm_COMPILER and CLC_COMPILER [12] -- LIBUNWIND_INSTALL_HEADERS is On by default [13] -- Update spirv-llvm-translator to align with LLVM 20.1.5 Release: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/releases/tag/v20.1.2 [1]9dd01a5241[2]d2b158e29e[3]176db3b3ab[4]6ce8727248[5]df239a6c17[6]96962d5512[7]8216910395[8]e1b88c8a09[9]0af67d167d[10]b264787453[11]0aeeff3059[12]72f9881c3f[13]f8409af354Signed-off-by: El Mehdi YOUNES <elmehdi.younes@smile.fr> Signed-off-by: Bernd Kuhls <bernd@kuhls.net> [Bernd: rebased, removed gcc-15 patches for llvm 15, bumped to 20.1.5] used 'git describe' to set the version number for spirv-llvm-translator] [Mehdi: changed llvm-runtimes version to $(LLVM_PROJECT_VERSION)] Signed-off-by: Julien Olivain <ju.o@free.fr>
328 lines
12 KiB
Makefile
328 lines
12 KiB
Makefile
################################################################################
|
|
#
|
|
# llvm
|
|
#
|
|
################################################################################
|
|
|
|
LLVM_VERSION = $(LLVM_PROJECT_VERSION)
|
|
LLVM_SITE = $(LLVM_PROJECT_SITE)
|
|
LLVM_SOURCE = llvm-$(LLVM_VERSION).src.tar.xz
|
|
LLVM_LICENSE = Apache-2.0 with exceptions
|
|
LLVM_LICENSE_FILES = LICENSE.TXT
|
|
LLVM_CPE_ID_VENDOR = llvm
|
|
LLVM_SUPPORTS_IN_SOURCE_BUILD = NO
|
|
LLVM_INSTALL_STAGING = YES
|
|
|
|
HOST_LLVM_DEPENDENCIES = host-python3 host-llvm-cmake
|
|
LLVM_DEPENDENCIES = host-llvm
|
|
|
|
# Path to cmake modules from host-llvm-cmake
|
|
HOST_LLVM_CONF_OPTS += -DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm
|
|
LLVM_CONF_OPTS += -DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm
|
|
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_COMMON_CMAKE_UTILS=$(HOST_DIR)/lib/cmake/llvm
|
|
LLVM_CONF_OPTS += -DLLVM_COMMON_CMAKE_UTILS=$(HOST_DIR)/lib/cmake/llvm
|
|
|
|
# Don't build clang libcxx libcxxabi lldb compiler-rt lld polly as llvm subprojects
|
|
# This flag assumes that projects are checked out side-by-side and not nested
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_PROJECTS=""
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_PROJECTS=""
|
|
|
|
# LLVM_ENABLE_RUNTIMES for runtime components libcxx etc
|
|
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RUNTIMES=""
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_RUNTIMES=""
|
|
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_CCACHE_BUILD=$(if $(BR2_CCACHE),ON,OFF)
|
|
LLVM_CONF_OPTS += -DLLVM_CCACHE_BUILD=$(if $(BR2_CCACHE),ON,OFF)
|
|
|
|
# This option prevents AddLLVM.cmake from adding $ORIGIN/../lib to
|
|
# binaries. Otherwise, llvm-config (host variant installed in STAGING)
|
|
# will try to use target's libc.
|
|
HOST_LLVM_CONF_OPTS += -DCMAKE_INSTALL_RPATH="$(HOST_DIR)/lib"
|
|
|
|
# Get target architecture
|
|
LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
|
|
|
|
# Build backend for target architecture. This include backends like
|
|
# AMDGPU. We need to special case RISCV.
|
|
ifneq ($(filter riscv%,$(LLVM_TARGET_ARCH)),)
|
|
LLVM_TARGETS_TO_BUILD = RISCV
|
|
else
|
|
LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH)
|
|
endif
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"
|
|
LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"
|
|
|
|
# LLVM target to use for native code generation. This is required for JIT generation.
|
|
# It must be set to LLVM_TARGET_ARCH for host and target, otherwise we get
|
|
# "No available targets are compatible for this triple" with llvmpipe when host
|
|
# and target architectures are different.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_TARGET_ARCH=$(LLVM_TARGET_ARCH)
|
|
LLVM_CONF_OPTS += -DLLVM_TARGET_ARCH=$(LLVM_TARGET_ARCH)
|
|
|
|
# Build AMDGPU backend
|
|
# We need to build AMDGPU backend for both host and target because
|
|
# llvm-config --targets built (host variant installed in STAGING) will
|
|
# output only $(LLVM_TARGET_ARCH) if not, and mesa3d won't build as
|
|
# it thinks AMDGPU backend is not installed on the target.
|
|
ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y)
|
|
LLVM_TARGETS_TO_BUILD += AMDGPU
|
|
endif
|
|
|
|
# Build BPF backend
|
|
ifeq ($(BR2_PACKAGE_LLVM_BPF),y)
|
|
LLVM_TARGETS_TO_BUILD += BPF
|
|
endif
|
|
|
|
# Use native llvm-tblgen from host-llvm (needed for cross-compilation)
|
|
LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen
|
|
|
|
# Use native llvm-config from host-llvm (needed for cross-compilation)
|
|
LLVM_CONF_OPTS += -DLLVM_CONFIG_PATH=$(HOST_DIR)/bin/llvm-config
|
|
|
|
# BUILD_SHARED_LIBS has a misleading name. It is in fact an option for
|
|
# LLVM developers to build all LLVM libraries as separate shared libraries.
|
|
# For normal use of LLVM, it is recommended to build a single
|
|
# shared library, which is achieved by BUILD_SHARED_LIBS=OFF and
|
|
# LLVM_BUILD_LLVM_DYLIB=ON.
|
|
HOST_LLVM_CONF_OPTS += -DBUILD_SHARED_LIBS=OFF
|
|
LLVM_CONF_OPTS += -DBUILD_SHARED_LIBS=OFF
|
|
|
|
# Generate libLLVM.so. This library contains a default set of LLVM components
|
|
# that can be overwritten with "LLVM_DYLIB_COMPONENTS". The default contains
|
|
# most of LLVM and is defined in "tools/llvm-shlib/CMakelists.txt".
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_BUILD_LLVM_DYLIB=ON
|
|
LLVM_CONF_OPTS += -DLLVM_BUILD_LLVM_DYLIB=ON
|
|
|
|
# LLVM_BUILD_LLVM_DYLIB to ON. We need to enable this option for the
|
|
# host as llvm-config for the host will be used in STAGING_DIR by packages
|
|
# linking against libLLVM and if this option is not selected, then llvm-config
|
|
# does not work properly. For example, it assumes that LLVM is built statically
|
|
# and cannot find libLLVM.so.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
|
|
LLVM_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
|
|
|
|
LLVM_CONF_OPTS += -DCMAKE_CROSSCOMPILING=1
|
|
|
|
# Disabled for the host since no host-libedit.
|
|
# Fall back to "Simple fgets-based implementation" of llvm line editor.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBEDIT=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBEDIT=OFF
|
|
|
|
# We want to install llvm libraries and modules.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_INSTALL_TOOLCHAIN_ONLY=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_INSTALL_TOOLCHAIN_ONLY=OFF
|
|
|
|
# We build from a release archive without vcs files.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_APPEND_VC_REV=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_APPEND_VC_REV=OFF
|
|
|
|
# No backtrace package in Buildroot.
|
|
# https://documentation.backtrace.io
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_BACKTRACES=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_BACKTRACES=OFF
|
|
|
|
# Enable signal handlers overrides support.
|
|
HOST_LLVM_CONF_OPTS += -DENABLE_CRASH_OVERRIDES=ON
|
|
LLVM_CONF_OPTS += -DENABLE_CRASH_OVERRIDES=ON
|
|
|
|
# Disable ffi for now.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_FFI=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_FFI=OFF
|
|
|
|
# Disable terminfo database (needs ncurses libtinfo.so)
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_TERMINFO=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_TERMINFO=OFF
|
|
|
|
# Enable thread support
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_THREADS=ON
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_THREADS=ON
|
|
|
|
# Enable optional host-zlib support for LLVM Machine Code (llvm-mc) to add
|
|
# compression/uncompression capabilities.
|
|
# Not needed on the target.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_ZLIB=ON
|
|
HOST_LLVM_DEPENDENCIES += host-zlib
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_ZLIB=OFF
|
|
|
|
# libxml2 can be disabled as it is used for LLVM Windows builds where COFF
|
|
# files include manifest info
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBXML2=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBXML2=OFF
|
|
|
|
# Disable optional Z3Prover since there is no such package in Buildroot.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_Z3_SOLVER=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_Z3_SOLVER=OFF
|
|
|
|
# We don't use llvm for static only build, so enable PIC
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_PIC=ON
|
|
|
|
# Disable TFTLite integration
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE=""
|
|
LLVM_CONF_OPTS += -DLLVM_HAVE_TFLITE=""
|
|
|
|
# Default is Debug build, which requires considerably more disk space and
|
|
# build time. Release build is selected for host and target because the linker
|
|
# can run out of memory in Debug mode.
|
|
HOST_LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
|
|
LLVM_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
|
|
|
|
# Compile llvm with the C++14 (ISO C++ 2014 standard).
|
|
HOST_LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14
|
|
LLVM_CONF_OPTS += -DCMAKE_CXX_STANDARD=14
|
|
|
|
# Disabled, requires sys/ndir.h header
|
|
# Disable debug in module
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_ENABLE_MODULES=OFF \
|
|
-DLLVM_ENABLE_MODULE_DEBUGGING=OFF
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_ENABLE_MODULES=OFF \
|
|
-DLLVM_ENABLE_MODULE_DEBUGGING=OFF
|
|
|
|
# Don't change the standard library to libc++.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBCXX=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_LIBCXX=OFF
|
|
|
|
# Don't use lld as a linker.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LLD=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_LLD=OFF
|
|
|
|
# Generate code for the target. LLVM selects a target by looking at the
|
|
# toolchain tuple
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME)
|
|
LLVM_CONF_OPTS += -DLLVM_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME)
|
|
|
|
# LLVM_HOST_TRIPLE has a misleading name, it is in fact the triple of the
|
|
# system where llvm is going to run on. We need to specify triple for native
|
|
# code generation on the target.
|
|
# This solves "No available targets are compatible for this triple" with llvmpipe
|
|
LLVM_CONF_OPTS += -DLLVM_HOST_TRIPLE=$(GNU_TARGET_NAME)
|
|
|
|
# Building the Go and OCaml bindings is yet unsupported.
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_ENABLE_BINDINGS=OFF
|
|
|
|
# Builds a release host tablegen that gets used during the LLVM build.
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_OPTIMIZED_TABLEGEN=ON
|
|
|
|
# Keep llvm utility binaries for the host. llvm-tblgen is built anyway as
|
|
# CMakeLists.txt has add_subdirectory(utils/TableGen) unconditionally.
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_UTILS=ON \
|
|
-DLLVM_INCLUDE_UTILS=ON \
|
|
-DLLVM_INSTALL_UTILS=ON
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_UTILS=OFF \
|
|
-DLLVM_INCLUDE_UTILS=OFF \
|
|
-DLLVM_INSTALL_UTILS=OFF
|
|
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_INCLUDE_TOOLS=ON \
|
|
-DLLVM_BUILD_TOOLS=ON
|
|
|
|
# We need to activate LLVM_INCLUDE_TOOLS, otherwise it does not generate
|
|
# libLLVM.so
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_INCLUDE_TOOLS=ON
|
|
|
|
ifeq ($(BR2_PACKAGE_LLVM_RTTI),y)
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=ON
|
|
else
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_RTTI=OFF
|
|
endif
|
|
|
|
HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=OFF
|
|
ifeq ($(BR2_PACKAGE_LLVM_DUMP),y)
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=ON
|
|
else
|
|
LLVM_CONF_OPTS += -DLLVM_ENABLE_DUMP=OFF
|
|
endif
|
|
|
|
# Compiler-rt not in the source tree.
|
|
# llvm runtime libraries are not in the source tree.
|
|
# Polly is not in the source tree.
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
|
|
-DLLVM_BUILD_RUNTIME=OFF \
|
|
-DLLVM_INCLUDE_RUNTIMES=OFF
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_EXTERNAL_COMPILER_RT=OFF \
|
|
-DLLVM_BUILD_RUNTIME=OFF \
|
|
-DLLVM_INCLUDE_RUNTIMES=OFF
|
|
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_ENABLE_WARNINGS=ON \
|
|
-DLLVM_ENABLE_PEDANTIC=ON \
|
|
-DLLVM_ENABLE_WERROR=OFF
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_ENABLE_WARNINGS=ON \
|
|
-DLLVM_ENABLE_PEDANTIC=ON \
|
|
-DLLVM_ENABLE_WERROR=OFF
|
|
|
|
HOST_LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_EXAMPLES=OFF \
|
|
-DLLVM_BUILD_DOCS=OFF \
|
|
-DLLVM_BUILD_TESTS=OFF \
|
|
-DLLVM_ENABLE_DOXYGEN=OFF \
|
|
-DLLVM_ENABLE_OCAMLDOC=OFF \
|
|
-DLLVM_ENABLE_SPHINX=OFF \
|
|
-DLLVM_INCLUDE_EXAMPLES=OFF \
|
|
-DLLVM_INCLUDE_DOCS=OFF \
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
|
-DLLVM_INCLUDE_BENCHMARKS=OFF
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_EXAMPLES=OFF \
|
|
-DLLVM_BUILD_DOCS=OFF \
|
|
-DLLVM_BUILD_TESTS=OFF \
|
|
-DLLVM_ENABLE_DOXYGEN=OFF \
|
|
-DLLVM_ENABLE_OCAMLDOC=OFF \
|
|
-DLLVM_ENABLE_SPHINX=OFF \
|
|
-DLLVM_INCLUDE_EXAMPLES=OFF \
|
|
-DLLVM_INCLUDE_DOCS=OFF \
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
|
-DLLVM_INCLUDE_BENCHMARKS=OFF
|
|
|
|
# Copy llvm-config (host variant) to STAGING_DIR
|
|
# llvm-config (host variant) returns include and lib directories
|
|
# for the host if it's installed in host/bin:
|
|
# output/host/bin/llvm-config --includedir
|
|
# output/host/include
|
|
# When installed in STAGING_DIR, llvm-config returns include and lib
|
|
# directories from STAGING_DIR.
|
|
# output/staging/usr/bin/llvm-config --includedir
|
|
# output/staging/usr/include
|
|
define LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
|
|
$(INSTALL) -D -m 0755 $(HOST_DIR)/bin/llvm-config \
|
|
$(STAGING_DIR)/usr/bin/llvm-config
|
|
endef
|
|
HOST_LLVM_POST_INSTALL_HOOKS = LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
|
|
|
|
# The llvm-symbolizer binary is used by the Compiler-RT Fuzzer
|
|
# and AddressSanitizer tools on the target for stack traces.
|
|
# If we set -DLLVM_BUILD_TOOLS=ON this will also install the llvm-config
|
|
# target binary to STAGING_DIR, which means we can no longer run it.
|
|
# Therefore, overwrite it again with the host llvm-config.
|
|
ifeq ($(BR2_PACKAGE_COMPILER_RT),y)
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_TOOLS=ON
|
|
LLVM_POST_INSTALL_STAGING_HOOKS = LLVM_COPY_LLVM_CONFIG_TO_STAGING_DIR
|
|
else
|
|
LLVM_CONF_OPTS += \
|
|
-DLLVM_BUILD_TOOLS=OFF
|
|
endif
|
|
|
|
# By default llvm-tblgen is built and installed on the target but it is
|
|
# not necessary. Also erase LLVMHello.so from /usr/lib
|
|
define LLVM_DELETE_LLVM_TBLGEN_TARGET
|
|
rm -f $(TARGET_DIR)/usr/bin/llvm-tblgen $(TARGET_DIR)/usr/lib/LLVMHello.so
|
|
endef
|
|
LLVM_POST_INSTALL_TARGET_HOOKS = LLVM_DELETE_LLVM_TBLGEN_TARGET
|
|
|
|
$(eval $(cmake-package))
|
|
$(eval $(host-cmake-package))
|