Skip to contentSkip to conversation

meson: make wrapper options sub-command specific

PATCH Superseded Liam Beguin 2 participants 2 messages Sep 28, 2022 Arm/Amlogic Meson SoC support

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 meson: make wrapper options sub-command specific

The meson-wrapper adds setup options to facilitate cross-compilation. The current options are exclusive to the setup sub-command and might cause issues with other sub-commands.

Update the wrapper to make options sub-command specific.

---
 .../meson/meson/meson-wrapper                 | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
meta/recipes-devtools/meson/meson/meson-wrapper +16 -3
index c62007f5077e..866dc33cf4be 100755
@@ -13,7 +13,20 @@ fi
 # config is already in meson.cross.
 unset CC CXX CPP LD AR NM STRIP
 
+for arg in "${@}"; do
+    case ${arg} in
+    -*) continue ;;
+    *) SUBCMD=${arg}; break ;;
+    esac
+done
+
+if [ "x${SUBCMD}" == "xsetup" ] || [ -d ${SUBCMD} ]; then
+    MESON_SUB_OPTS=" \
+        --cross-file="${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
+        --native-file="${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \
+        "
+fi
+
 exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
-     --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
-     --native-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \
-     "$@"
+    "$@" \
+    ${MESON_SUB_OPTS}

base-commit: a2659cc2bf5d3f1cedf5c52c3b45e0427d40732d

Signature · 1 line
2.37.1.223.g6a475b71f8c4
#1 lore raw
Quoted 23 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Liam Beguin
Sent: den 28 september 2022 04:52
To: [email protected]; [email protected]
Cc: [email protected]
Subject: [OE-core] [PATCH v2] meson: make wrapper options sub-command specific

The meson-wrapper adds setup options to facilitate cross-compilation. The current options are exclusive to the setup sub-command and might cause issues with other sub-commands.

Update the wrapper to make options sub-command specific.

---
 .../meson/meson/meson-wrapper                 | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
meta/recipes-devtools/meson/meson/meson-wrapper +0 -0
index c62007f5077e..866dc33cf4be 100755

meta/recipes-devtools/meson/meson/meson-wrapper fi · line 21

Quoted 9 lines
meta/recipes-devtools/meson/meson/meson-wrapper +6 -0
@@ -13,7 +13,20 @@ fi
 # config is already in meson.cross.
 unset CC CXX CPP LD AR NM STRIP
 
+for arg in "${@}"; do
+    case ${arg} in
+    -*) continue ;;
+    *) SUBCMD=${arg}; break ;;
+    esac
+done

Change all "${...}" to "$..." above.

meta/recipes-devtools/meson/meson/meson-wrapper fi · line 23

Quoted 2 lines
meta/recipes-devtools/meson/meson/meson-wrapper +2 -0
+
+if [ "x${SUBCMD}" == "xsetup" ] || [ -d ${SUBCMD} ]; then

== is a bashism, use = instead. Also, you know that $SUBCMD will never have a - as its first character (due to the case statement above) so it is safe to simplify the above to:

if [ "$SUBCMD" = setup ] || [ -d "$SUBCMD" ]; then

meta/recipes-devtools/meson/meson/meson-wrapper fi · line 26

Quoted 3 lines
meta/recipes-devtools/meson/meson/meson-wrapper +3 -0
+    MESON_SUB_OPTS=" \
+        --cross-file="${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
+        --native-file="${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \

Change "${OECORE_NATIVE_SYSROOT}" to "$OECORE_NATIVE_SYSROOT". And while at it, change it in the export line earlier in the file as well.

meta/recipes-devtools/meson/meson/meson-wrapper fi · line 32

Quoted 9 lines
meta/recipes-devtools/meson/meson/meson-wrapper +5 -3
+        "
+fi
+
 exec "$OECORE_NATIVE_SYSROOT/usr/bin/meson.real" \
-     --cross-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/${TARGET_PREFIX}meson.cross" \
-     --native-file "${OECORE_NATIVE_SYSROOT}/usr/share/meson/meson.native" \
-     "$@"
+    "$@" \
+    ${MESON_SUB_OPTS}

Change "${MESON_SUB_OPTS}" to "$MESON_SUB_OPTS".

Quoted 4 lines

base-commit: a2659cc2bf5d3f1cedf5c52c3b45e0427d40732d --
2.37.1.223.g6a475b71f8c4

//Peter