All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: buildroot@buildroot.org
Cc: Eric Le Bihan <eric.le.bihan.dev@free.fr>,
	Xukai Wang <kingxukai@zohomail.com>,
	Julien Olivain <ju.o@free.fr>,
	Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>,
	Guillaume William Brs <guillaume.bressaix@gmail.com>,
	James Hilliard <james.hilliard1@gmail.com>,
	Woodrow Douglass <wdouglass@carnegierobotics.com>,
	Jagan Teki <jagan@amarulasolutions.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Romain Naour <romain.naour@gmail.com>,
	Fabrice Fontaine <fontaine.fabrice@gmail.com>
Subject: [Buildroot] [PATCH 2/5] package/pkg-meson: share cross-file generation
Date: Mon,  5 Oct 2026 16:38:08 -0600	[thread overview]
Message-ID: <20261005223811.2094796-2-james.hilliard1@gmail.com> (raw)
In-Reply-To: <20261005223811.2094796-1-james.hilliard1@gmail.com>

Extract the cross-file generation and compiler flag defaults for use
by the meson-python backend. Keep package-specific binaries,
properties and flags in the common implementation.

Default Fortran flags to TARGET_FCFLAGS, as for the C and C++ flags.

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 docs/manual/adding-packages-meson.adoc |  4 ++++
 package/pkg-meson.mk                   | 25 +++++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
index 01891e03cc..c870045441 100644
--- a/docs/manual/adding-packages-meson.adoc
+++ b/docs/manual/adding-packages-meson.adoc
@@ -108,6 +108,10 @@ will therefore only use a few of them.
   +cross-compile.conf+ file +c_link_args+ and +cpp_link_args+ properties. By
   default, the value of +TARGET_LDFLAGS+.
 
+* +FOO_FCFLAGS+, to specify compiler arguments added to the package specific
+  +cross-compile.conf+ file +fortran_args+ property. By default, the value of
+  +TARGET_FCFLAGS+.
+
 * +FOO_MESON_EXTRA_BINARIES+, to specify a space-separated list of programs
   to add to the `[binaries]` section of the meson `cross-compilation.conf`
   configuration file. The format is `program-name='/path/to/program'`, with
diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 5f7eed9edf..f1fb69c240 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -113,6 +113,13 @@ PKG_MESON_HOST_OPTS = \
 	--wrap-mode=nodownload \
 	-Dstrip=true
 
+define PKG_MESON_SET_TARGET_FLAGS
+$(1)_CFLAGS ?= $$(TARGET_CFLAGS)
+$(1)_LDFLAGS ?= $$(TARGET_LDFLAGS)
+$(1)_CXXFLAGS ?= $$(TARGET_CXXFLAGS)
+$(1)_FCFLAGS ?= $$(TARGET_FCFLAGS)
+endef
+
 # Generates sed patterns for patching the cross-compilation.conf template,
 # since Flags might contain commas the arguments are passed indirectly by
 # variable name (stripped to deal with whitespaces).
@@ -138,6 +145,14 @@ define PKG_MESON_CROSSCONFIG_SED
         $(TOPDIR)/support/misc/cross-compilation.conf.in
 endef
 
+define PKG_MESON_GENERATE_CROSS_FILE
+	mkdir -p $($(PKG)_SRCDIR)/buildroot-build
+	sed -e "/^\[binaries\]$$/s:$$:$(foreach x,$($(PKG)_MESON_EXTRA_BINARIES),\n$(x)):" \
+	    -e "/^\[properties\]$$/s:$$:$(foreach x,$($(PKG)_MESON_EXTRA_PROPERTIES),\n$(x)):" \
+	    $(call PKG_MESON_CROSSCONFIG_SED,$(PKG)_CFLAGS,$(PKG)_CXXFLAGS,$(PKG)_LDFLAGS,$(PKG)_FCFLAGS) \
+	    > $($(PKG)_SRCDIR)/buildroot-build/cross-compilation.conf
+endef
+
 ################################################################################
 # inner-meson-package -- defines how the configuration, compilation and
 # installation of a Meson package should be done, implements a few hooks to
@@ -162,20 +177,14 @@ define inner-meson-package
 ifndef $(2)_CONFIGURE_CMDS
 ifeq ($(4),target)
 
-$(2)_CFLAGS ?= $$(TARGET_CFLAGS)
-$(2)_LDFLAGS ?= $$(TARGET_LDFLAGS)
-$(2)_CXXFLAGS ?= $$(TARGET_CXXFLAGS)
+$(call PKG_MESON_SET_TARGET_FLAGS,$(2))
 
 # Configure package for target
 #
 #
 define $(2)_CONFIGURE_CMDS
 	rm -rf $$($$(PKG)_SRCDIR)/buildroot-build
-	mkdir -p $$($$(PKG)_SRCDIR)/buildroot-build
-	sed -e "/^\[binaries\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES),\n$$(x)):" \
-	    -e "/^\[properties\]$$$$/s:$$$$:$$(foreach x,$$($(2)_MESON_EXTRA_PROPERTIES),\n$$(x)):" \
-	    $$(call PKG_MESON_CROSSCONFIG_SED,$(2)_CFLAGS,$(2)_CXXFLAGS,$(2)_LDFLAGS,$(2)_FCFLAGS) \
-	    > $$($$(PKG)_SRCDIR)/buildroot-build/cross-compilation.conf
+	$$(PKG_MESON_GENERATE_CROSS_FILE)
 	PATH=$$(BR_PATH) \
 	CC_FOR_BUILD="$$(HOSTCC)" \
 	CXX_FOR_BUILD="$$(HOSTCXX)" \
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2026-10-05 22:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-05 22:38 [Buildroot] [PATCH 1/5] package/pkg-meson: share Meson setup options James Hilliard
2026-10-05 22:38 ` James Hilliard [this message]
2026-10-05 22:38 ` [Buildroot] [PATCH 3/5] package/pkg-python: add meson setup type James Hilliard
2026-10-05 22:38 ` [Buildroot] [PATCH 4/5] package/python-numpy: bump to version 2.5.3 James Hilliard
2026-10-05 22:38 ` [Buildroot] [PATCH 5/5] package/python-scipy: bump to version 1.18.1 James Hilliard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261005223811.2094796-2-james.hilliard1@gmail.com \
    --to=james.hilliard1@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=fontaine.fabrice@gmail.com \
    --cc=guillaume.bressaix@gmail.com \
    --cc=gwenhael.goavec-merou@trabucayre.com \
    --cc=jagan@amarulasolutions.com \
    --cc=ju.o@free.fr \
    --cc=kingxukai@zohomail.com \
    --cc=romain.naour@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wdouglass@carnegierobotics.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.