Skip to contentSkip to conversation

siteinfo: generalise siteinfo

PATCH Superseded Ross Burton 1 participant 6 messages Sep 25, 2018 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 siteinfo: generalise siteinfo

---
 meta/classes/siteinfo.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
meta/classes/siteinfo.bbclass +4 -3
index 4698e6e474d..e80835605fb 100644
@@ -15,7 +15,7 @@
 # It is an error for the target not to exist.
 # If 'what' doesn't exist then an empty value is returned
 #
-def siteinfo_data(d):
+def siteinfo_data_for_machine(hostarch, hostos, d):
     archinfo = {
         "allarch": "endian-little bit-32", # bogus, but better than special-casing the checks below for allarch
         "aarch64": "endian-little bit-64 arm-common arm-64",
@@ -131,8 +131,6 @@ def siteinfo_data(d):
         locs = { "archinfo" : archinfo, "osinfo" : osinfo, "targetinfo" : targetinfo, "d" : d}
         archinfo, osinfo, targetinfo = bb.utils.better_eval(call, locs)
 
-    hostarch = d.getVar("HOST_ARCH")
-    hostos = d.getVar("HOST_OS")
     target = "%s-%s" % (hostarch, hostos)
 
     sitedata = []
@@ -148,6 +146,9 @@ def siteinfo_data(d):
     bb.debug(1, "SITE files %s" % sitedata);
     return sitedata
 
+def siteinfo_data(d):
+    return siteinfo_data_for_machine(d.getVar("HOST_ARCH"), d.getVar("HOST_OS"), d)
+
 python () {
     sitedata = set(siteinfo_data(d))
     if "endian-little" in sitedata:
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/6 meson: squash the architecture warning patches together

Instead of one patch to change a warning into an exception and another to change the message, squash the patches together as neither of the are acceptable upstream.

---
 meta/recipes-devtools/meson/meson.inc              |  1 -
 .../0002-Make-CPU-family-warnings-fatal.patch      |  4 +--
 ...r-to-our-wiki-instead-of-Meson-bug-system.patch | 38 ----------------------
 3 files changed, 2 insertions(+), 41 deletions(-)
 delete mode 100644 meta/recipes-devtools/meson/meson/0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch
meta/recipes-devtools/meson/meson.inc +0 -1
index e7f999a205d..cfb831b106f 100644
@@ -10,7 +10,6 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
            file://0001-Linker-rules-move-cross_args-in-front-of-output_args.patch \
            file://0003-native_bindir.patch \
            file://0002-Make-CPU-family-warnings-fatal.patch \
-           file://0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch \
            file://0001-Support-building-allarch-recipes-again.patch \
            "
 SRC_URI[sha256sum] = "92d8afd921751261e36151643464efd3394162f69efbe8cd53e0a66b1cf395eb"
meta/recipes-devtools/meson/meson/0002-Make-CPU-family-warnings-fatal.patch +2 -2
index a6c1b25c46b..ca56a6a8bff 100644
@@ -21,7 +21,7 @@ index d29a77f..267acf9 100644
 -        mlog.warning('Unknown CPU family {!r}, please report this at '
 -                     'https://github.com/mesonbuild/meson/issues/new with the'
 -                     'output of `uname -a` and `cat /proc/cpuinfo`'.format(trial))
-+        raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
++        raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % trial)
  
      return trial
  
@@ -30,7 +30,7 @@ index d29a77f..267acf9 100644
  
                  if entry == 'cpu_family' and res not in known_cpu_families:
 -                    mlog.warning('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % value)
-+                    raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
++                    raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % value)
  
                  if self.ok_type(res):
                      self.config[s][entry] = res
meta/recipes-devtools/meson/meson/0003-Send-user-to-our-wiki-instead-of-Meson-bug-system.patch deleted +0 -38
deleted file mode 100644
index 5295335730e..00000000000
@@ -1,38 +0,0 @@
-From 31df0a854aa40c4ce8fbf1ca02ccc9b6bff0abfd Mon Sep 17 00:00:00 2001
-From: Ross Burton <[email protected]>
-Date: Fri, 6 Jul 2018 15:51:15 +0100
-Subject: [PATCH] Send user to our wiki instead of Meson bug system
-
-If a CPU family isn't recognised the first step should be to verify the
-mapping. Send the user to a wiki page explaining what to do, instead of
-directly to the Meson bug tracker.
-
-Upstream-Status: Inappropriate [OE specific]
-Signed-off-by: Ross Burton <[email protected]>
-
----
- mesonbuild/environment.py | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
-index 267acf9..19a3c1e 100644
---- a/mesonbuild/environment.py
-+++ b/mesonbuild/environment.py
-@@ -239,7 +239,7 @@ def detect_cpu_family(compilers):
-         return 'x86_64'
- 
-     if trial not in known_cpu_families:
--        raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
-+        raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % trial)
- 
-     return trial
- 
-@@ -1012,7 +1012,7 @@ class CrossBuildInfo:
-                     raise EnvironmentException('Malformed value in cross file variable %s.' % entry)
- 
-                 if entry == 'cpu_family' and res not in known_cpu_families:
--                    raise EnvironmentException('Unknown CPU family %s, please report this at https://github.com/mesonbuild/meson/issues/new' % trial)
-+                    raise EnvironmentException('Unknown CPU family %s, see https://wiki.yoctoproject.org/wiki/Meson/UnknownCPU for directions.' % value)
- 
-                 if self.ok_type(res):
-                     self.config[s][entry] = res
Signature · 1 line
2.11.0
#2 lore raw

PATCH 3/6 meson: pass correct endian in the cross file

In reply to Ross Burton

Meson doesn't care for the value of the endian field, but packages may want to use it and Meson master now validates the value.

Use siteinfo to obtain the endianism and write the correct value.

---
 meta/classes/meson.bbclass | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
meta/classes/meson.bbclass +13 -7
index e3b452786d8..07322cf7865 100644
@@ -1,4 +1,4 @@
-inherit python3native
+inherit siteinfo python3native
 
 DEPENDS_append = " meson-native ninja-native"
 
@@ -31,10 +31,6 @@ MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CFLAGS}"
 MESON_CPP_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CXXFLAGS}"
 MESON_LINK_ARGS = "${MESON_TOOLCHAIN_ARGS} ${LDFLAGS}"
 
-# both are required but not used by meson
-MESON_HOST_ENDIAN = "bogus-endian"
-MESON_TARGET_ENDIAN = "bogus-endian"
-
 EXTRA_OEMESON_append = " ${PACKAGECONFIG_CONFARGS}"
 
 MESON_CROSS_FILE = ""
@@ -59,6 +55,16 @@ def meson_cpu_family(var, d):
     else:
         return arch
 
+def meson_endian(prefix, d):
+    arch, os = d.getVar(prefix + "_ARCH"), d.getVar(prefix + "_OS")
+    sitedata = siteinfo_data_for_machine(arch, os, d)
+    if "endian-little" in sitedata:
+        return "little"
+    elif "endian-big" in sitedata:
+        return "big"
+    else:
+        bb.fatal("Cannot determine endianism for %s-%s" % (arch, os))
+
 addtask write_config before do_configure
 do_write_config[vardeps] += "MESON_C_ARGS MESON_CPP_ARGS MESON_LINK_ARGS CC CXX LD AR NM STRIP READELF"
 do_write_config() {
@@ -86,13 +92,13 @@ gtkdoc_exe_wrapper = '${B}/gtkdoc-qemuwrapper'
 system = '${HOST_OS}'
 cpu_family = '${@meson_cpu_family('HOST_ARCH', d)}'
 cpu = '${HOST_ARCH}'
-endian = '${MESON_HOST_ENDIAN}'
+endian = '${@meson_endian('HOST', d)}'
 
 [target_machine]
 system = '${TARGET_OS}'
 cpu_family = '${@meson_cpu_family('TARGET_ARCH', d)}'
 cpu = '${TARGET_ARCH}'
-endian = '${MESON_TARGET_ENDIAN}'
+endian = '${@meson_endian('TARGET', d)}'
 EOF
 }
 
Signature · 1 line
2.11.0
#3 lore raw

PATCH 4/6 meson: stop Meson using target CFLAGS in native builds

In reply to Ross Burton

With the goal of autoconf-compatibility Meson respects $CFLAGS et al in builds. In cross-compiled build the cross file is the one true source of flags and the environment isn't used, but in a native build the environment will still be respected.

As this can lead to target flags being used in the build for native binaries (including a single native binary inside a target recipe), export CFLAGS=${BUILD_CFLAGS) et al.

---
 meta/classes/meson.bbclass | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
meta/classes/meson.bbclass +10 -5
index 07322cf7865..ed08a4058cb 100644
@@ -24,7 +24,11 @@ MESONOPTS = " --prefix ${prefix} \
               --infodir ${@noprefix('infodir', d)} \
               --sysconfdir ${sysconfdir} \
               --localstatedir ${localstatedir} \
-              --sharedstatedir ${sharedstatedir}"
+              --sharedstatedir ${sharedstatedir} \
+              -Dc_args='${BUILD_CPPFLAGS} ${BUILD_CFLAGS}' \
+              -Dc_link_args='${BUILD_LDFLAGS}' \
+              -Dcpp_args='${BUILD_CPPFLAGS} ${BUILD_CXXFLAGS}' \
+              -Dcpp_link_args='${BUILD_LDFLAGS}'"
 
 MESON_TOOLCHAIN_ARGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}"
 MESON_C_ARGS = "${MESON_TOOLCHAIN_ARGS} ${CFLAGS}"
@@ -114,14 +118,15 @@ meson_do_configure() {
 override_native_tools() {
     # Set these so that meson uses the native tools for its build sanity tests,
     # which require executables to be runnable. The cross file will still
-    # override these for the target build. Note that we do *not* set CFLAGS,
-    # LDFLAGS, etc. as they will be slurped in by meson and applied to the
-    # target build, causing errors.
+    # override these for the target build.
     export CC="${BUILD_CC}"
     export CXX="${BUILD_CXX}"
     export LD="${BUILD_LD}"
     export AR="${BUILD_AR}"
-
+    # These contain *target* flags but will be used as *native* flags.  The
+    # correct native flags will be passed via -Dc_args and so on, unset them so
+    # they don't interfere with tools invoked by Meson (such as g-ir-scanner)
+    unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS
 }
 
 meson_do_configure_prepend_class-target() {
Signature · 1 line
2.11.0
#4 lore raw

PATCH 5/6 meson: respect target/native flag distinction in G-I and gtk-doc

In reply to Ross Burton

Remove the previous attempt at this from 0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch as it wasn't quite right, and the rest of the patch is adding the currently not upstreamable runner option.

Add two new patches to fix both gobject-introspection and gtk-doc using native flags for target compiles.

---
 meta/recipes-devtools/meson/meson.inc              |  2 +
 ...ix-issues-that-arise-when-cross-compiling.patch | 26 -------------
 meta/recipes-devtools/meson/meson/gi-flags.patch   | 21 +++++++++++
 .../meson/meson/gtkdoc-flags.patch                 | 44 ++++++++++++++++++++++
 4 files changed, 67 insertions(+), 26 deletions(-)
 create mode 100644 meta/recipes-devtools/meson/meson/gi-flags.patch
 create mode 100644 meta/recipes-devtools/meson/meson/gtkdoc-flags.patch
meta/recipes-devtools/meson/meson.inc +2 -0
index cfb831b106f..205d2a4abd7 100644
@@ -11,6 +11,8 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
            file://0003-native_bindir.patch \
            file://0002-Make-CPU-family-warnings-fatal.patch \
            file://0001-Support-building-allarch-recipes-again.patch \
+           file://gi-flags.patch \
+           file://gtkdoc-flags.patch \
            "
 SRC_URI[sha256sum] = "92d8afd921751261e36151643464efd3394162f69efbe8cd53e0a66b1cf395eb"
 SRC_URI[md5sum] = "31bda3519d8c0eb3438267268a78085e"
meta/recipes-devtools/meson/meson/0001-gtkdoc-fix-issues-that-arise-when-cross-compiling.patch +0 -26
index 57cb678f2c8..7ffd6c54cb0 100644
@@ -35,32 +35,6 @@ index cb69641..727eb6a 100644
          args += self._unpack_args('--htmlargs=', 'html_args', kwargs)
          args += self._unpack_args('--scanargs=', 'scan_args', kwargs)
          args += self._unpack_args('--scanobjsargs=', 'scanobjs_args', kwargs)
-@@ -854,14 +858,22 @@ This will become a hard error in the future.''')
-         ldflags.update(internal_ldflags)
-         ldflags.update(state.environment.coredata.get_external_link_args('c'))
-         ldflags.update(external_ldflags)
-+
-+        cross_c_args = " ".join(state.environment.cross_info.config["properties"].get('c_args', ""))
-+        cross_link_args = " ".join(state.environment.cross_info.config["properties"].get('c_link_args', ""))
-+
-         if cflags:
--            args += ['--cflags=%s' % ' '.join(cflags)]
-+            args += ['--cflags=%s %s' % (cross_c_args,' '.join(cflags))]
-         if ldflags:
--            args += ['--ldflags=%s' % ' '.join(ldflags)]
-+            args += ['--ldflags=%s %s' % (cross_link_args, ' '.join(ldflags))]
-         compiler = state.environment.coredata.compilers.get('c')
--        if compiler:
-+        cross_compiler = state.environment.coredata.cross_compilers.get('c')
-+        if compiler and not state.environment.is_cross_build():
-             args += ['--cc=%s' % ' '.join(compiler.get_exelist())]
-             args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())]
-+        elif cross_compiler and state.environment.is_cross_build():
-+            args += ['--cc=%s' % ' '.join(cross_compiler.get_exelist())]
-+            args += ['--ld=%s' % ' '.join(cross_compiler.get_linker_exelist())]
- 
-         return args
- 
 diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
 index 948dc5a..9c5bd19 100644
 --- a/mesonbuild/scripts/gtkdochelper.py
meta/recipes-devtools/meson/meson/gi-flags.patch new file +21 -0
new file mode 100644
index 00000000000..b437ce37cf7
@@ -0,0 +1,21 @@
+Pass the correct cflags/ldflags to the gobject-introspection tools.
+
+Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/4261]
+Signed-off-by: Ross Burton <[email protected]>
+
+diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
+index cb69641e..bb4449a0 100644
+--- a/mesonbuild/modules/gnome.py
++++ b/mesonbuild/modules/gnome.py
+@@ -579,7 +579,10 @@ class GnomeModule(ExtensionModule):
+         external_ldflags += list(dep_external_ldflags)
+         scan_command += ['--cflags-begin']
+         scan_command += cflags
+-        scan_command += state.environment.coredata.get_external_args(lang)
++        if state.environment.is_cross_build():
++            scan_command += state.environment.cross_info.config["properties"].get(lang + '_args', "")
++        else:
++            scan_command += state.environment.coredata.get_external_args(lang)
+         scan_command += ['--cflags-end']
+         # need to put our output directory first as we need to use the
+         # generated libraries instead of any possibly installed system/prefix
meta/recipes-devtools/meson/meson/gtkdoc-flags.patch new file +44 -0

44 lines not on this page · raw message

Signature · 1 line
2.11.0
#5 lore raw

PATCH 6/6 meson: make native-specific patches native-specific

In reply to Ross Burton

These two patches are only relevant for builds inside OpenEmbedded, so make them native-specific.

---
 meta/recipes-devtools/meson/meson.inc | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
meta/recipes-devtools/meson/meson.inc +4 -2
index 205d2a4abd7..b7fb3e698a1 100644
@@ -9,14 +9,16 @@ SRC_URI = "https://github.com/mesonbuild/meson/releases/download/${PV}/meson-${P
            file://0002-gobject-introspection-determine-g-ir-scanner-and-g-i.patch \
            file://0001-Linker-rules-move-cross_args-in-front-of-output_args.patch \
            file://0003-native_bindir.patch \
-           file://0002-Make-CPU-family-warnings-fatal.patch \
-           file://0001-Support-building-allarch-recipes-again.patch \
            file://gi-flags.patch \
            file://gtkdoc-flags.patch \
            "
 SRC_URI[sha256sum] = "92d8afd921751261e36151643464efd3394162f69efbe8cd53e0a66b1cf395eb"
 SRC_URI[md5sum] = "31bda3519d8c0eb3438267268a78085e"
 
+SRC_URI_append_class-native = "file://0002-Make-CPU-family-warnings-fatal.patch \
+                               file://0001-Support-building-allarch-recipes-again.patch \
+                               "
+
 UPSTREAM_CHECK_URI = "https://github.com/mesonbuild/meson/releases"
 
 inherit setuptools3
Signature · 1 line
2.11.0