[oe-commits] [openembedded-core] 02/05: glib: support target/os/libc-specific Meson cross files

git at git.openembedded.org git at git.openembedded.org
Sat Jan 11 15:19:51 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 5acd9cbc9d5c6355010775250fb25f043441c5cd
Author: Ross Burton <ross.burton at intel.com>
AuthorDate: Wed Jan 8 17:19:36 2020 +0000

    glib: support target/os/libc-specific Meson cross files
    
    Build systems have a common problem that some tests can only be done by
    executing a piece of test code (compared to just compiling or linking test
    code).  In a cross-compilation the execution of this code isn't possible and the
    Meson solution to this is to allow 'cross properties' to be specified in the
    cross files.
    
    GLib has a number of these, for example determining the direction the stack
    grows, whether /proc/self/cmdline exists, or the behaviour of snprintf().
    Previously we'd passed values for these to the Glib build for target builds, but
    this misses out nativesdk builds (which are also cross-compiled) and the fact
    that some of these values are specific to the platform, some are specific to the
    host OS, and some are specific to the libc implementation.
    
    This problem has already been solved for autotools with the siteinfo class,
    which turns the target platform/OS/libc variables into filenames (such as common
    common-linux common-glibc).  We can look for these in FILESDIR and use them as
    cross files.
    
    Assuming that there are no problems with this appoach it can be moved into
    meson.bbclass so that all Meson recipes can use it for their cross files.
    
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 .../glib-2.0/glib-2.0/meson.cross.d/common         |  3 +++
 .../common-glibc}                                  |  5 -----
 .../glib-2.0/glib-2.0/meson.cross.d/common-linux   |  5 +++++
 .../glib-2.0/glib-2.0/meson.cross.d/common-mingw   |  6 +++++
 .../common-musl}                                   |  6 +----
 meta/recipes-core/glib-2.0/glib-2.0_2.62.4.bb      | 26 +++++++++++++++++++++-
 meta/recipes-core/glib-2.0/glib.inc                |  1 -
 7 files changed, 40 insertions(+), 12 deletions(-)

diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common
new file mode 100644
index 0000000..0d7c5fa
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common
@@ -0,0 +1,3 @@
+[properties]
+# On all known supported architectures the stack grows down
+growing_stack = false
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/glib-meson.cross b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc
similarity index 56%
copy from meta/recipes-core/glib-2.0/glib-2.0/glib-meson.cross
copy to meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc
index 5246c77..c4648f5 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0/glib-meson.cross
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc
@@ -3,8 +3,3 @@ have_c99_vsnprintf = true
 have_c99_snprintf = true
 have_unix98_printf = true
 va_val_copy = true
-growing_stack = false
-have_proc_self_cmdline = true
-
-[binaries]
-env = "/usr/bin/env"
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux
new file mode 100644
index 0000000..83596e0
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux
@@ -0,0 +1,5 @@
+[properties]
+have_proc_self_cmdline = true
+
+[binaries]
+env = "/usr/bin/env"
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw
new file mode 100644
index 0000000..75f911b
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw
@@ -0,0 +1,6 @@
+[properties]
+have_c99_vsnprintf = false
+have_c99_snprintf = false
+have_unix98_printf = false
+va_val_copy = true
+have_proc_self_cmdline = false
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/glib-meson.cross b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl
similarity index 56%
rename from meta/recipes-core/glib-2.0/glib-2.0/glib-meson.cross
rename to meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl
index 5246c77..3049e51 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0/glib-meson.cross
+++ b/meta/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl
@@ -3,8 +3,4 @@ have_c99_vsnprintf = true
 have_c99_snprintf = true
 have_unix98_printf = true
 va_val_copy = true
-growing_stack = false
-have_proc_self_cmdline = true
-
-[binaries]
-env = "/usr/bin/env"
+have_strlcpy = true
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.62.4.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.62.4.bb
index 7bf8648..953fba5 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.62.4.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.62.4.bb
@@ -18,7 +18,31 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
            "
 
 SRC_URI_append_class-native = " file://relocate-modules.patch"
-SRC_URI_append_class-target = " file://glib-meson.cross"
 
 SRC_URI[md5sum] = "d52234ecba128932bed90bbc3553bfe5"
 SRC_URI[sha256sum] = "4c84030d77fa9712135dfa8036ad663925655ae95b1d19399b6200e869925bbc"
+
+# Find any meson cross files in FILESPATH that are relevant for the current
+# build (using siteinfo) and add them to EXTRA_OEMESON.
+inherit siteinfo
+def find_meson_cross_files(d):
+    if bb.data.inherits_class('native', d):
+        return ""
+
+    import collections
+    sitedata = siteinfo_data(d)
+    # filename -> found
+    files = collections.OrderedDict()
+    for path in d.getVar("FILESPATH").split(":"):
+        for element in sitedata:
+            filename = os.path.join(path, "meson.cross.d", element)
+            files[filename] = os.path.exists(filename)
+
+    items = ["--cross-file=" + k for k,v in files.items() if v]
+    d.appendVar("EXTRA_OEMESON", " " + " ".join(items))
+    items = ["%s:%s" % (k, "True" if v else "False") for k,v in files.items()]
+    d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(items))
+
+python () {
+    find_meson_cross_files(d)
+}
diff --git a/meta/recipes-core/glib-2.0/glib.inc b/meta/recipes-core/glib-2.0/glib.inc
index e811b42..f4aff29 100644
--- a/meta/recipes-core/glib-2.0/glib.inc
+++ b/meta/recipes-core/glib-2.0/glib.inc
@@ -49,7 +49,6 @@ PACKAGECONFIG[libelf] = ",,elfutils"
 PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false,dbus"
 
 EXTRA_OEMESON = "-Ddtrace=false -Dfam=false -Dsystemtap=false -Dselinux=disabled"
-EXTRA_OEMESON_append_class-target = " --cross-file ${WORKDIR}/glib-meson.cross"
 
 do_configure_prepend() {
 	sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list