meson.bbclass: add MESON_TARGET
PATCH 1/4 meson.bbclass: add MESON_TARGET
From: Ross Burton <[email protected]>
Add a variable to control what target gets built in do_compile. By default this value is unset so meson builds the default target, but by setting MESON_TARGET a specific target can be built.
--- meta/classes-recipe/meson.bbclass | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
meta/classes-recipe/meson.bbclass +4 -1
@@ -20,6 +20,9 @@ do_configure[cleandirs] = "${B}" # Where the meson.build build configuration is MESON_SOURCEPATH = "${S}" +# The target to build in do_compile. If unset the default targets are built. +MESON_TARGET ?= "" + def noprefix(var, d): return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1)
@@ -170,7 +173,7 @@ do_configure[postfuncs] += "meson_do_qa_configure" do_compile[progress] = "outof:^\[(\d+)/(\d+)\]\s+" meson_do_compile() { - meson compile -v ${PARALLEL_MAKE} + meson compile -v ${PARALLEL_MAKE} ${MESON_TARGET} } meson_do_install() {
Signature · 1 line
2.34.1
PATCH 2/4 meson.bbclass:: update do_write_config vardeps
From: Ross Burton <[email protected]>
Add OBJCOPY and EXEWRAPPER_ENABLED, remove LD as it isn't used anymore.
--- meta/classes-recipe/meson.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/meson.bbclass +1 -1
@@ -61,7 +61,7 @@ def rust_tool(d, target_var): return "rust = %s" % repr(cmd) addtask write_config before do_configure -do_write_config[vardeps] += "CC CXX LD AR NM STRIP READELF CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS" +do_write_config[vardeps] += "CC CXX AR NM STRIP READELF OBJCOPY CFLAGS CXXFLAGS LDFLAGS RUSTC RUSTFLAGS EXEWRAPPER_ENABLED" do_write_config() { # This needs to be Py to split the args into single-element lists cat >${WORKDIR}/meson.cross <<EOF
Signature · 1 line
2.34.1
PATCH 3/4 systemd-boot: use MESON_TARGET
In reply to [email protected]From: Ross Burton <[email protected]>
Instead of re-implementing do_compile, use MESON_TARGET.
--- meta/recipes-core/systemd/systemd-boot_254.bb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
meta/recipes-core/systemd/systemd-boot_254.bb +2 -4
@@ -22,6 +22,8 @@ c_ld = ${@meson_array('EFI_LD', d)} EOF } +MESON_TARGET = "systemd-boot" + EXTRA_OEMESON += "-Defi=true \ -Dbootloader=true \ -Dman=false \
@@ -51,10 +53,6 @@ TUNE_CCARGS:remove = "-mfpmath=sse" COMPATIBLE_HOST = "(aarch64.*|arm.*|x86_64.*|i.86.*)-linux" COMPATIBLE_HOST:x86-x32 = "null" -do_compile() { - ninja systemd-boot -} - do_install() { install -d ${D}${EFI_FILES_PATH} install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
Signature · 1 line
2.34.1
PATCH 4/4 systemd-boot: improve cross file generation
In reply to [email protected]From: Ross Burton <[email protected]>
The meson.cross generated by the class already has c and objcopy entries, so these can be removed.
Pass the --cross-file option in MESON_CROSS_FILE to ensure the ordering is always correct.
--- meta/recipes-core/systemd/systemd-boot_254.bb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
meta/recipes-core/systemd/systemd-boot_254.bb +3 -4
@@ -12,22 +12,21 @@ LDFLAGS:prepend = "${@ " ".join(d.getVar('LD').split()[1:])} " EFI_LD = "bfd" -do_write_config[vardeps] += "CC OBJCOPY EFI_LD" +do_write_config[vardeps] += "EFI_LD" do_write_config:append() { cat >${WORKDIR}/meson-${PN}.cross <<EOF [binaries] -c = ${@meson_array('CC', d)} -objcopy = ${@meson_array('OBJCOPY', d)} c_ld = ${@meson_array('EFI_LD', d)} EOF } +MESON_CROSS_FILE:append = " --cross-file ${WORKDIR}/meson-${PN}.cross" + MESON_TARGET = "systemd-boot" EXTRA_OEMESON += "-Defi=true \ -Dbootloader=true \ -Dman=false \ - --cross-file ${WORKDIR}/meson-${PN}.cross \ " # install to the image as boot*.efi if its the EFI_PROVIDER,
Signature · 1 line
2.34.1