aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-05-12 16:20:12 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-05-14 14:13:50 +0100
commit48b6f7e31ff042a4900307e830f9ed9375a8041a (patch)
treeed8fea1a9fd972e688dd8878aac4a8d5eb56ad3e
parent276a21cbbfc929f718fd758b64e3e0567534fd41 (diff)
downloadopenembedded-core-contrib-48b6f7e31ff042a4900307e830f9ed9375a8041a.tar.gz
openembedded-core-contrib-48b6f7e31ff042a4900307e830f9ed9375a8041a.tar.bz2
openembedded-core-contrib-48b6f7e31ff042a4900307e830f9ed9375a8041a.zip
glib-2.0: Fix stpcpy detection for mingw
Backport an upstream patch to fix it Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Don-t-misdetect-stpcpy-on-windows-platforms-on.patch53
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.64.2.bb1
2 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Don-t-misdetect-stpcpy-on-windows-platforms-on.patch b/meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Don-t-misdetect-stpcpy-on-windows-platforms-on.patch
new file mode 100644
index 00000000000..855bdfc0d95
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/0001-meson-Don-t-misdetect-stpcpy-on-windows-platforms-on.patch
@@ -0,0 +1,53 @@
+From d4b1fd9cdb7ae07fa6be941ac95f97ece175fe55 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin@martin.st>
+Date: Tue, 31 Mar 2020 23:54:17 +0300
+Subject: [PATCH] meson: Don't misdetect stpcpy on windows platforms on clang
+
+See https://github.com/mesonbuild/meson/issues/3672 and
+https://github.com/mesonbuild/meson/issues/5628 for explanations
+of cases where meson misdetects functions due to clang builtins (that
+always are available, regardless of whether the platform actually
+provides them).
+
+The same also happens on GCC 10, which added support for __has_builtin.
+
+Upstream-Status: Backport [https://github.com/GNOME/glib/commit/1b94bfbd72dbbfb696fa68f3742f40998096b438]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ meson.build | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/meson.build b/meson.build
+index 72ca194..bbdac1c 100644
+--- a/meson.build
++++ b/meson.build
+@@ -533,13 +533,23 @@ foreach f : functions
+ endif
+ endforeach
+
+-# Check that stpcpy() is usable; must use header
+-if cc.has_function('stpcpy', prefix : '#include <string.h>')
++# Check that stpcpy() is usable; must use header.
++# cc.has_function() in some cases (clang, gcc 10+) assumes that if the
++# compiler provides a builtin of the same name that the function exists, while
++# it's in fact not provided by any header or library. This is true for
++# stpcpy() on Windows using clang and gcc as well as posix_memalign() using
++# gcc on Windows. Skip these checks on Windows for now to avoid false
++# positives. See https://github.com/mesonbuild/meson/pull/7116,
++# https://github.com/mesonbuild/meson/issues/3672 and
++# https://github.com/mesonbuild/meson/issues/5628.
++# FIXME: Once meson no longer returns success for stpcpy() and
++# posix_memalign() on Windows using GCC and clang we can remove this.
++if host_system != 'windows' and cc.has_function('stpcpy', prefix : '#include <string.h>')
+ glib_conf.set('HAVE_STPCPY', 1)
+ endif
+
+ # Check that posix_memalign() is usable; must use header
+-if cc.has_function('posix_memalign', prefix : '#include <stdlib.h>')
++if host_system != 'windows' and cc.has_function('posix_memalign', prefix : '#include <stdlib.h>')
+ glib_conf.set('HAVE_POSIX_MEMALIGN', 1)
+ endif
+
+--
+2.26.2
+
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.64.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.64.2.bb
index 1a8e9d659e3..d6207b5b1aa 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.64.2.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.64.2.bb
@@ -16,6 +16,7 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
file://0001-Do-not-write-bindir-into-pkg-config-files.patch \
file://0001-meson-Run-atomics-test-on-clang-as-well.patch \
file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \
+ file://0001-meson-Don-t-misdetect-stpcpy-on-windows-platforms-on.patch \
"
SRC_URI_append_class-native = " file://relocate-modules.patch"