Skip to contentSkip to conversation

package/pkg-meson: move crosscompilation support out of package

PATCH New Norbert Lange 1 participant 1 message Sep 29, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 package/pkg-meson: move crosscompilation support out of package

install the cross-compilation.conf file when setting up the toolchain, not as part of host-meson.
This allows external usage of the buildroot toolchain through meson, whether the host-meson package is built or not (similar to other build systems like cmake).

Removed a few variables, as they were only used to communicate between the meson package and pkg-meson.mk and are not needed anymore. (Correctly prefix those with PKG_MESON_)

Prefer explicit Buildroot variables for compiler tools.

The sed pattern for cross-compilation.conf is now be generated by a function, instead of being duplicated.

---
v1->v2:
- squash 2 commits, really hard to separate as moving and renaming
variables from 2 to one location affects alot code.
- use TOOLCHAIN_POST_INSTALL_STAGING_HOOKS again.
- consistently use double quotes for sed patterns

---
 package/meson/meson.mk                        |  38 -------
 package/pkg-meson.mk                          | 100 ++++++++++++------
 .../misc}/cross-compilation.conf.in           |  10 +-
 3 files changed, 72 insertions(+), 76 deletions(-)
 rename {package/meson => support/misc}/cross-compilation.conf.in (83%)
package/meson/meson.mk +0 -38
index d39e66cf05..47b4134105 100644
@@ -13,44 +13,6 @@ MESON_SETUP_TYPE = setuptools
 HOST_MESON_DEPENDENCIES = host-ninja
 HOST_MESON_NEEDS_HOST_PYTHON = python3
 
-HOST_MESON_TARGET_ENDIAN = $(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN)))
-HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU)
-
-# https://mesonbuild.com/Reference-tables.html#cpu-families
-ifeq ($(BR2_arcle)$(BR2_arceb),y)
-HOST_MESON_TARGET_CPU_FAMILY = arc
-else ifeq ($(BR2_arm)$(BR2_armeb),y)
-HOST_MESON_TARGET_CPU_FAMILY = arm
-else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y)
-HOST_MESON_TARGET_CPU_FAMILY = aarch64
-else ifeq ($(BR2_i386),y)
-HOST_MESON_TARGET_CPU_FAMILY = x86
-else ifeq ($(BR2_m68k),y)
-HOST_MESON_TARGET_CPU_FAMILY = m68k
-else ifeq ($(BR2_microblazeel)$(BR2_microblazebe),y)
-HOST_MESON_TARGET_CPU_FAMILY = microblaze
-else ifeq ($(BR2_mips)$(BR2_mipsel),y)
-HOST_MESON_TARGET_CPU_FAMILY = mips
-else ifeq ($(BR2_mips64)$(BR2_mips64el),y)
-HOST_MESON_TARGET_CPU_FAMILY = mips64
-else ifeq ($(BR2_powerpc),y)
-HOST_MESON_TARGET_CPU_FAMILY = ppc
-else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y)
-HOST_MESON_TARGET_CPU_FAMILY = ppc64
-else ifeq ($(BR2_riscv),y)
-HOST_MESON_TARGET_CPU_FAMILY = riscv64
-else ifeq ($(BR2_sh4)$(BR2_sh4eb)$(BR2_sh4a)$(BR2_sh4aeb),y)
-HOST_MESON_TARGET_CPU_FAMILY = sh4
-else ifeq ($(BR2_sparc),y)
-HOST_MESON_TARGET_CPU_FAMILY = sparc
-else ifeq ($(BR2_sparc64),y)
-HOST_MESON_TARGET_CPU_FAMILY = sparc64
-else ifeq ($(BR2_x86_64),y)
-HOST_MESON_TARGET_CPU_FAMILY = x86_64
-else
-HOST_MESON_TARGET_CPU_FAMILY = $(ARCH)
-endif
-
 # Avoid interpreter shebang longer than 128 chars
 define HOST_MESON_SET_INTERPRETER
 	$(SED) '1s:.*:#!/usr/bin/env python3:' $(HOST_DIR)/bin/meson
package/pkg-meson.mk +67 -33

127 lines not on this page · raw message

support/misc/cross-compilation.conf.in renamed from package/meson/cross-compilation.conf.in +5 -5
similarity index 83%
rename from package/meson/cross-compilation.conf.in
rename to support/misc/cross-compilation.conf.in
index e9344e2b2f..2914973f29 100644
@@ -4,11 +4,11 @@
 # - Buildroot's 'target' is Meson's 'host'
 
 [binaries]
-c = '@TARGET_CROSS at gcc'
-cpp = '@TARGET_CROSS at g++'
-ar = '@TARGET_CROSS at ar'
-strip = '@TARGET_CROSS at strip'
-pkgconfig = '@HOST_DIR@/bin/pkgconf'
+c = '@TARGET_CC@'
+cpp = '@TARGET_CXX@'
+ar = '@TARGET_AR@'
+strip = '@TARGET_STRIP@'
+pkgconfig = '@PKGCONF_HOST_BINARY@'
 g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
 g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
 
Signature · 1 line
2.28.0