Skip to contentSkip to conversation

pkg-meson/libglib2: restore use of system printf

PATCH Superseded John Keeping 3 participants 9 messages Mar 10, 2020 – Mar 12, 2020 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover pkg-meson/libglib2: restore use of system printf

The first patch here adds some meson infrastructure to allow per-package properties to be set in cross-compilation.conf and the second uses it to ensure libglib2 uses the system printf, which it will not otherwise do as it depends on runtime tests to check these.

Note that patch 1 depends textually on the patch at
https://patchwork.ozlabs.org/patch/1252129/

John Keeping (2):
package/pkg-meson.mk: add FOO_MESON_EXTRA_PROPERTIES package/libglib2: restore use of system printf

 docs/manual/adding-packages-meson.txt | 8 ++++++++
 package/libglib2/libglib2.mk          | 5 +++++
 package/pkg-meson.mk                  | 4 ++++
 3 files changed, 17 insertions(+)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 package/pkg-meson.mk: add FOO_MESON_EXTRA_PROPERTIES

With autoconf packages, we often specify ac_cv_func_... cached values to avoid runtime checks during configure. With meson the equivalent is setting properties in cross-compilation.conf which we cannot do in Buildroot at the moment.

For example, libglib2 used to set ac_cv_func_printf_unix98 and ac_cv_func_vsnprintf_c99 so that the system printf could be used, but with the conversion to meson these checks fail and the gnulib fallback is used.

Add infrastructure in the same way as FOO_MESON_EXTRA_BINARIES to allow per-package modification to the cross-compilation properties.

---
 docs/manual/adding-packages-meson.txt | 8 ++++++++
 package/pkg-meson.mk                  | 4 ++++
 2 files changed, 12 insertions(+)
docs/manual/adding-packages-meson.txt +8 -0
index e84bf7f60a..c28828243c 100644
@@ -116,6 +116,14 @@ will therefore only use a few of them.
   single quotes. By default, empty. Note that Buildroot already sets the
   correct values for +c+, +cpp+, +ar+, +strip+, and +pkgconfig+.
 
+* +FOO_MESON_EXTRA_PROPERTIES+, to specify a space-separated list of
+  properties to add to the `[properties]` section of the meson
+  `cross-compilation.conf` configuration file. The format is
+  `property-name='value'`, with no space around the +=+ sign, and with the
+  value between single quotes. By default, empty. Note that Buildroot
+  already sets values for +needs_exe_wrapper+, +c_args+, +c_link_args+,
+  +cpp_args+, +cpp_link_args+, +sys_root+, and +pkg_config_libdir+.
+
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
package/pkg-meson.mk +4 -0
index 6ac3f79fe9..4df1326cad 100644
@@ -80,6 +80,10 @@ define $(2)_CONFIGURE_CMDS
 		$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
 	            s:$$$$:\n$$(x): ; \
 		) }" \
+	    -e "/^\[properties\]$$$$/ { \
+		$$(foreach x,$$($(2)_MESON_EXTRA_PROPERTIES), \
+		    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
#2 lore raw

PATCH 1/2 package/pkg-meson.mk: add FOO_MESON_EXTRA_PROPERTIES

Hello John,

Quoted 25 lines · John Keeping

With autoconf packages, we often specify ac_cv_func_... cached values to avoid runtime checks during configure. With meson the equivalent is setting properties in cross-compilation.conf which we cannot do in Buildroot at the moment.

For example, libglib2 used to set ac_cv_func_printf_unix98 and ac_cv_func_vsnprintf_c99 so that the system printf could be used, but with the conversion to meson these checks fail and the gnulib fallback is used.

Add infrastructure in the same way as FOO_MESON_EXTRA_BINARIES to allow per-package modification to the cross-compilation properties.

---
 docs/manual/adding-packages-meson.txt | 8 ++++++++
 package/pkg-meson.mk                  | 4 ++++
 2 files changed, 12 insertions(+)
docs/manual/adding-packages-meson.txt +0 -0
index e84bf7f60a..c28828243c 100644
@@ -116,6 +116,14 @@ will therefore only use a few of them.
   single quotes. By default, empty. Note that Buildroot already sets the

docs/manual/adding-packages-meson.txt will therefore only use a few of them. · line 126

Quoted 10 lines
docs/manual/adding-packages-meson.txt +8 -0
   correct values for +c+, +cpp+, +ar+, +strip+, and +pkgconfig+.
 
+* +FOO_MESON_EXTRA_PROPERTIES+, to specify a space-separated list of
+  properties to add to the `[properties]` section of the meson
+  `cross-compilation.conf` configuration file. The format is
+  `property-name='value'`, with no space around the +=+ sign, and with the
+  value between single quotes. By default, empty. Note that Buildroot
+  already sets values for +needs_exe_wrapper+, +c_args+, +c_link_args+,
+  +cpp_args+, +cpp_link_args+, +sys_root+, and +pkg_config_libdir+.
+

The description does not fit the usage in the follow-up patch (...value between single quoates...):

+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+ have_c99_vsnprintf=true \
+ have_c99_snprintf=true \
+ have_unix98_printf=true
+

With this fixed you can add my

Regards,
Peter

Quoted 18 lines
docs/manual/adding-packages-meson.txt +0 -0
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
package/pkg-meson.mk +4 -0
index 6ac3f79fe9..4df1326cad 100644
@@ -80,6 +80,10 @@ define $(2)_CONFIGURE_CMDS
 		$$(foreach x,$$($(2)_MESON_EXTRA_BINARIES), \
 	            s:$$$$:\n$$(x): ; \
 		) }" \
+	    -e "/^\[properties\]$$$$/ { \
+		$$(foreach x,$$($(2)_MESON_EXTRA_PROPERTIES), \
+		    s:$$$$:\n$$(x): ; \
+		) }" \
 	    package/meson/cross-compilation.conf.in \
 	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
#3 lore raw

PATCH 1/2 package/pkg-meson.mk: add FOO_MESON_EXTRA_PROPERTIES

Hi Peter,

Quoted 41 lines · On Tue, 10 Mar 2020 15:07:26 +0100 Peter Seiderer <[email protected]> wrote:
Quoted 25 lines · John Keeping

With autoconf packages, we often specify ac_cv_func_... cached values to avoid runtime checks during configure. With meson the equivalent is setting properties in cross-compilation.conf which we cannot do in Buildroot at the moment.

For example, libglib2 used to set ac_cv_func_printf_unix98 and ac_cv_func_vsnprintf_c99 so that the system printf could be used, but with the conversion to meson these checks fail and the gnulib fallback is used.

Add infrastructure in the same way as FOO_MESON_EXTRA_BINARIES to allow per-package modification to the cross-compilation properties.

---
 docs/manual/adding-packages-meson.txt | 8 ++++++++
 package/pkg-meson.mk                  | 4 ++++
 2 files changed, 12 insertions(+)
docs/manual/adding-packages-meson.txt +0 -0
index e84bf7f60a..c28828243c 100644
@@ -116,6 +116,14 @@ will therefore only use a few of them.
   single quotes. By default, empty. Note that Buildroot already sets the

docs/manual/adding-packages-meson.txt will therefore only use a few of them. · line 126

Quoted 10 lines
docs/manual/adding-packages-meson.txt +8 -0
   correct values for +c+, +cpp+, +ar+, +strip+, and +pkgconfig+.
 
+* +FOO_MESON_EXTRA_PROPERTIES+, to specify a space-separated list of
+  properties to add to the `[properties]` section of the meson
+  `cross-compilation.conf` configuration file. The format is
+  `property-name='value'`, with no space around the +=+ sign, and with the
+  value between single quotes. By default, empty. Note that Buildroot
+  already sets values for +needs_exe_wrapper+, +c_args+, +c_link_args+,
+  +cpp_args+, +cpp_link_args+, +sys_root+, and +pkg_config_libdir+.
+  

The description does not fit the usage in the follow-up patch (...value between single quoates...):

Review

Quoted 5 lines
(quoted diff) +5 -0
+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+	have_c99_vsnprintf=true \
+	have_c99_snprintf=true \
+	have_unix98_printf=true
+

This is a bit tricky because the meson configuration is typed, and we need to avoid double quotes for the sed command. How about changing the description to:

The format is property-name=<value> with no space around the +=+ sign, and with single quotes around string values.

?

Regards,
John

#4 lore raw

PATCH 1/2 package/pkg-meson.mk: add FOO_MESON_EXTRA_PROPERTIES

Quoted 56 lines · John Keeping

Hi Peter,

Quoted 41 lines · On Tue, 10 Mar 2020 15:07:26 +0100 Peter Seiderer <[email protected]> wrote:
Quoted 25 lines · John Keeping

With autoconf packages, we often specify ac_cv_func_... cached values to avoid runtime checks during configure. With meson the equivalent is setting properties in cross-compilation.conf which we cannot do in Buildroot at the moment.

For example, libglib2 used to set ac_cv_func_printf_unix98 and ac_cv_func_vsnprintf_c99 so that the system printf could be used, but with the conversion to meson these checks fail and the gnulib fallback is used.

Add infrastructure in the same way as FOO_MESON_EXTRA_BINARIES to allow per-package modification to the cross-compilation properties.

---
 docs/manual/adding-packages-meson.txt | 8 ++++++++
 package/pkg-meson.mk                  | 4 ++++
 2 files changed, 12 insertions(+)
docs/manual/adding-packages-meson.txt +0 -0
index e84bf7f60a..c28828243c 100644
@@ -116,6 +116,14 @@ will therefore only use a few of them.
   single quotes. By default, empty. Note that Buildroot already sets the

docs/manual/adding-packages-meson.txt will therefore only use a few of them. · line 126

Quoted 10 lines
docs/manual/adding-packages-meson.txt +8 -0
   correct values for +c+, +cpp+, +ar+, +strip+, and +pkgconfig+.
 
+* +FOO_MESON_EXTRA_PROPERTIES+, to specify a space-separated list of
+  properties to add to the `[properties]` section of the meson
+  `cross-compilation.conf` configuration file. The format is
+  `property-name='value'`, with no space around the +=+ sign, and with the
+  value between single quotes. By default, empty. Note that Buildroot
+  already sets values for +needs_exe_wrapper+, +c_args+, +c_link_args+,
+  +cpp_args+, +cpp_link_args+, +sys_root+, and +pkg_config_libdir+.
+

The description does not fit the usage in the follow-up patch (...value between single quoates...):

Review

Quoted 5 lines
(quoted diff) +5 -0
+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+	have_c99_vsnprintf=true \
+	have_c99_snprintf=true \
+	have_unix98_printf=true
+

This is a bit tricky because the meson configuration is typed, and we need to avoid double quotes for the sed command. How about changing the description to:

Quoted 3 lines

The format is property-name=<value> with no space around the +=+ sign, and with single quotes around string values.

Fine with me...

Regards,
Peter

Quoted 9 lines

?

Regards,
John
_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#5 lore raw

PATCH 2/2 package/libglib2: restore use of system printf

In reply to John Keeping

Prior to commit 4102db0f7a ("package/libglib2: bump to version 2.60.3") which converted libglib2 to meson, Buildroot used to set a range of autoconf options to bypass tests that require running binaries.

The meson version of libglib2's build system has many fewer of these checks, but there are still some and these can be fed the "correct" answer by adding properties to cross-compilation.conf.

Add the necessary properties to indicate that we have C99 compliant print functions to avoid pulling in the gnulib fallback.

---
 package/libglib2/libglib2.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libglib2/libglib2.mk +5 -0
index f00818f69c..a206639f74 100644
@@ -52,6 +52,11 @@ LIBGLIB2_CONF_OPTS = \
 	-Dinstalled_tests=false \
 	-Doss_fuzz=disabled
 
+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+	have_c99_vsnprintf=true \
+	have_c99_snprintf=true \
+	have_unix98_printf=true
+
 ifneq ($(BR2_ENABLE_LOCALE),y)
 LIBGLIB2_DEPENDENCIES += libiconv
 endif
Signature · 1 line
2.25.1
#6 lore raw

PATCH 2/2 package/libglib2: restore use of system printf

Hello John,

Quoted 21 lines · John Keeping

Prior to commit 4102db0f7a ("package/libglib2: bump to version 2.60.3") which converted libglib2 to meson, Buildroot used to set a range of autoconf options to bypass tests that require running binaries.

The meson version of libglib2's build system has many fewer of these checks, but there are still some and these can be fed the "correct" answer by adding properties to cross-compilation.conf.

Add the necessary properties to indicate that we have C99 compliant print functions to avoid pulling in the gnulib fallback.

---
 package/libglib2/libglib2.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libglib2/libglib2.mk +0 -0
index f00818f69c..a206639f74 100644

package/libglib2/libglib2.mk LIBGLIB2_CONF_OPTS = \ · line 59

Quoted 8 lines
package/libglib2/libglib2.mk +5 -0
@@ -52,6 +52,11 @@ LIBGLIB2_CONF_OPTS = \
 	-Dinstalled_tests=false \
 	-Doss_fuzz=disabled
 
+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+	have_c99_vsnprintf=true \
+	have_c99_snprintf=true \
+	have_unix98_printf=true
+

Not sure if the buildroot 'all configuration options should be set even if the default fits' applies for the cross properties here too, but there are some more:

	$ grep meson.get_cross_property build/libglib2-2.62.4/meson.build
      have_good_vsnprintf = meson.get_cross_property('have_c99_vsnprintf', false)
      have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false)
      have_good_printf = meson.get_cross_property('have_unix98_printf', false)
  glib_va_val_copy = meson.get_cross_property('va_val_copy', true)
  growing_stack = meson.get_cross_property('growing_stack', false)
  elif meson.get_cross_property('have_strlcpy', false)
  have_proc_self_cmdline = meson.get_cross_property('have_proc_self_cmdline', false)

Besides of this as the patch is surely a fix/improvement...

Regards,
Peter

Quoted 3 lines
package/libglib2/libglib2.mk +0 -0
 ifneq ($(BR2_ENABLE_LOCALE),y)
 LIBGLIB2_DEPENDENCIES += libiconv
 endif
#7 lore raw

PATCH 2/2 package/libglib2: restore use of system printf

Hi Peter,

Quoted 45 lines · On Tue, 10 Mar 2020 15:13:47 +0100 Peter Seiderer <[email protected]> wrote:
Quoted 21 lines · John Keeping

Prior to commit 4102db0f7a ("package/libglib2: bump to version 2.60.3") which converted libglib2 to meson, Buildroot used to set a range of autoconf options to bypass tests that require running binaries.

The meson version of libglib2's build system has many fewer of these checks, but there are still some and these can be fed the "correct" answer by adding properties to cross-compilation.conf.

Add the necessary properties to indicate that we have C99 compliant print functions to avoid pulling in the gnulib fallback.

---
 package/libglib2/libglib2.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libglib2/libglib2.mk +0 -0
index f00818f69c..a206639f74 100644

package/libglib2/libglib2.mk LIBGLIB2_CONF_OPTS = \ · line 59

Quoted 8 lines
package/libglib2/libglib2.mk +5 -0
@@ -52,6 +52,11 @@ LIBGLIB2_CONF_OPTS = \
 	-Dinstalled_tests=false \
 	-Doss_fuzz=disabled
 
+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+	have_c99_vsnprintf=true \
+	have_c99_snprintf=true \
+	have_unix98_printf=true
+  

Not sure if the buildroot 'all configuration options should be set even if the default fits' applies for the cross properties here too, but there are some more:

	$ grep meson.get_cross_property build/libglib2-2.62.4/meson.build
      have_good_vsnprintf = meson.get_cross_property('have_c99_vsnprintf', false)
      have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false)
      have_good_printf = meson.get_cross_property('have_unix98_printf', false)
  glib_va_val_copy = meson.get_cross_property('va_val_copy', true)
  growing_stack = meson.get_cross_property('growing_stack', false)
  elif meson.get_cross_property('have_strlcpy', false)
  have_proc_self_cmdline = meson.get_cross_property('have_proc_self_cmdline', false)
Quoted 1 line

Besides of this as the patch is surely a fix/improvement...

My understanding is that the policy is to avoid automatic configuration where the order in which packages are built will affect the result. For all of these the value is fixed to "false" when cross-compiling, so I don't think we need to specify that.

Regards,
John

Quoted 9 lines

Regards,
Peter

Quoted 3 lines
package/libglib2/libglib2.mk +0 -0
 ifneq ($(BR2_ENABLE_LOCALE),y)
 LIBGLIB2_DEPENDENCIES += libiconv
 endif  
#8 lore raw

PATCH 2/2 package/libglib2: restore use of system printf

In reply to Peter Seiderer

All;

Quoted 59 lines · Peter Seiderer

Hello John,

Quoted 21 lines · John Keeping

Prior to commit 4102db0f7a ("package/libglib2: bump to version 2.60.3") which converted libglib2 to meson, Buildroot used to set a range of autoconf options to bypass tests that require running binaries.

The meson version of libglib2's build system has many fewer of these checks, but there are still some and these can be fed the "correct" answer by adding properties to cross-compilation.conf.

Add the necessary properties to indicate that we have C99 compliant print functions to avoid pulling in the gnulib fallback.

---
 package/libglib2/libglib2.mk | 5 +++++
 1 file changed, 5 insertions(+)
package/libglib2/libglib2.mk +0 -0
index f00818f69c..a206639f74 100644

package/libglib2/libglib2.mk LIBGLIB2_CONF_OPTS = \ · line 59

Quoted 8 lines
package/libglib2/libglib2.mk +5 -0
@@ -52,6 +52,11 @@ LIBGLIB2_CONF_OPTS = \
      -Dinstalled_tests=false \
      -Doss_fuzz=disabled
 
+LIBGLIB2_MESON_EXTRA_PROPERTIES = \
+     have_c99_vsnprintf=true \
+     have_c99_snprintf=true \
+     have_unix98_printf=true
+

Not sure if the buildroot 'all configuration options should be set even if the default fits' applies for the cross properties here too, but there are some more:

        $ grep meson.get_cross_property build/libglib2-2.62.4/meson.build
      have_good_vsnprintf = meson.get_cross_property('have_c99_vsnprintf', false)
      have_good_snprintf = meson.get_cross_property('have_c99_snprintf', false)
      have_good_printf = meson.get_cross_property('have_unix98_printf', false)
  glib_va_val_copy = meson.get_cross_property('va_val_copy', true)
  growing_stack = meson.get_cross_property('growing_stack', false)
  elif meson.get_cross_property('have_strlcpy', false)
  have_proc_self_cmdline = meson.get_cross_property('have_proc_self_cmdline', false)

Besides of this as the patch is surely a fix/improvement...

Regards,
Peter

Quoted 3 lines
package/libglib2/libglib2.mk +0 -0
 ifneq ($(BR2_ENABLE_LOCALE),y)
 LIBGLIB2_DEPENDENCIES += libiconv
 endif