[Buildroot] [PATCH 1/3] package/llvm-project: add support for clang python bindings
Daniel Lang
dalang at gmx.at
Fri Apr 18 14:19:13 UTC 2025
Hello Raphaël,
On 4/7/25 12:39, Raphaël Mélotte wrote:
> Add two upstream patches that were required for building and enable
> the bindings for our python version.
>
> It should be noted that because the python bindings have wrong default
> include dirs, they are useless if the includes are not provided
> externally.
>
> Signed-off-by: Raphaël Mélotte <raphael.melotte at mind.be>
> ---
> ...sic-against-libatomic-when-necessary.patch | 48 ++++++++++
> package/llvm-project/clang/Config.in | 8 ++
> package/llvm-project/clang/clang.mk | 5 +
> ...LIB-variable-for-convenient-linking-.patch | 91 +++++++++++++++++++
> 4 files changed, 152 insertions(+)
> create mode 100644 package/llvm-project/clang/0001-Link-libclangBasic-against-libatomic-when-necessary.patch
> create mode 100644 package/llvm-project/llvm/0001-Set-LLVM_ATOMIC_LIB-variable-for-convenient-linking-.patch
>
[---]> diff --git a/package/llvm-project/clang/Config.in b/package/llvm-project/clang/Config.in
> index 2e23888720..134b8f5d9a 100644
> --- a/package/llvm-project/clang/Config.in
> +++ b/package/llvm-project/clang/Config.in
> @@ -25,3 +25,11 @@ comment "clang needs a toolchain w/ wchar, threads, C++, gcc >= 7, dynamic libra
> 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
> +
> +if BR2_PACKAGE_CLANG
> +
> +config BR2_PACKAGE_HOST_CLANG_PYTHON_BINDINGS
> + bool "Python bindings for host-clang"
> + select BR2_PACKAGE_HOST_PYTHON3
As far as I know, these bindings are typically selected implicitly.
So no extra config option but instead check for BR2_PACKAGE_HOST_PYTHON3 in the mk file.
> +
> +endif # BR2_PACKAGE_CLANG
> diff --git a/package/llvm-project/clang/clang.mk b/package/llvm-project/clang/clang.mk
> index 0bafd6461b..510d5b0805 100644
> --- a/package/llvm-project/clang/clang.mk
> +++ b/package/llvm-project/clang/clang.mk
> @@ -105,6 +105,11 @@ ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> endif
>
> +ifeq ($(BR2_PACKAGE_HOST_CLANG_PYTHON_BINDINGS),y)
this turns info ifeq ($(BR2_PACKAGE_HOST_PYTHON3),y)
> +HOST_CLANG_DEPENDENCIES += host-python3
> +HOST_CLANG_CONF_OPTS += -DCLANG_PYTHON_BINDINGS_VERSIONS=$(PYTHON3_VERSION_MAJOR)
> +endif
> +
> define HOST_CLANG_INSTALL_WRAPPER_AND_SIMPLE_SYMLINKS
> $(Q)cd $(HOST_DIR)/bin; \
> rm -f clang-$(CLANG_VERSION_MAJOR).br_real; \
[---]
Regards,
Daniel
More information about the buildroot
mailing list