Initial Commit
- initial default booting image
This commit is contained in:
28
package/llvm-project/clang/Config.in
Normal file
28
package/llvm-project/clang/Config.in
Normal file
@@ -0,0 +1,28 @@
|
||||
config BR2_PACKAGE_CLANG
|
||||
bool "clang"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
|
||||
depends on !BR2_STATIC_LIBS
|
||||
depends on BR2_USE_WCHAR # std::wstring
|
||||
depends on BR2_HOST_GCC_AT_LEAST_7
|
||||
select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
|
||||
select BR2_PACKAGE_LLVM
|
||||
help
|
||||
Clang is a C/C++, Objective C/C++ and OpenCL C front-end
|
||||
for the LLVM compiler.
|
||||
|
||||
http://clang.llvm.org
|
||||
|
||||
comment "clang needs a toolchain w/ wchar, threads, C++, gcc >= 7, dynamic library, host gcc >= 7"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
|
||||
!BR2_TOOLCHAIN_GCC_AT_LEAST_7 \
|
||||
|| BR2_STATIC_LIBS || !BR2_USE_WCHAR \
|
||||
|| !BR2_HOST_GCC_AT_LEAST_7
|
||||
|
||||
comment "clang needs a toolchain not affected by GCC bug 64735"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
|
||||
1
package/llvm-project/clang/clang.hash
Symbolic link
1
package/llvm-project/clang/clang.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
160
package/llvm-project/clang/clang.mk
Normal file
160
package/llvm-project/clang/clang.mk
Normal file
@@ -0,0 +1,160 @@
|
||||
################################################################################
|
||||
#
|
||||
# clang
|
||||
#
|
||||
################################################################################
|
||||
|
||||
CLANG_VERSION_MAJOR = $(LLVM_PROJECT_VERSION_MAJOR)
|
||||
CLANG_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
CLANG_SITE = $(LLVM_PROJECT_SITE)
|
||||
CLANG_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
CLANG_DL_SUBDIR = llvm-project
|
||||
CLANG_LICENSE = Apache-2.0 with exceptions
|
||||
CLANG_LICENSE_FILES = LICENSE.TXT
|
||||
CLANG_CPE_ID_VENDOR = llvm
|
||||
CLANG_SUBDIR = clang
|
||||
CLANG_SUPPORTS_IN_SOURCE_BUILD = NO
|
||||
CLANG_INSTALL_STAGING = YES
|
||||
|
||||
HOST_CLANG_DEPENDENCIES = host-llvm host-libxml2 host-python3
|
||||
CLANG_DEPENDENCIES = llvm host-clang
|
||||
|
||||
# since we have LLVM_ENABLE_LIBXML2=OFF, set CLANG_ENABLE_LIBXML2=OFF
|
||||
CLANG_CONF_OPTS += -DCLANG_ENABLE_LIBXML2=OFF
|
||||
|
||||
# This option is needed, otherwise multiple shared libs
|
||||
# (libclangAST.so, libclangBasic.so, libclangFrontend.so, etc.) will
|
||||
# be generated. As a final shared lib containing all these components
|
||||
# (libclang.so) is also generated, this resulted in the following
|
||||
# error when trying to use tools that use libclang:
|
||||
# $ CommandLine Error: Option 'track-memory' registered more than once!
|
||||
# $ LLVM ERROR: inconsistency in registered CommandLine options
|
||||
# By setting BUILD_SHARED_LIBS to OFF, we generate multiple static
|
||||
# libraries (the same way as host's clang build) and finally
|
||||
# libclang.so to be installed on the target.
|
||||
HOST_CLANG_CONF_OPTS += -DBUILD_SHARED_LIBS=OFF
|
||||
CLANG_CONF_OPTS += -DBUILD_SHARED_LIBS=OFF
|
||||
|
||||
# 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_CLANG_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
|
||||
CLANG_CONF_OPTS += -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
CLANG_CONF_OPTS += -DCMAKE_CROSSCOMPILING=1
|
||||
|
||||
# We need to build tools because libclang is a tool
|
||||
HOST_CLANG_CONF_OPTS += -DCLANG_BUILD_TOOLS=ON
|
||||
CLANG_CONF_OPTS += -DCLANG_BUILD_TOOLS=ON
|
||||
|
||||
HOST_CLANG_CONF_OPTS += \
|
||||
-DCLANG_BUILD_EXAMPLES=OFF \
|
||||
-DCLANG_INCLUDE_DOCS=OFF \
|
||||
-DCLANG_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_INCLUDE_TESTS=OFF
|
||||
|
||||
CLANG_CONF_OPTS += \
|
||||
-DCLANG_BUILD_EXAMPLES=OFF \
|
||||
-DCLANG_INCLUDE_DOCS=OFF \
|
||||
-DCLANG_INCLUDE_TESTS=OFF \
|
||||
-DLLVM_INCLUDE_TESTS=OFF
|
||||
|
||||
HOST_CLANG_CONF_OPTS += -DLLVM_DIR=$(HOST_DIR)/lib/cmake/llvm \
|
||||
-DCLANG_DEFAULT_LINKER=$(TARGET_LD)
|
||||
CLANG_CONF_OPTS += -DLLVM_DIR=$(STAGING_DIR)/usr/lib/cmake/llvm \
|
||||
-DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm \
|
||||
-DCLANG_TABLEGEN:FILEPATH=$(HOST_DIR)/bin/clang-tblgen \
|
||||
-DLLVM_TABLEGEN_EXE:FILEPATH=$(HOST_DIR)/bin/llvm-tblgen
|
||||
|
||||
HOST_CLANG_CONF_OPTS += -DLLVM_COMMON_CMAKE_UTILS=$(HOST_DIR)/lib/cmake/llvm
|
||||
CLANG_CONF_OPTS += -DLLVM_COMMON_CMAKE_UTILS=$(HOST_DIR)/lib/cmake/llvm
|
||||
|
||||
HOST_CLANG_CONF_OPTS += -DLLVM_MAIN_SRC_DIR=$(BUILD_DIR)/llvm-$(LLVM_PROJECT_VERSION)
|
||||
CLANG_CONF_OPTS += -DLLVM_MAIN_SRC_DIR=$(BUILD_DIR)/llvm-$(LLVM_PROJECT_VERSION)
|
||||
|
||||
# Clang can't be used as compiler on the target since there are no
|
||||
# development files (headers) and other build tools. So remove clang
|
||||
# binaries and some other unnecessary files from target.
|
||||
CLANG_FILES_TO_REMOVE = \
|
||||
/usr/bin/clang* \
|
||||
/usr/bin/c-index-test \
|
||||
/usr/bin/git-clang-format \
|
||||
/usr/bin/scan-build \
|
||||
/usr/bin/scan-view \
|
||||
/usr/libexec/c++-analyzer \
|
||||
/usr/libexec/ccc-analyzer \
|
||||
/usr/share/clang \
|
||||
/usr/share/scan-build \
|
||||
/usr/share/scan-view \
|
||||
/usr/share/man/man1/scan-build.1 \
|
||||
/usr/lib/clang
|
||||
|
||||
define CLANG_CLEANUP_TARGET
|
||||
rm -rf $(addprefix $(TARGET_DIR),$(CLANG_FILES_TO_REMOVE))
|
||||
endef
|
||||
CLANG_POST_INSTALL_TARGET_HOOKS += CLANG_CLEANUP_TARGET
|
||||
|
||||
# clang-tblgen is not installed by default, however it is necessary
|
||||
# for cross-compiling clang
|
||||
define HOST_CLANG_INSTALL_CLANG_TBLGEN
|
||||
$(INSTALL) -D -m 0755 $(HOST_CLANG_BUILDDIR)/bin/clang-tblgen \
|
||||
$(HOST_DIR)/bin/clang-tblgen
|
||||
endef
|
||||
HOST_CLANG_POST_INSTALL_HOOKS = HOST_CLANG_INSTALL_CLANG_TBLGEN
|
||||
|
||||
# This option must be enabled to link libclang dynamically against libLLVM.so
|
||||
HOST_CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
|
||||
CLANG_CONF_OPTS += -DLLVM_LINK_LLVM_DYLIB=ON
|
||||
|
||||
# Prevent clang binaries from linking against LLVM static libs
|
||||
HOST_CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
|
||||
CLANG_CONF_OPTS += -DLLVM_DYLIB_COMPONENTS=all
|
||||
|
||||
# host-python3 is a permanent dependency of clang, so we can build the
|
||||
# python bindings unconditionally:
|
||||
HOST_CLANG_CONF_OPTS += -DCLANG_PYTHON_BINDINGS_VERSIONS=$(PYTHON3_VERSION_MAJOR)
|
||||
|
||||
# Help host-clang to find our external toolchain, use a relative path from the clang
|
||||
# installation directory to the external toolchain installation directory in order to
|
||||
# not hardcode the toolchain absolute path.
|
||||
ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
|
||||
define HOST_CLANG_INSTALL_CONFIG_FILE
|
||||
mkdir -p $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)
|
||||
echo "--gcc-install-dir=$$($(TARGET_CC) -print-search-dirs | awk -F ': ' '$$1=="install" {print $$2}')" > $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/$(GNU_TARGET_NAME).cfg
|
||||
echo "--target=$(GNU_TARGET_NAME)" >> $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/$(GNU_TARGET_NAME).cfg
|
||||
endef
|
||||
|
||||
HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_INSTALL_CONFIG_FILE
|
||||
HOST_CLANG_TOOLCHAIN_WRAPPER_ARGS += -DBR_CLANG_CONFIG_FILE="\"--config=$(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/$(GNU_TARGET_NAME).cfg\""
|
||||
endif
|
||||
|
||||
define HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
|
||||
$(Q)cd $(HOST_DIR)/bin; \
|
||||
rm -f clang-$(CLANG_VERSION_MAJOR).br_real; \
|
||||
mv clang-$(CLANG_VERSION_MAJOR) clang-$(CLANG_VERSION_MAJOR).br_real; \
|
||||
ln -sf toolchain-wrapper-clang clang-$(CLANG_VERSION_MAJOR); \
|
||||
for i in clang clang++ clang-cl clang-cpp; do \
|
||||
ln -snf toolchain-wrapper-clang $$i; \
|
||||
ln -snf clang-$(CLANG_VERSION_MAJOR).br_real $$i.br_real; \
|
||||
done
|
||||
endef
|
||||
|
||||
define HOST_CLANG_TOOLCHAIN_WRAPPER_BUILD
|
||||
$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_WRAPPER_ARGS) \
|
||||
-s -Wl,--hash-style=$(TOOLCHAIN_WRAPPER_HASH_STYLE) \
|
||||
toolchain/toolchain-wrapper.c \
|
||||
-o $(@D)/clang/toolchain-wrapper-clang
|
||||
endef
|
||||
|
||||
define HOST_CLANG_TOOLCHAIN_WRAPPER_INSTALL
|
||||
$(INSTALL) -D -m 0755 $(@D)/clang/toolchain-wrapper-clang \
|
||||
$(HOST_DIR)/bin/toolchain-wrapper-clang
|
||||
endef
|
||||
|
||||
HOST_CLANG_TOOLCHAIN_WRAPPER_ARGS += -DBR_CROSS_PATH_SUFFIX='".br_real"'
|
||||
HOST_CLANG_POST_BUILD_HOOKS += HOST_CLANG_TOOLCHAIN_WRAPPER_BUILD
|
||||
HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_TOOLCHAIN_WRAPPER_INSTALL
|
||||
HOST_CLANG_POST_INSTALL_HOOKS += HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
|
||||
|
||||
$(eval $(cmake-package))
|
||||
$(eval $(host-cmake-package))
|
||||
@@ -0,0 +1,70 @@
|
||||
From 4e1af872f819782bd233ab21953ab92cf36ff9c3 Mon Sep 17 00:00:00 2001
|
||||
From: Bernd Kuhls <bernd@kuhls.net>
|
||||
Date: Mon, 9 Mar 2026 19:07:10 +0100
|
||||
Subject: [PATCH] [libc] Fix detection of cfloat128
|
||||
|
||||
Building compiler-rt with aarch64-buildroot-linux-gnu-gcc 15.2 causes a
|
||||
build error:
|
||||
|
||||
compiler-rt-22.1.0/cmake/Modules/../../libc/src/__support/CPP/type_traits/is_complex.h:44:31:
|
||||
error: 'cfloat128' was not declared in this scope; did you mean 'float128'? [-Wtemplate-body]
|
||||
|
||||
According to https://gcc.gnu.org/onlinedocs/gcc-15.2.0/gcc/Floating-Types.html
|
||||
__float128 is not available on aarch64.
|
||||
|
||||
Analyzing the gcc defines for aarch64 seems to prove it:
|
||||
|
||||
$ aarch64-buildroot-linux-gnu-gcc -v
|
||||
Target: aarch64-buildroot-linux-gnu
|
||||
gcc version 15.2.0 (Buildroot 2026.02-114-gdadec9da56)
|
||||
|
||||
$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep __GCC_IEC_559_COMPLEX
|
||||
#define __GCC_IEC_559_COMPLEX 2
|
||||
|
||||
$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep __STDC_IEC_60559_COMPLEX__
|
||||
#define __STDC_IEC_60559_COMPLEX__ 201404L
|
||||
|
||||
$ echo | aarch64-buildroot-linux-gnu-gcc -dM -E - | grep -i float128
|
||||
$
|
||||
|
||||
In contrast gcc for x86_64:
|
||||
|
||||
$ x86_64-buildroot-linux-gnu-gcc -v
|
||||
Target: x86_64-buildroot-linux-gnu
|
||||
gcc version 15.2.0 (Buildroot 2026.02-112-gd12ac02486)
|
||||
|
||||
$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep __GCC_IEC_559_COMPLEX
|
||||
#define __GCC_IEC_559_COMPLEX 2
|
||||
|
||||
$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep __STDC_IEC_60559_COMPLEX__
|
||||
#define __STDC_IEC_60559_COMPLEX__ 201404L
|
||||
|
||||
$ echo | x86_64-buildroot-linux-gnu-gcc -dM -E - | grep -i float128
|
||||
#define __SIZEOF_FLOAT128__ 16
|
||||
|
||||
This patch changes the or-condition to an and-condition for
|
||||
__STDC_IEC_60559_COMPLEX__ and __SIZEOF_FLOAT128__.
|
||||
|
||||
Upstream: https://github.com/llvm/llvm-project/pull/185486
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
libc/include/llvm-libc-macros/cfloat128-macros.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/libc/include/llvm-libc-macros/cfloat128-macros.h b/libc/include/llvm-libc-macros/cfloat128-macros.h
|
||||
index 5f28cfa21aae..ff4aa530685d 100644
|
||||
--- a/libc/include/llvm-libc-macros/cfloat128-macros.h
|
||||
+++ b/libc/include/llvm-libc-macros/cfloat128-macros.h
|
||||
@@ -27,7 +27,7 @@
|
||||
#define LIBC_TYPES_HAS_CFLOAT128
|
||||
#endif
|
||||
#elif defined(__GNUC__)
|
||||
-#if (defined(__STDC_IEC_60559_COMPLEX__) || defined(__SIZEOF_FLOAT128__)) && \
|
||||
+#if (defined(__STDC_IEC_60559_COMPLEX__) && defined(__SIZEOF_FLOAT128__)) && \
|
||||
(__GNUC__ >= 13 || (!defined(__cplusplus)))
|
||||
#define LIBC_TYPES_HAS_CFLOAT128
|
||||
#endif
|
||||
--
|
||||
2.47.3
|
||||
|
||||
19
package/llvm-project/compiler-rt/Config.in
Normal file
19
package/llvm-project/compiler-rt/Config.in
Normal file
@@ -0,0 +1,19 @@
|
||||
config BR2_PACKAGE_COMPILER_RT
|
||||
bool "compiler-rt"
|
||||
depends on BR2_PACKAGE_LLVM
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_15
|
||||
depends on BR2_TOOLCHAIN_USES_GLIBC # asan lib requires
|
||||
depends on BR2_HOST_GCC_AT_LEAST_7 # host-clang
|
||||
select BR2_PACKAGE_LIBXCRYPT
|
||||
select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
|
||||
help
|
||||
A collection of runtime libraries primarily used by clang and
|
||||
llvm to provide builtins, sanitizer runtimes, and profiling
|
||||
at runtime.
|
||||
|
||||
https://compiler-rt.llvm.org/
|
||||
|
||||
comment "compiler-rt requires llvm to be enabled, a glibc toolchain, gcc >= 15, host gcc >= 7"
|
||||
depends on !BR2_PACKAGE_LLVM
|
||||
depends on !BR2_TOOLCHAIN_USES_GLIBC || !BR2_HOST_GCC_AT_LEAST_7 \
|
||||
|| !BR2_TOOLCHAIN_GCC_AT_LEAST_15
|
||||
1
package/llvm-project/compiler-rt/compiler-rt.hash
Symbolic link
1
package/llvm-project/compiler-rt/compiler-rt.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
41
package/llvm-project/compiler-rt/compiler-rt.mk
Normal file
41
package/llvm-project/compiler-rt/compiler-rt.mk
Normal file
@@ -0,0 +1,41 @@
|
||||
################################################################################
|
||||
#
|
||||
# compiler-rt
|
||||
#
|
||||
################################################################################
|
||||
|
||||
COMPILER_RT_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
COMPILER_RT_SITE = $(LLVM_PROJECT_SITE)
|
||||
COMPILER_RT_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
COMPILER_RT_DL_SUBDIR = llvm-project
|
||||
COMPILER_RT_LICENSE = NCSA MIT
|
||||
COMPILER_RT_LICENSE_FILES = LICENSE.TXT
|
||||
COMPILER_RT_CPE_ID_VENDOR = llvm
|
||||
COMPILER_RT_DEPENDENCIES = host-clang libxcrypt llvm
|
||||
COMPILER_RT_SUBDIR = compiler-rt
|
||||
COMPILER_RT_SUPPORTS_IN_SOURCE_BUILD = NO
|
||||
|
||||
COMPILER_RT_INSTALL_STAGING = YES
|
||||
COMPILER_RT_INSTALL_TARGET = NO
|
||||
|
||||
COMPILER_RT_CONF_OPTS = \
|
||||
-DCOMPILER_RT_STANDALONE_BUILD=ON \
|
||||
-DCOMPILER_RT_DEFAULT_TARGET_TRIPLE=$(GNU_TARGET_NAME) \
|
||||
-DLLVM_CONFIG_PATH=$(HOST_DIR)/bin/llvm-config \
|
||||
-DCMAKE_MODULE_PATH=$(HOST_DIR)/lib/cmake/llvm \
|
||||
-DLLVM_COMMON_CMAKE_UTILS=$(HOST_DIR)/lib/cmake/llvm
|
||||
|
||||
# The installation of the target runtime libraries defaults to DESTDIR, however
|
||||
# host-clang resources directory needs a link so Clang can find the runtime
|
||||
# libraries in the same location they would be if built as part of the Clang
|
||||
# build. The "resources" directory is loosely documented and seems to be
|
||||
# assumed, as compiler-rt is usually build at the same time as Clang and not
|
||||
# standalone.
|
||||
define COMPILER_RT_SETUP_RUNTIME_LIBS
|
||||
mkdir -p $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/lib
|
||||
ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/lib/linux $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/lib/linux
|
||||
ln -sf ../../../../$(GNU_TARGET_NAME)/sysroot/usr/share $(HOST_DIR)/lib/clang/$(CLANG_VERSION_MAJOR)/share
|
||||
endef
|
||||
COMPILER_RT_POST_INSTALL_STAGING_HOOKS += COMPILER_RT_SETUP_RUNTIME_LIBS
|
||||
|
||||
$(eval $(cmake-package))
|
||||
15
package/llvm-project/libclc/Config.in
Normal file
15
package/llvm-project/libclc/Config.in
Normal file
@@ -0,0 +1,15 @@
|
||||
config BR2_PACKAGE_LIBCLC
|
||||
bool "libclc"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
|
||||
select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
|
||||
help
|
||||
libclc is an open source, BSD licensed implementation of
|
||||
the library requirements of the OpenCL C programming language,
|
||||
as specified by the OpenCL 1.1 Specification.
|
||||
|
||||
http://libclc.llvm.org/
|
||||
|
||||
comment "libclc needs host gcc >= 7"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on !BR2_HOST_GCC_AT_LEAST_7
|
||||
1
package/llvm-project/libclc/libclc.hash
Symbolic link
1
package/llvm-project/libclc/libclc.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
48
package/llvm-project/libclc/libclc.mk
Normal file
48
package/llvm-project/libclc/libclc.mk
Normal file
@@ -0,0 +1,48 @@
|
||||
################################################################################
|
||||
#
|
||||
# libclc
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LIBCLC_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
LIBCLC_SITE = $(LLVM_PROJECT_SITE)
|
||||
LIBCLC_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
LIBCLC_DL_SUBDIR = llvm-project
|
||||
LIBCLC_LICENSE = Apache-2.0 with exceptions or MIT
|
||||
LIBCLC_LICENSE_FILES = LICENSE.TXT
|
||||
LIBCLC_SUBDIR= libclc
|
||||
|
||||
LIBCLC_DEPENDENCIES = host-clang host-llvm host-spirv-llvm-translator
|
||||
HOST_LIBCLC_DEPENDENCIES = host-clang host-llvm host-spirv-llvm-translator
|
||||
LIBCLC_INSTALL_STAGING = YES
|
||||
|
||||
# CMAKE_*_COMPILER_FORCED=ON skips testing the tools and assumes
|
||||
# llvm-config provided values
|
||||
#
|
||||
# CMAKE_*_COMPILER has to be set to the host compiler to build a host
|
||||
# 'prepare_builtins' tool used during the build process
|
||||
#
|
||||
# The headers are installed in /usr/share and not /usr/include,
|
||||
# because they are needed at runtime on the target to build the OpenCL
|
||||
# kernels.
|
||||
LIBCLC_CONF_OPTS = \
|
||||
-DCMAKE_SYSROOT="" \
|
||||
-DCMAKE_C_COMPILER_FORCED=ON \
|
||||
-DCMAKE_CXX_COMPILER_FORCED=ON \
|
||||
-DCMAKE_INSTALL_DATADIR="share" \
|
||||
-DCMAKE_FIND_ROOT_PATH="$(HOST_DIR)" \
|
||||
-DCMAKE_C_FLAGS="$(HOST_CFLAGS)" \
|
||||
-DCMAKE_CXX_FLAGS="$(HOST_CXXFLAGS)" \
|
||||
-DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
|
||||
-DCMAKE_SHARED_LINKER_FLAGS="$(HOST_LDFLAGS)" \
|
||||
-DCMAKE_MODULE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
|
||||
-DCMAKE_C_COMPILER="$(CMAKE_HOST_C_COMPILER)" \
|
||||
-DCMAKE_CXX_COMPILER="$(CMAKE_HOST_CXX_COMPILER)" \
|
||||
-DLLVM_CMAKE_DIR="$(HOST_DIR)/lib/cmake/llvm" \
|
||||
-DLIBCLC_CUSTOM_LLVM_TOOLS_BINARY_DIR="$(HOST_DIR)/bin"
|
||||
|
||||
HOST_LIBCLC_CONF_OPTS = \
|
||||
-DLIBCLC_TARGETS_TO_BUILD=spirv64-mesa3d-
|
||||
|
||||
$(eval $(cmake-package))
|
||||
$(eval $(host-cmake-package))
|
||||
16
package/llvm-project/lld/Config.in.host
Normal file
16
package/llvm-project/lld/Config.in.host
Normal file
@@ -0,0 +1,16 @@
|
||||
config BR2_PACKAGE_HOST_LLD
|
||||
bool "host lld"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS # llvm
|
||||
depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
|
||||
select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
|
||||
help
|
||||
LLD is a linker from the LLVM project that is a drop-in
|
||||
replacement for system linkers, and runs much faster than
|
||||
them. It also provides features that are useful for
|
||||
toolchain developers.
|
||||
|
||||
https://lld.llvm.org/
|
||||
|
||||
comment "host lld needs host gcc >= 7"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on !BR2_HOST_GCC_AT_LEAST_7
|
||||
1
package/llvm-project/lld/lld.hash
Symbolic link
1
package/llvm-project/lld/lld.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
31
package/llvm-project/lld/lld.mk
Normal file
31
package/llvm-project/lld/lld.mk
Normal file
@@ -0,0 +1,31 @@
|
||||
################################################################################
|
||||
#
|
||||
# lld
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLD_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
LLD_SITE = $(LLVM_PROJECT_SITE)
|
||||
LLD_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
LLD_DL_SUBDIR = llvm-project
|
||||
LLD_LICENSE = Apache-2.0 with exceptions
|
||||
LLD_LICENSE_FILES = LICENSE.TXT
|
||||
LLD_SUBDIR = lld
|
||||
LLD_SUPPORTS_IN_SOURCE_BUILD = NO
|
||||
HOST_LLD_DEPENDENCIES = host-llvm host-llvm-libunwind
|
||||
|
||||
# build as static libs as is done in llvm & clang
|
||||
HOST_LLD_CONF_OPTS += -DBUILD_SHARED_LIBS=OFF
|
||||
|
||||
HOST_LLD_CONF_OPTS += -DLLVM_COMMON_CMAKE_UTILS=$(HOST_DIR)/lib/cmake/llvm
|
||||
|
||||
# GCC looks for tools in a different path from LLD's default installation path
|
||||
define HOST_LLD_CREATE_SYMLINKS
|
||||
mkdir -p $(HOST_DIR)/$(GNU_TARGET_NAME)/bin
|
||||
ln -sfr $(HOST_DIR)/bin/lld $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/lld
|
||||
ln -sfr $(HOST_DIR)/bin/lld $(HOST_DIR)/$(GNU_TARGET_NAME)/bin/ld.lld
|
||||
endef
|
||||
|
||||
HOST_LLD_POST_INSTALL_HOOKS += HOST_LLD_CREATE_SYMLINKS
|
||||
|
||||
$(eval $(host-cmake-package))
|
||||
1
package/llvm-project/llvm-cmake/llvm-cmake.hash
Symbolic link
1
package/llvm-project/llvm-cmake/llvm-cmake.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
19
package/llvm-project/llvm-cmake/llvm-cmake.mk
Normal file
19
package/llvm-project/llvm-cmake/llvm-cmake.mk
Normal file
@@ -0,0 +1,19 @@
|
||||
################################################################################
|
||||
#
|
||||
# llvm-cmake
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLVM_CMAKE_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
LLVM_CMAKE_SITE = $(LLVM_PROJECT_SITE)
|
||||
LLVM_CMAKE_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
LLVM_CMAKE_DL_SUBDIR = llvm-project
|
||||
LLVM_CMAKE_LICENSE = Apache-2.0 with exceptions
|
||||
|
||||
define HOST_LLVM_CMAKE_INSTALL_CMDS
|
||||
mkdir -p $(HOST_DIR)/lib/cmake/llvm/Modules
|
||||
cp -Rv $(@D)/cmake/Modules/* $(HOST_DIR)/lib/cmake/llvm/Modules
|
||||
ln -sf $(HOST_DIR)/lib/cmake/llvm/Modules/* $(HOST_DIR)/lib/cmake/llvm/
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
1
package/llvm-project/llvm-libunwind/llvm-libunwind.hash
Symbolic link
1
package/llvm-project/llvm-libunwind/llvm-libunwind.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
20
package/llvm-project/llvm-libunwind/llvm-libunwind.mk
Normal file
20
package/llvm-project/llvm-libunwind/llvm-libunwind.mk
Normal file
@@ -0,0 +1,20 @@
|
||||
################################################################################
|
||||
#
|
||||
# llvm-libunwind
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLVM_LIBUNWIND_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
LLVM_LIBUNWIND_SITE = $(LLVM_PROJECT_SITE)
|
||||
LLVM_LIBUNWIND_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
LLVM_LIBUNWIND_DL_SUBDIR = llvm-project
|
||||
LLVM_LIBUNWIND_LICENSE = Apache-2.0 with exceptions
|
||||
LLVM_LIBUNWIND_LICENSE_FILES = LICENSE.TXT
|
||||
LLVM_LIBUNWIND_SUBDIR = libunwind
|
||||
LLVM_LIBUNWIND_SUPPORTS_IN_SOURCE_BUILD = NO
|
||||
|
||||
HOST_LLVM_LIBUNWIND_DEPENDENCIES = host-llvm-cmake host-llvm-runtimes
|
||||
HOST_LLVM_LIBUNWIND_CONF_OPTS += \
|
||||
-DCMAKE_MODULE_PATH="$(HOST_DIR)/lib/cmake/llvm"
|
||||
|
||||
$(eval $(host-cmake-package))
|
||||
4
package/llvm-project/llvm-project.hash
Normal file
4
package/llvm-project/llvm-project.hash
Normal file
@@ -0,0 +1,4 @@
|
||||
# From https://github.com/llvm/llvm-project/releases/tag/llvmorg-22.1.8
|
||||
sha256 922f1817a0df7b1489272d18134ee0087a8b068828f87ac63b9861b1a9965888 llvm-project-22.1.8.src.tar.xz
|
||||
# locally calculated
|
||||
sha256 8d85c1057d742e597985c7d4e6320b015a9139385cff4cbae06ffc0ebe89afee LICENSE.TXT
|
||||
12
package/llvm-project/llvm-project.mk
Normal file
12
package/llvm-project/llvm-project.mk
Normal file
@@ -0,0 +1,12 @@
|
||||
################################################################################
|
||||
#
|
||||
# llvm-project
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLVM_PROJECT_VERSION_MAJOR = 22
|
||||
LLVM_PROJECT_VERSION = $(LLVM_PROJECT_VERSION_MAJOR).1.8
|
||||
LLVM_PROJECT_SITE = https://github.com/llvm/llvm-project/releases/download/llvmorg-$(LLVM_PROJECT_VERSION)
|
||||
LLVM_PROJECT_SOURCE = llvm-project-$(LLVM_VERSION).src.tar.xz
|
||||
|
||||
include $(sort $(wildcard package/llvm-project/*/*.mk))
|
||||
1
package/llvm-project/llvm-runtimes/llvm-runtimes.hash
Symbolic link
1
package/llvm-project/llvm-runtimes/llvm-runtimes.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
18
package/llvm-project/llvm-runtimes/llvm-runtimes.mk
Normal file
18
package/llvm-project/llvm-runtimes/llvm-runtimes.mk
Normal file
@@ -0,0 +1,18 @@
|
||||
################################################################################
|
||||
#
|
||||
# llvm-runtimes
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLVM_RUNTIMES_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
LLVM_RUNTIMES_SITE = $(LLVM_PROJECT_SITE)
|
||||
LLVM_RUNTIMES_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
LLVM_RUNTIMES_DL_SUBDIR = llvm-project
|
||||
LLVM_RUNTIMES_LICENSE = Apache-2.0 with exceptions
|
||||
|
||||
define HOST_LLVM_RUNTIMES_INSTALL_CMDS
|
||||
mkdir -p $(HOST_DIR)/lib/cmake/llvm/Modules
|
||||
cp -Rv $(@D)/runtimes/cmake/Modules/* $(HOST_DIR)/lib/cmake/llvm
|
||||
endef
|
||||
|
||||
$(eval $(host-generic-package))
|
||||
78
package/llvm-project/llvm/Config.in
Normal file
78
package/llvm-project/llvm/Config.in
Normal file
@@ -0,0 +1,78 @@
|
||||
config BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
bool
|
||||
default y if BR2_i386
|
||||
default y if BR2_x86_64
|
||||
default y if BR2_aarch64
|
||||
default y if BR2_arm || BR2_armeb
|
||||
default y if BR2_riscv
|
||||
|
||||
config BR2_PACKAGE_LLVM_TARGET_ARCH
|
||||
string
|
||||
default "AArch64" if BR2_aarch64
|
||||
default "ARM" if BR2_arm || BR2_armeb
|
||||
default "X86" if BR2_i386 || BR2_x86_64
|
||||
default "riscv32" if BR2_riscv && !BR2_ARCH_IS_64
|
||||
default "riscv64" if BR2_riscv && BR2_ARCH_IS_64
|
||||
|
||||
config BR2_PACKAGE_LLVM
|
||||
bool "llvm"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_7
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
depends on BR2_INSTALL_LIBSTDCPP
|
||||
depends on !BR2_TOOLCHAIN_HAS_GCC_BUG_64735 # std::shared_future
|
||||
depends on !BR2_STATIC_LIBS
|
||||
depends on BR2_USE_WCHAR # std::wstring
|
||||
depends on BR2_HOST_GCC_AT_LEAST_7 # host-llvm
|
||||
select BR2_HOST_CMAKE_AT_LEAST_3_20 # cmake required version at least 3.20
|
||||
help
|
||||
The LLVM Project is a collection of modular and reusable
|
||||
compiler and toolchain technologies.
|
||||
|
||||
http://llvm.org
|
||||
|
||||
if BR2_PACKAGE_LLVM
|
||||
|
||||
config BR2_PACKAGE_LLVM_AMDGPU
|
||||
bool "AMDGPU backend"
|
||||
help
|
||||
Build AMDGPU target. Select this option if you are going
|
||||
to install mesa3d with llvm and use Gallium Radeon driver.
|
||||
|
||||
config BR2_PACKAGE_LLVM_RTTI
|
||||
bool "enable rtti"
|
||||
help
|
||||
Build LLVM with run-time type information. LLVM can be built
|
||||
without rtti, but turning it off changes the ABI of C++
|
||||
programs.
|
||||
|
||||
This features is needed to build the Gallium Nouveau driver
|
||||
or the Clover OpenCL state tracker when llvm support is
|
||||
enabled.
|
||||
|
||||
https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html
|
||||
|
||||
config BR2_PACKAGE_LLVM_BPF
|
||||
bool "BPF backend"
|
||||
help
|
||||
Build BPF target. Select this option if you are going
|
||||
to install bcc on the target.
|
||||
|
||||
config BR2_PACKAGE_LLVM_DUMP
|
||||
bool "enable dump"
|
||||
help
|
||||
Build LLVM with dump functions even when assertions are
|
||||
disabled.
|
||||
|
||||
endif
|
||||
|
||||
comment "llvm needs a toolchain w/ wchar, threads, C++, gcc >= 7, dynamic library, host gcc >= 7"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS || !BR2_INSTALL_LIBSTDCPP || \
|
||||
!BR2_TOOLCHAIN_GCC_AT_LEAST_7 \
|
||||
|| BR2_STATIC_LIBS || !BR2_USE_WCHAR \
|
||||
|| !BR2_HOST_GCC_AT_LEAST_7
|
||||
|
||||
comment "llvm needs a toolchain not affected by GCC bug 64735"
|
||||
depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
|
||||
depends on BR2_TOOLCHAIN_HAS_GCC_BUG_64735
|
||||
1
package/llvm-project/llvm/llvm.hash
Symbolic link
1
package/llvm-project/llvm/llvm.hash
Symbolic link
@@ -0,0 +1 @@
|
||||
../llvm-project.hash
|
||||
327
package/llvm-project/llvm/llvm.mk
Normal file
327
package/llvm-project/llvm/llvm.mk
Normal file
@@ -0,0 +1,327 @@
|
||||
################################################################################
|
||||
#
|
||||
# llvm
|
||||
#
|
||||
################################################################################
|
||||
|
||||
LLVM_VERSION = $(LLVM_PROJECT_VERSION)
|
||||
LLVM_SITE = $(LLVM_PROJECT_SITE)
|
||||
LLVM_SOURCE = $(LLVM_PROJECT_SOURCE)
|
||||
LLVM_DL_SUBDIR = llvm-project
|
||||
LLVM_LICENSE = Apache-2.0 with exceptions
|
||||
LLVM_LICENSE_FILES = LICENSE.TXT
|
||||
LLVM_CPE_ID_VENDOR = llvm
|
||||
LLVM_SUPPORTS_IN_SOURCE_BUILD = NO
|
||||
LLVM_SUBDIR = llvm
|
||||
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
|
||||
|
||||
# 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
|
||||
# opt-viewer is not necessary either, remove that too
|
||||
define LLVM_DELETE_LLVM_TBLGEN_TARGET
|
||||
rm -rf $(TARGET_DIR)/usr/share/opt-viewer
|
||||
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))
|
||||
Reference in New Issue
Block a user