Skip to contentSkip to conversation

package/pkg-meson.mk: fix multiple _MESON_EXTRA_BINARIES

PATCH New John Keeping 4 participants 4 messages Mar 10, 2020 – Mar 21, 2020 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-meson.mk: fix multiple _MESON_EXTRA_BINARIES

If multiple entries are specified for _MESON_EXTRA_BINARIES, the current sed expression will only replace the first one.

Specifically, from GNU sed 4.8 the manual says:

/regexp/
Match lines matching the regular expression regexp. Matching is performed on the current pattern space, which can be modified with commands such as ``s///''.

so after the first binary has been added, the next entry no longer matches since the pattern space has been modifed.

Instead of adding a script for each value, apply the match once and add a subsitution for each entry.

---
 package/pkg-meson.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
package/pkg-meson.mk +4 -3
index 642b715938..6ac3f79fe9 100644
@@ -76,9 +76,10 @@ define $(2)_CONFIGURE_CMDS
 	    -e 's%@TARGET_CXXFLAGS@%$$(call make-comma-list,$$($(2)_CXXFLAGS))%g' \
 	    -e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
 	    -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
-	    $$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
-	        -e "/^\[binaries\]$$$$/s:$$$$:\n$$(x):" \
-	    ) \
+	    -e "/^\[binaries\]$$$$/ { \
+		$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
+	            s:$$$$:\n$$(x): ; \
+		) }" \
 	    package/meson/cross-compilation.conf.in \
 	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/1 package/pkg-meson.mk: fix multiple _MESON_EXTRA_BINARIES

Hello John,

Quoted 29 lines · John Keeping

If multiple entries are specified for _MESON_EXTRA_BINARIES, the current sed expression will only replace the first one.

Specifically, from GNU sed 4.8 the manual says:

/regexp/
Match lines matching the regular expression regexp. Matching is performed on the current pattern space, which can be modified with commands such as ``s///''.

so after the first binary has been added, the next entry no longer matches since the pattern space has been modifed.

Instead of adding a script for each value, apply the match once and add a subsitution for each entry.

---
 package/pkg-meson.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
package/pkg-meson.mk +0 -0
index 642b715938..6ac3f79fe9 100644
@@ -76,9 +76,10 @@ define $(2)_CONFIGURE_CMDS
 	    -e 's%@TARGET_CXXFLAGS@%$$(call make-comma-list,$$($(2)_CXXFLAGS))%g' \
 	    -e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
 	    -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \

package/pkg-meson.mk define $(2)_CONFIGURE_CMDS · line 85

Quoted 10 lines
package/pkg-meson.mk +4 -3
-	    $$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
-	        -e "/^\[binaries\]$$$$/s:$$$$:\n$$(x):" \
-	    ) \
+	    -e "/^\[binaries\]$$$$/ { \
+		$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
+	            s:$$$$:\n$$(x): ; \
+		) }" \
 	    package/meson/cross-compilation.conf.in \
 	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \

Tested with:

package/libglib2/libglib2.mk +4 -0
@@ -20,6 +20,10 @@ ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 LIBGLIB2_CFLAGS += -marm
 endif
 
+LIBGLIB2_MESON_EXTRA_BINARIES = aaa='/usr/bin/aaaaaaaaaaa' \
+       bbb='/usr/bin/bbbbbbbbbbbbbbb' \
+       ccc='/usr/bin/ccccccccccccccc'
+
 HOST_LIBGLIB2_CONF_OPTS = \
        -Ddtrace=false \
        -Dfam=false \

And checking build/libglib2-2.62.4/build/cross-compilation.conf before and after patching, only with your patch all three binaries entries are added...

Regards,
Peter

#2 lore raw

PATCH 1/1 package/pkg-meson.mk: fix multiple _MESON_EXTRA_BINARIES

In reply to John Keeping

John, All,

On 2020-03-10 12:15 +0000, John Keeping spake thusly:

Quoted 10 lines

If multiple entries are specified for _MESON_EXTRA_BINARIES, the current sed expression will only replace the first one.

Specifically, from GNU sed 4.8 the manual says:

/regexp/
Match lines matching the regular expression regexp. Matching is performed on the current pattern space, which can be modified with commands such as ``s///''.

Quoted 7 lines

so after the first binary has been added, the next entry no longer matches since the pattern space has been modifed.

Instead of adding a script for each value, apply the match once and add a subsitution for each entry.

Applied to master, but I've made that a single substituion instead. Thanks!

Regards,
Yann E. MORIN.

Quoted 29 lines
---
 package/pkg-meson.mk | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
package/pkg-meson.mk +4 -3
index 642b715938..6ac3f79fe9 100644
@@ -76,9 +76,10 @@ define $(2)_CONFIGURE_CMDS
 	    -e 's%@TARGET_CXXFLAGS@%$$(call make-comma-list,$$($(2)_CXXFLAGS))%g' \
 	    -e 's%@HOST_DIR@%$$(HOST_DIR)%g' \
 	    -e 's%@STAGING_DIR@%$$(STAGING_DIR)%g' \
-	    $$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
-	        -e "/^\[binaries\]$$$$/s:$$$$:\n$$(x):" \
-	    ) \
+	    -e "/^\[binaries\]$$$$/ { \
+		$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
+	            s:$$$$:\n$$(x): ; \
+		) }" \
 	    package/meson/cross-compilation.conf.in \
 	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH 1/1 package/pkg-meson.mk: fix multiple _MESON_EXTRA_BINARIES

In reply to John Keeping
Quoted 12 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"John" == John Keeping <[email protected]> writes:

If multiple entries are specified for _MESON_EXTRA_BINARIES, the current sed expression will only replace the first one.

Specifically, from GNU sed 4.8 the manual says:

/regexp/
Match lines matching the regular expression regexp. Matching is performed on the current pattern space, which can be modified with commands such as ``s///''.

Quoted 7 lines

so after the first binary has been added, the next entry no longer matches since the pattern space has been modifed.

Instead of adding a script for each value, apply the match once and add a subsitution for each entry.

Committed to 2020.02.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard