package/pkg-meson: improve generation of cross-compilation file
Removed a few variables, as they were only used to communicate between the meson package and pkg-meson.mk and are not needed anymore. Moved cross-compilation.conf.in out of meson package. Creating the cross-compilation.conf files for packages is now using the original template. To avoid duplicate code, the common sed pattern is stored in a make variable. Use explicit Buildroot variables for compiler tools, and some fixes. (TARGET_LDFLAGS and TARGET_CXXFLAGS were mixed up with PKG_TARGET_CFLAGS) Signed-off-by: Norbert Lange <nolange79@gmail.com> [Arnout: keep PKG_MESON_INSTALL_CROSS_CONF in TOOLCHAIN_TARGET_FINALIZE_HOOKS] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
This commit is contained in:
parent
56e31ff9db
commit
675f02fd3f
@ -64,8 +64,26 @@ else
|
|||||||
PKG_MESON_TARGET_CPU_FAMILY = $(ARCH)
|
PKG_MESON_TARGET_CPU_FAMILY = $(ARCH)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
HOST_MESON_TARGET_ENDIAN = $(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN)))
|
# Generates sed patterns for patching the cross-compilation.conf template,
|
||||||
HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU)
|
# since Flags might contain commas the arguments are passed indirectly by
|
||||||
|
# variable name (stripped to deal with whitespaces).
|
||||||
|
# Arguments are variable containing cflags, cxxflags, ldflags.
|
||||||
|
define PKG_MESON_CROSSCONFIG_SED
|
||||||
|
-e "s%@TARGET_CC@%$(TARGET_CC)%g" \
|
||||||
|
-e "s%@TARGET_CXX@%$(TARGET_CXX)%g" \
|
||||||
|
-e "s%@TARGET_AR@%$(TARGET_AR)%g" \
|
||||||
|
-e "s%@TARGET_STRIP@%$(TARGET_STRIP)%g" \
|
||||||
|
-e "s%@TARGET_ARCH@%$(PKG_MESON_TARGET_CPU_FAMILY)%g" \
|
||||||
|
-e "s%@TARGET_CPU@%$(GCC_TARGET_CPU)%g" \
|
||||||
|
-e "s%@TARGET_ENDIAN@%$(call qstrip,$(call LOWERCASE,$(BR2_ENDIAN)))%g" \
|
||||||
|
-e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$($(strip $(1))))%g" \
|
||||||
|
-e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$($(strip $(3))))%g" \
|
||||||
|
-e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$($(strip $(2))))%g" \
|
||||||
|
-e "s%@PKGCONF_HOST_BINARY@%$(HOST_DIR)/bin/pkgconf%g" \
|
||||||
|
-e "s%@STAGING_DIR@%$(STAGING_DIR)%g" \
|
||||||
|
-e "s%@STATIC@%$(if $(BR2_STATIC_LIBS),true,false)%g" \
|
||||||
|
$(TOPDIR)/support/misc/cross-compilation.conf.in
|
||||||
|
endef
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# inner-meson-package -- defines how the configuration, compilation and
|
# inner-meson-package -- defines how the configuration, compilation and
|
||||||
@ -101,19 +119,9 @@ $(2)_CXXFLAGS ?= $$(TARGET_CXXFLAGS)
|
|||||||
define $(2)_CONFIGURE_CMDS
|
define $(2)_CONFIGURE_CMDS
|
||||||
rm -rf $$($$(PKG)_SRCDIR)/build
|
rm -rf $$($$(PKG)_SRCDIR)/build
|
||||||
mkdir -p $$($$(PKG)_SRCDIR)/build
|
mkdir -p $$($$(PKG)_SRCDIR)/build
|
||||||
sed -e 's%@TARGET_CROSS@%$$(TARGET_CROSS)%g' \
|
sed -e "/^\[binaries\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES),\n$$(x)):" \
|
||||||
-e 's%@TARGET_ARCH@%$$(HOST_MESON_TARGET_CPU_FAMILY)%g' \
|
|
||||||
-e 's%@TARGET_CPU@%$$(HOST_MESON_TARGET_CPU)%g' \
|
|
||||||
-e 's%@TARGET_ENDIAN@%$$(HOST_MESON_TARGET_ENDIAN)%g' \
|
|
||||||
-e "s%@TARGET_CFLAGS@%$$(call make-sq-comma-list,$$($(2)_CFLAGS))%g" \
|
|
||||||
-e "s%@TARGET_LDFLAGS@%$$(call make-sq-comma-list,$$($(2)_LDFLAGS))%g" \
|
|
||||||
-e "s%@TARGET_CXXFLAGS@%$$(call make-sq-comma-list,$$($(2)_CXXFLAGS))%g" \
|
|
||||||
-e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
|
|
||||||
-e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
|
|
||||||
-e 's%@STATIC@%$$(if $$(BR2_STATIC_LIBS),true,false)%g' \
|
|
||||||
-e "/^\[binaries\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES),\n$$(x)):" \
|
|
||||||
-e "/^\[properties\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_PROPERTIES),\n$$(x)):" \
|
-e "/^\[properties\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_PROPERTIES),\n$$(x)):" \
|
||||||
package/meson/cross-compilation.conf.in \
|
$$(call PKG_MESON_CROSSCONFIG_SED,$(2)_CFLAGS,$(2)_CXXFLAGS,$(2)_LDFLAGS) \
|
||||||
> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
|
> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
|
||||||
PATH=$$(BR_PATH) \
|
PATH=$$(BR_PATH) \
|
||||||
CC_FOR_BUILD="$$(HOSTCC)" \
|
CC_FOR_BUILD="$$(HOSTCC)" \
|
||||||
@ -227,22 +235,12 @@ host-meson-package = $(call inner-meson-package,host-$(pkgname),$(call UPPERCASE
|
|||||||
# own flags if they need to.
|
# own flags if they need to.
|
||||||
define PKG_MESON_INSTALL_CROSS_CONF
|
define PKG_MESON_INSTALL_CROSS_CONF
|
||||||
mkdir -p $(HOST_DIR)/etc/meson
|
mkdir -p $(HOST_DIR)/etc/meson
|
||||||
sed -e 's%@TARGET_CROSS@%$(TARGET_CROSS)%g' \
|
sed -e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$(TARGET_CFLAGS))@PKG_TARGET_CFLAGS@%g" \
|
||||||
-e 's%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g' \
|
-e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$(TARGET_LDFLAGS))@PKG_TARGET_LDFLAGS@%g" \
|
||||||
-e 's%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g' \
|
-e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$(TARGET_CXXFLAGS))@PKG_TARGET_CXXFLAGS@%g" \
|
||||||
-e 's%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g' \
|
$(call PKG_MESON_CROSSCONFIG_SED) \
|
||||||
-e "s%@TARGET_CFLAGS@%$(call make-sq-comma-list,$(TARGET_CFLAGS))@PKG_TARGET_CFLAGS@%g" \
|
|
||||||
-e "s%@TARGET_LDFLAGS@%$(call make-sq-comma-list,$(TARGET_LDFLAGS))@PKG_TARGET_CFLAGS@%g" \
|
|
||||||
-e "s%@TARGET_CXXFLAGS@%$(call make-sq-comma-list,$(TARGET_CXXFLAGS))@PKG_TARGET_CFLAGS@%g" \
|
|
||||||
-e 's%@HOST_DIR@%$(HOST_DIR)%g' \
|
|
||||||
-e 's%@STAGING_DIR@%$(STAGING_DIR)%g' \
|
|
||||||
-e 's%@STATIC@%$(if $(BR2_STATIC_LIBS),true,false)%g' \
|
|
||||||
$(HOST_MESON_PKGDIR)/cross-compilation.conf.in \
|
|
||||||
> $(HOST_DIR)/etc/meson/cross-compilation.conf.in
|
> $(HOST_DIR)/etc/meson/cross-compilation.conf.in
|
||||||
sed -e 's%@PKG_TARGET_CFLAGS@%%g' \
|
sed $(call PKG_MESON_CROSSCONFIG_SED,TARGET_CFLAGS,TARGET_CXXFLAGS,TARGET_LDFLAGS) \
|
||||||
-e 's%@PKG_TARGET_LDFLAGS@%%g' \
|
|
||||||
-e 's%@PKG_TARGET_CXXFLAGS@%%g' \
|
|
||||||
$(HOST_DIR)/etc/meson/cross-compilation.conf.in \
|
|
||||||
> $(HOST_DIR)/etc/meson/cross-compilation.conf
|
> $(HOST_DIR)/etc/meson/cross-compilation.conf
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
# - Buildroot's 'target' is Meson's 'host'
|
# - Buildroot's 'target' is Meson's 'host'
|
||||||
|
|
||||||
[binaries]
|
[binaries]
|
||||||
c = '@TARGET_CROSS@gcc'
|
c = '@TARGET_CC@'
|
||||||
cpp = '@TARGET_CROSS@g++'
|
cpp = '@TARGET_CXX@'
|
||||||
ar = '@TARGET_CROSS@ar'
|
ar = '@TARGET_AR@'
|
||||||
strip = '@TARGET_CROSS@strip'
|
strip = '@TARGET_STRIP@'
|
||||||
pkgconfig = '@HOST_DIR@/bin/pkgconf'
|
pkgconfig = '@PKGCONF_HOST_BINARY@'
|
||||||
g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
|
g-ir-compiler = '@STAGING_DIR@/usr/bin/g-ir-compiler'
|
||||||
g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
|
g-ir-scanner = '@STAGING_DIR@/usr/bin/g-ir-scanner'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user