From 021ac67cc29af0f48cebb755fe306339e75b5eb2 Mon Sep 17 00:00:00 2001 From: Michael Cobb michael.cobb@iceotope.com Date: Tue, 20 Aug 2024 15:34:52 +0100 Subject: [PATCH 4/4] glib-2.0: C64 initial commit
Initial commit of Glib 2.76.4 recipes
Requires util-linux to be built with `--enable-libmount` (see patch 3/4)
Signed-off-by: Michael Cobb michael.cobb@iceotope.com --- .../glib-2.0/glib-2.0-morello_2.76.4.bb | 58 +++ ...0001-Fix-DATADIRNAME-on-uclibc-Linux.patch | 30 ++ ...-gio-querymodules-as-libexec_PROGRAM.patch | 27 ++ ...ng-about-deprecated-paths-in-schemas.patch | 40 ++ ...-correctly-when-building-with-mingw3.patch | 81 ++++ .../0001-add-disable-cxx-build-option.patch | 36 ++ ...ces.c-comment-out-a-build-host-only-.patch | 28 ++ ...on-Run-atomics-test-on-clang-as-well.patch | 29 ++ ...-fix-iconv-libintl-library-not-found.patch | 61 +++ ...sable-testing-host-binaries-when-cro.patch | 59 +++ ...dcode-python-path-into-various-tools.patch | 44 +++ .../glib-2.0/glib-2.0/memory-monitor.patch | 362 ++++++++++++++++++ .../glib-2.0/glib-2.0/meson.cross.d/common | 3 + .../glib-2.0/meson.cross.d/common-glibc | 5 + .../glib-2.0/meson.cross.d/common-linux | 5 + .../glib-2.0/meson.cross.d/common-mingw | 6 + .../glib-2.0/meson.cross.d/common-morello | 3 + .../glib-2.0/meson.cross.d/common-musl | 6 + .../glib-2.0/glib-2.0/skip-timeout.patch | 30 ++ recipes-core/glib-2.0/glib-morello.inc | 170 ++++++++ 20 files changed, 1083 insertions(+) create mode 100644 recipes-core/glib-2.0/glib-2.0-morello_2.76.4.bb create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-add-disable-cxx-build-option.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0002-fix-iconv-libintl-library-not-found.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0003-Add-option-to-disable-testing-host-binaries-when-cro.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/memory-monitor.patch create mode 100644 recipes-core/glib-2.0/glib-2.0/meson.cross.d/common create mode 100644 recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc create mode 100644 recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux create mode 100644 recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw create mode 100644 recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-morello create mode 100644 recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl create mode 100644 recipes-core/glib-2.0/glib-2.0/skip-timeout.patch create mode 100644 recipes-core/glib-2.0/glib-morello.inc
diff --git a/recipes-core/glib-2.0/glib-2.0-morello_2.76.4.bb b/recipes-core/glib-2.0/glib-2.0-morello_2.76.4.bb new file mode 100644 index 0000000..91f73c4 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0-morello_2.76.4.bb @@ -0,0 +1,58 @@ +require glib-morello.inc + +PE = "1" + +SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" +SRC_URI += "git://github.com/CTSRD-CHERI/glib.git;protocol=https;branch=2.76.4-cheriabi;rev=36ccd7a907969b31fdd8e26c1bfd8f539f0e92c3 \ + file://0001-Fix-DATADIRNAME-on-uclibc-Linux.patch \ + file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \ + file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ + file://0010-Do-not-hardcode-python-path-into-various-tools.patch \ + file://0001-Set-host_machine-correctly-when-building-with-mingw3.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://memory-monitor.patch \ + file://skip-timeout.patch \ + file://0001-add-disable-cxx-build-option.patch \ + file://0002-fix-iconv-libintl-library-not-found.patch \ + file://0003-Add-option-to-disable-testing-host-binaries-when-cro.patch \ + " + +SRC_URI[sha256sum] = "b9cfb6f7a5bd5b31238fd5d56df226b2dda5ea37611475bf89f6a0f9400fe8bd" + +FILESEXTRAPATHS:prepend := "${THISDIR}/glib-2.0:" + +TOOLCHAIN = "${MORELLO_TOOLCHAIN}" + +CFLAGS += " -DNVALGRIND=1 -DG_ENABLE_EXPERIMENTAL_ABI_COMPILATION" + +# 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 "" + + thisdir = os.path.normpath(d.getVar("THISDIR")) + 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.normpath(os.path.join(path, "meson.cross.d", element)) + sanitized_path = filename.replace(thisdir, "${THISDIR}") + if sanitized_path == filename: + if os.path.exists(filename): + bb.error("Cannot add '%s' to --cross-file, because it's not relative to THISDIR '%s' and sstate signature would contain this full path" % (filename, thisdir)) + continue + files[filename.replace(thisdir, "${THISDIR}")] = 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/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch b/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch new file mode 100644 index 0000000..b5a1933 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-Fix-DATADIRNAME-on-uclibc-Linux.patch @@ -0,0 +1,30 @@ +From 0d508b650cee67f887e307cb35f3863e872bdd8f Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Sat, 15 Mar 2014 22:42:29 -0700 +Subject: [PATCH] Fix DATADIRNAME on uclibc/Linux + +translation files are always installed under PREFIX/share/locale in uclibc +based systems therefore lets set DATADIRNAME to "share". + +Signed-off-by: Khem Raj raj.khem@gmail.com +Upstream-Status: Pending + +--- + m4macros/glib-gettext.m4 | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/m4macros/glib-gettext.m4 b/m4macros/glib-gettext.m4 +index df6fbf012..47db864eb 100644 +--- a/m4macros/glib-gettext.m4 ++++ b/m4macros/glib-gettext.m4 +@@ -293,6 +293,10 @@ msgstr "" + CATOBJEXT=.mo + DATADIRNAME=share + ;; ++ *-*-musl* | *-*-linux-uclibc*) ++ CATOBJEXT=.gmo ++ DATADIRNAME=share ++ ;; + *) + CATOBJEXT=.mo + DATADIRNAME=lib diff --git a/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch b/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch new file mode 100644 index 0000000..c425933 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-Install-gio-querymodules-as-libexec_PROGRAM.patch @@ -0,0 +1,27 @@ +From 40f9792a6f42733d09de1c2a71be8e9b51d36b9c Mon Sep 17 00:00:00 2001 +From: Jussi Kukkonen jussi.kukkonen@intel.com +Date: Tue, 22 Mar 2016 15:14:58 +0200 +Subject: [PATCH] Install gio-querymodules as libexec_PROGRAM + +We want to install this binary with the gio library, and debian +renamer does not cope with library packages with files in ${bindir} + +Signed-off-by: Jussi Kukkonen jussi.kukkonen@intel.com +Upstream-Status: Inappropriate [OE specific] + +--- + gio/meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gio/meson.build b/gio/meson.build +index 462606f3b..0e084ff38 100644 +--- a/gio/meson.build ++++ b/gio/meson.build +@@ -1001,6 +1001,7 @@ gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodu + c_args : gio_c_args, + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, ++ install_dir: glib_libexecdir, + dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) + + glib_compile_schemas = executable('glib-compile-schemas', diff --git a/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch b/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch new file mode 100644 index 0000000..ea3199c --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch @@ -0,0 +1,40 @@ +From 0c5c690152375e0cd803229076dff40b96e51bbd Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex.kanavin@gmail.com +Date: Fri, 12 Jun 2015 17:08:46 +0300 +Subject: [PATCH] Remove the warning about deprecated paths in schemas + +Some schemas in gsettings-desktop-schemas (such as proxy and locale) +are still using deprecated paths, as of 3.16.1. This causes warning +messages, and meta/lib/oe/rootfs.py complaints about them. + +Upstream-Status: Inappropriate +Signed-off-by: Alexander Kanavin alex.kanavin@gmail.com + +--- + gio/glib-compile-schemas.c | 13 ------------- + 1 file changed, 13 deletions(-) + +diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c +index 04ef40457..e791ce254 100644 +--- a/gio/glib-compile-schemas.c ++++ b/gio/glib-compile-schemas.c +@@ -1232,19 +1232,6 @@ parse_state_start_schema (ParseState *state, + return; + } + +- if (path && (g_str_has_prefix (path, "/apps/") || +- g_str_has_prefix (path, "/desktop/") || +- g_str_has_prefix (path, "/system/"))) +- { +- gchar *message = NULL; +- message = g_strdup_printf (_("Warning: Schema “%s” has path “%s”. " +- "Paths starting with " +- "“/apps/”, “/desktop/” or “/system/” are deprecated."), +- id, path); +- g_printerr ("%s\n", message); +- g_free (message); +- } +- + state->schema_state = schema_state_new (path, gettext_domain, + extends, extends_name, list_of); + diff --git a/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch b/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch new file mode 100644 index 0000000..ae5f616 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-Set-host_machine-correctly-when-building-with-mingw3.patch @@ -0,0 +1,81 @@ +From 11fd1fb8c2a861e6c6f4afa5163ee56616c81de2 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex.kanavin@gmail.com +Date: Wed, 13 Feb 2019 15:32:05 +0100 +Subject: [PATCH] Set host_machine correctly when building with mingw32 + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin alex.kanavin@gmail.com + +--- + gio/tests/meson.build | 8 ++++---- + glib/tests/meson.build | 2 +- + meson.build | 3 +++ + 3 files changed, 8 insertions(+), 5 deletions(-) + +diff --git a/gio/tests/meson.build b/gio/tests/meson.build +index 2631b1285..1c0016957 100644 +--- a/gio/tests/meson.build ++++ b/gio/tests/meson.build +@@ -29,7 +29,7 @@ endif + + test_cpp_args = test_c_args + +-if host_machine.system() == 'windows' ++if host_system == 'windows' + common_gio_tests_deps += [iphlpapi_dep, winsock2, cc.find_library ('secur32')] + endif + +@@ -225,7 +225,7 @@ if have_dbus_daemon + endif + + # Test programs buildable on UNIX only +-if host_machine.system() != 'windows' ++if host_system != 'windows' + gio_tests += { + 'file' : {}, + 'gdbus-peer-object-manager' : {}, +@@ -551,7 +551,7 @@ if host_machine.system() != 'windows' + endif # unix + + # Test programs buildable on Windows only +-if host_machine.system() == 'windows' ++if host_system == 'windows' + gio_tests += {'win32-streams' : {}} + endif + +@@ -621,7 +621,7 @@ if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl' + } + endif + +-if host_machine.system() != 'windows' ++if host_system != 'windows' + test_extra_programs += { + 'gdbus-example-unix-fd-client' : { + 'install' : false, +diff --git a/glib/tests/meson.build b/glib/tests/meson.build +index 72a6ff92b..223bd141c 100644 +--- a/glib/tests/meson.build ++++ b/glib/tests/meson.build +@@ -209,7 +209,7 @@ if glib_conf.has('HAVE_EVENTFD') + } + endif + +-if host_machine.system() == 'windows' ++if host_system == 'windows' + if winsock2.found() + glib_tests += { + 'gpoll' : { +diff --git a/meson.build b/meson.build +index a4a271a0a..13f7612e6 100644 +--- a/meson.build ++++ b/meson.build +@@ -52,6 +52,9 @@ else + endif + + host_system = host_machine.system() ++if host_system == 'mingw32' ++ host_system = 'windows' ++endif + + if host_system == 'darwin' + ios_test_code = '''#include <TargetConditionals.h> diff --git a/recipes-core/glib-2.0/glib-2.0/0001-add-disable-cxx-build-option.patch b/recipes-core/glib-2.0/glib-2.0/0001-add-disable-cxx-build-option.patch new file mode 100644 index 0000000..ebf9556 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-add-disable-cxx-build-option.patch @@ -0,0 +1,36 @@ +From a43ffde17d160e07364b8352925b1c31009b7dfe Mon Sep 17 00:00:00 2001 +From: Michael Cobb michael.cobb@iceotope.com +Date: Wed, 12 Jun 2024 10:13:50 +0100 +Subject: [PATCH] add disable cxx build option + +--- + meson.build | 2 +- + meson_options.txt | 5 +++++ + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 17d7bc08e..73523db34 100644 +--- a/meson.build ++++ b/meson.build +@@ -19,7 +19,7 @@ foreach std : ['90', '99', '11', '17'] + endif + endforeach + +-have_cxx = add_languages('cpp', native: false, required: get_option('oss_fuzz').enabled()) ++have_cxx = not get_option('disable_cxx') and add_languages('cpp', native: false, required: get_option('oss_fuzz').enabled()) + if have_cxx + cxx = meson.get_compiler('cpp') + cxx_standards = {} +diff --git a/meson_options.txt b/meson_options.txt +index 517d5757c..09ddc9318 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -125,3 +125,8 @@ option('multiarch', + type : 'boolean', + value : false, + description : 'Install some helper executables in per-architecture locations') ++ ++option('disable_cxx', ++ type: 'boolean', ++ value: false, ++ description: 'Disable the use of C++ compiler for tests if your platform does not have a working C++ compiler') diff --git a/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch b/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch new file mode 100644 index 0000000..d59ba74 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch @@ -0,0 +1,28 @@ +From bb250d23bfc333fe21ea7935ef8895382b616a93 Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex.kanavin@gmail.com +Date: Wed, 8 Jan 2020 18:22:46 +0100 +Subject: [PATCH] gio/tests/resources.c: comment out a build host-only test + +This test requires building resources in a way that is +not cross-compatible (hardcodes ld and objcopy). + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin alex.kanavin@gmail.com + +--- + gio/tests/resources.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/gio/tests/resources.c b/gio/tests/resources.c +index f567914d7..b21b6166d 100644 +--- a/gio/tests/resources.c ++++ b/gio/tests/resources.c +@@ -1068,7 +1068,7 @@ main (int argc, + g_test_add_func ("/resource/automatic", test_resource_automatic); + /* This only uses automatic resources too, so it tests the constructors and destructors */ + g_test_add_func ("/resource/module", test_resource_module); +- g_test_add_func ("/resource/binary-linked", test_resource_binary_linked); ++ /* g_test_add_func ("/resource/binary-linked", test_resource_binary_linked); */ + #endif + g_test_add_func ("/resource/uri/query-info", test_uri_query_info); + g_test_add_func ("/resource/uri/file", test_uri_file); diff --git a/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch b/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch new file mode 100644 index 0000000..c1760dc --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0001-meson-Run-atomics-test-on-clang-as-well.patch @@ -0,0 +1,29 @@ +From 880bbcbb2d83c2ad9ef0f9342719c3a0fddf4aec Mon Sep 17 00:00:00 2001 +From: Khem Raj raj.khem@gmail.com +Date: Sat, 12 Oct 2019 17:46:26 -0700 +Subject: [PATCH] meson: Run atomics test on clang as well + +Fixes +./glib-2.62.1/glib/gatomic.c:675:2: error: G_ATOMIC_LOCK_FREE defined, but incapable of lock-free atomics. +^ + +Upstream-Status: Pending +Signed-off-by: Khem Raj raj.khem@gmail.com + +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index 13f7612e6..17d7bc08e 100644 +--- a/meson.build ++++ b/meson.build +@@ -1905,7 +1905,7 @@ atomicdefine = ''' + # We know that we can always use real ("lock free") atomic operations with MSVC + if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, name : 'atomic ops') + have_atomic_lock_free = true +- if cc.get_id() == 'gcc' and not cc.compiles(atomicdefine, name : 'atomic ops define') ++ if (cc.get_id() == 'gcc' or cc.get_id() == 'clang') and not cc.compiles(atomicdefine, name : 'atomic ops define') + # Old gcc release may provide + # __sync_bool_compare_and_swap but doesn't define + # __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 diff --git a/recipes-core/glib-2.0/glib-2.0/0002-fix-iconv-libintl-library-not-found.patch b/recipes-core/glib-2.0/glib-2.0/0002-fix-iconv-libintl-library-not-found.patch new file mode 100644 index 0000000..d7d4991 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0002-fix-iconv-libintl-library-not-found.patch @@ -0,0 +1,61 @@ +From 8c7150407029080b7f8598559d43606f44e23c8b Mon Sep 17 00:00:00 2001 +From: Michael Cobb michael.cobb@iceotope.com +Date: Wed, 12 Jun 2024 10:15:39 +0100 +Subject: [PATCH] fix iconv/libintl library not found + +--- + meson.build | 19 +++++++++++++++++-- + meson_options.txt | 6 ++++++ + 2 files changed, 23 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index 73523db34..31f90ece1 100644 +--- a/meson.build ++++ b/meson.build +@@ -2043,12 +2043,27 @@ glibconfig_conf.set10('G_HAVE_GROWING_STACK', growing_stack) + # We should never use the MinGW C library's iconv because it may not be + # available in the actual runtime environment. On Windows, we always use + # the built-in implementation ++iconv_opt = get_option('iconv') + if host_system == 'windows' ++ libiconv = [] + # We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need + # any external library for it +- libiconv = [] ++ if iconv_opt != 'auto' ++ warning('-Diconv was set to @0@, which was ignored') ++ endif + else +- libiconv = dependency('iconv') ++ found_iconv = false ++ if ['auto', 'libc'].contains(iconv_opt) and cc.has_function('iconv_open') ++ libiconv = [] ++ found_iconv = true ++ endif ++ if not found_iconv and ['auto', 'external'].contains(iconv_opt) and cc.has_header_symbol('iconv.h', 'iconv_open') ++ libiconv = [cc.find_library('iconv')] ++ found_iconv = true ++ endif ++ if not found_iconv ++ error('iconv implementation "@0@" not found'.format(iconv_opt)) ++ endif + endif + + pcre2_req = '>=10.32' +diff --git a/meson_options.txt b/meson_options.txt +index 09ddc9318..324351cf7 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -4,6 +4,12 @@ option('runtime_libdir', + description : 'install runtime libraries relative to libdir', + deprecated: true) + ++option('iconv', ++ type : 'combo', ++ choices : ['auto', 'libc', 'external'], ++ value : 'auto', ++ description : 'iconv implementation to use ('libc' = 'Part of the C library'; 'external' = 'External libiconv'; 'auto' = 'Auto-detect which iconv is available')') ++ + option('charsetalias_dir', + type : 'string', + value : '', diff --git a/recipes-core/glib-2.0/glib-2.0/0003-Add-option-to-disable-testing-host-binaries-when-cro.patch b/recipes-core/glib-2.0/glib-2.0/0003-Add-option-to-disable-testing-host-binaries-when-cro.patch new file mode 100644 index 0000000..c7b8928 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0003-Add-option-to-disable-testing-host-binaries-when-cro.patch @@ -0,0 +1,59 @@ +From 115959af31829340ea9fbab37e44e879e481f6b6 Mon Sep 17 00:00:00 2001 +From: Michael Cobb michael.cobb@iceotope.com +Date: Wed, 12 Jun 2024 11:22:54 +0100 +Subject: [PATCH] Add option to disable testing host binaries when + cross-compiling + +Fixes the 'frexpl() is missing or broken beyond repair' build error due +to meson trying to run tests under qemu + +Signed-off-by: Michael Cobb michael.cobb@iceotope.com + +--- + meson.build | 5 +++-- + meson_options.txt | 5 +++++ + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/meson.build b/meson.build +index 31f90ece1..ebb7b0b5b 100644 +--- a/meson.build ++++ b/meson.build +@@ -32,7 +32,7 @@ if have_cxx + endforeach + endif + +-cc_can_run = meson.can_run_host_binaries() ++cc_can_run = get_option('can_run_host_binaries') and meson.can_run_host_binaries() + + if cc.get_argument_syntax() == 'msvc' + # Ignore several spurious warnings for things glib does very commonly +@@ -1445,7 +1445,7 @@ endif + # library type. Test for the warnings and set gint64 to whichever + # works. + if long_long_size == long_size +- if cc.compiles('''#if defined(_AIX) && !defined(__GNUC__) ++ r = cc.compiles('''#if defined(_AIX) && !defined(__GNUC__) + #pragma options langlvl=stdc99 + #endif + #pragma GCC diagnostic error "-Wincompatible-pointer-types" +@@ -1456,6 +1456,7 @@ if long_long_size == long_size + long *i2 = &i1; + return 1; + }''', name : 'int64_t is long') ++ if r + int64_t_typedef = 'long' + elif cc.compiles('''#if defined(_AIX) && !defined(__GNUC__) + #pragma options langlvl=stdc99 +diff --git a/meson_options.txt b/meson_options.txt +index 324351cf7..03975ed43 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -136,3 +136,8 @@ option('disable_cxx', + type: 'boolean', + value: false, + description: 'Disable the use of C++ compiler for tests if your platform does not have a working C++ compiler') ++ ++option('can_run_host_binaries', ++ type: 'boolean', ++ value: true, ++ description: 'Disable if cross-compiling and your platform does not have a way to run compiled host binaries') diff --git a/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch b/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch new file mode 100644 index 0000000..db25ed4 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/0010-Do-not-hardcode-python-path-into-various-tools.patch @@ -0,0 +1,44 @@ +From a1eddf4f6071e060f61eeeb1c0de06eae8a882ac Mon Sep 17 00:00:00 2001 +From: Alexander Kanavin alex.kanavin@gmail.com +Date: Tue, 3 Oct 2017 10:45:55 +0300 +Subject: [PATCH] Do not hardcode python path into various tools + +Upstream-Status: Inappropriate [oe-core specific] +Signed-off-by: Alexander Kanavin alex.kanavin@gmail.com + +--- + gio/gdbus-2.0/codegen/gdbus-codegen.in | 2 +- + gobject/glib-genmarshal.in | 2 +- + gobject/glib-mkenums.in | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/gio/gdbus-2.0/codegen/gdbus-codegen.in b/gio/gdbus-2.0/codegen/gdbus-codegen.in +index 67d367543..4e92a7afa 100755 +--- a/gio/gdbus-2.0/codegen/gdbus-codegen.in ++++ b/gio/gdbus-2.0/codegen/gdbus-codegen.in +@@ -1,4 +1,4 @@ +-#!/usr/bin/env @PYTHON@ ++#!/usr/bin/env python3 + + # GDBus - GLib D-Bus Library + # +diff --git a/gobject/glib-genmarshal.in b/gobject/glib-genmarshal.in +index aa5af43bd..56e8e2ec4 100755 +--- a/gobject/glib-genmarshal.in ++++ b/gobject/glib-genmarshal.in +@@ -1,4 +1,4 @@ +-#!/usr/bin/env @PYTHON@ ++#!/usr/bin/env python3 + + # pylint: disable=too-many-lines, missing-docstring, invalid-name + +diff --git a/gobject/glib-mkenums.in b/gobject/glib-mkenums.in +index e0c0b39af..6ed03893d 100755 +--- a/gobject/glib-mkenums.in ++++ b/gobject/glib-mkenums.in +@@ -1,4 +1,4 @@ +-#!/usr/bin/env @PYTHON@ ++#!/usr/bin/env python3 + + # If the code below looks horrible and unpythonic, do not panic. + # diff --git a/recipes-core/glib-2.0/glib-2.0/memory-monitor.patch b/recipes-core/glib-2.0/glib-2.0/memory-monitor.patch new file mode 100644 index 0000000..fc069eb --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/memory-monitor.patch @@ -0,0 +1,362 @@ +From e074461e828d47edc00fd912f8b94eb95685bc82 Mon Sep 17 00:00:00 2001 +From: Philip Withnall philip@tecnocode.co.uk +Date: Tue, 23 Jan 2024 11:16:52 +0000 +Subject: [PATCH] Merge branch '2887-memory-monitor-tests' into 'main' + +tests: Fix race condition in memory-monitor-dbus.test + +Closes #2887 + +See merge request GNOME/glib!3844 + +Hopefully these commits fix the occasional failures we've been seeing: +https://bugzilla.yoctoproject.org/show_bug.cgi?id=15362 + +Upstream-Status: Backport +Signed-off-by: Ross Burton ross.burton@arm.com + +--- + gio/tests/memory-monitor-dbus.py.in | 64 +++++++++++++------- + gio/tests/memory-monitor-portal.py.in | 54 ++++++++++------- + gio/tests/power-profile-monitor-dbus.py.in | 35 ++++++----- + gio/tests/power-profile-monitor-portal.py.in | 34 ++++++----- + 4 files changed, 113 insertions(+), 74 deletions(-) + +diff --git a/gio/tests/memory-monitor-dbus.py.in b/gio/tests/memory-monitor-dbus.py.in +index bf3291847..7aae01e70 100755 +--- a/gio/tests/memory-monitor-dbus.py.in ++++ b/gio/tests/memory-monitor-dbus.py.in +@@ -16,7 +16,6 @@ import sys + import subprocess + import fcntl + import os +-import time + + import taptestrunner + +@@ -57,53 +56,74 @@ try: + fcntl.fcntl(self.p_mock.stdout, fcntl.F_SETFL, flags | os.O_NONBLOCK) + self.last_warning = -1 + self.dbusmock = dbus.Interface(self.obj_lmm, dbusmock.MOCK_IFACE) ++ ++ try: ++ self.wait_for_bus_object('org.freedesktop.LowMemoryMonitor', ++ '/org/freedesktop/LowMemoryMonitor', ++ system_bus=True) ++ except: ++ raise ++ + self.memory_monitor = Gio.MemoryMonitor.dup_default() ++ assert("GMemoryMonitorDBus" in str(self.memory_monitor)) + self.memory_monitor.connect("low-memory-warning", self.memory_warning_cb) + self.mainloop = GLib.MainLoop() + self.main_context = self.mainloop.get_context() + ++ # The LowMemoryMonitor API is stateless: it doesn’t expose any ++ # properties, just a warning signal. Emit the signal in a loop until ++ # the GMemoryMonitor instance has initialised and synchronised to ++ # the right state. ++ def emit_warning(level): ++ self.dbusmock.EmitWarning(level) ++ return GLib.SOURCE_CONTINUE ++ ++ idle_id = GLib.idle_add(emit_warning, 0) ++ while self.last_warning != 0: ++ self.main_context.iteration(True) ++ GLib.source_remove(idle_id) ++ + def tearDown(self): + self.p_mock.terminate() + self.p_mock.wait() + +- def assertEventually(self, condition, message=None, timeout=50): ++ def assertEventually(self, condition, message=None, timeout=5): + '''Assert that condition function eventually returns True. + +- Timeout is in deciseconds, defaulting to 50 (5 seconds). message is ++ Timeout is in seconds, defaulting to 5 seconds. message is + printed on failure. + ''' +- while timeout >= 0: +- context = GLib.MainContext.default() +- while context.iteration(False): +- pass +- if condition(): +- break +- timeout -= 1 +- time.sleep(0.1) +- else: +- self.fail(message or 'timed out waiting for ' + str(condition)) ++ if not message: ++ message = 'timed out waiting for ' + str(condition) ++ ++ def timed_out_cb(message): ++ self.fail(message) ++ return GLib.SOURCE_REMOVE ++ ++ timeout_source = GLib.timeout_source_new_seconds(timeout) ++ timeout_source.set_callback(timed_out_cb, message) ++ timeout_source.attach(self.main_context) ++ ++ while not condition(): ++ self.main_context.iteration(True) ++ ++ timeout_source.destroy() + + def memory_warning_cb(self, monitor, level): ++ print("Received memory warning signal, level", level) + self.last_warning = level + self.main_context.wakeup() + + def test_low_memory_warning_signal(self): + '''LowMemoryWarning signal''' + +- # Wait 2 seconds +- timeout = 2 +- while timeout > 0: +- time.sleep(0.5) +- timeout -= 0.5 +- self.main_context.iteration(False) +- + self.dbusmock.EmitWarning(100) + # Wait 2 seconds or until warning +- self.assertEventually(lambda: self.last_warning == 100, "'100' low-memory warning not received", 20) ++ self.assertEventually(lambda: self.last_warning == 100, "'100' low-memory warning not received", 2) + + self.dbusmock.EmitWarning(255) + # Wait 2 seconds or until warning +- self.assertEventually(lambda: self.last_warning == 255, "'255' low-memory warning not received", 20) ++ self.assertEventually(lambda: self.last_warning == 255, "'255' low-memory warning not received", 2) + + except ImportError as e: + @unittest.skip("Cannot import %s" % e.name) +diff --git a/gio/tests/memory-monitor-portal.py.in b/gio/tests/memory-monitor-portal.py.in +index 748cee850..f570508f9 100755 +--- a/gio/tests/memory-monitor-portal.py.in ++++ b/gio/tests/memory-monitor-portal.py.in +@@ -16,7 +16,6 @@ import sys + import subprocess + import fcntl + import os +-import time + + import taptestrunner + +@@ -80,26 +79,44 @@ try: + self.mainloop = GLib.MainLoop() + self.main_context = self.mainloop.get_context() + ++ # The LowMemoryMonitor API is stateless: it doesn’t expose any ++ # properties, just a warning signal. Emit the signal in a loop until ++ # the GMemoryMonitor instance has initialised and synchronised to ++ # the right state. ++ def emit_warning(level): ++ self.dbusmock.EmitWarning(level) ++ return GLib.SOURCE_CONTINUE ++ ++ idle_id = GLib.idle_add(self.emit_warning, 0) ++ while self.last_warning != 0: ++ self.main_context.iteration(True) ++ GLib.source_remove(idle_id) ++ + def tearDown(self): + self.p_mock.terminate() + self.p_mock.wait() + +- def assertEventually(self, condition, message=None, timeout=50): ++ def assertEventually(self, condition, message=None, timeout=5): + '''Assert that condition function eventually returns True. + +- Timeout is in deciseconds, defaulting to 50 (5 seconds). message is ++ Timeout is in seconds, defaulting to 5 seconds. message is + printed on failure. + ''' +- while timeout >= 0: +- context = GLib.MainContext.default() +- while context.iteration(False): +- pass +- if condition(): +- break +- timeout -= 1 +- time.sleep(0.1) +- else: +- self.fail(message or 'timed out waiting for ' + str(condition)) ++ if not message: ++ message = 'timed out waiting for ' + str(condition) ++ ++ def timed_out_cb(message): ++ self.fail(message) ++ return GLib.SOURCE_REMOVE ++ ++ timeout_source = GLib.timeout_source_new_seconds(timeout) ++ timeout_source.set_callback(timed_out_cb, message) ++ timeout_source.attach(self.main_context) ++ ++ while not condition(): ++ self.main_context.iteration(True) ++ ++ timeout_source.destroy() + + def portal_memory_warning_cb(self, monitor, level): + self.last_warning = level +@@ -108,20 +125,13 @@ try: + def test_low_memory_warning_portal_signal(self): + '''LowMemoryWarning signal''' + +- # Wait 2 seconds +- timeout = 2 +- while timeout > 0: +- time.sleep(0.5) +- timeout -= 0.5 +- self.main_context.iteration(False) +- + self.dbusmock.EmitWarning(100) + # Wait 2 seconds or until warning +- self.assertEventually(lambda: self.last_warning == 100, "'100' low-memory warning not received", 20) ++ self.assertEventually(lambda: self.last_warning == 100, "'100' low-memory warning not received", 2) + + self.dbusmock.EmitWarning(255) + # Wait 2 seconds or until warning +- self.assertEventually(lambda: self.last_warning == 255, "'255' low-memory warning not received", 20) ++ self.assertEventually(lambda: self.last_warning == 255, "'255' low-memory warning not received", 2) + + except ImportError as e: + @unittest.skip("Cannot import %s" % e.name) +diff --git a/gio/tests/power-profile-monitor-dbus.py.in b/gio/tests/power-profile-monitor-dbus.py.in +index 06e594f4a..f955afc80 100755 +--- a/gio/tests/power-profile-monitor-dbus.py.in ++++ b/gio/tests/power-profile-monitor-dbus.py.in +@@ -16,7 +16,6 @@ import sys + import subprocess + import fcntl + import os +-import time + + import taptestrunner + +@@ -58,6 +57,7 @@ try: + self.power_saver_enabled = False + self.dbus_props = dbus.Interface(self.obj_ppd, dbus.PROPERTIES_IFACE) + self.power_profile_monitor = Gio.PowerProfileMonitor.dup_default() ++ assert("GPowerProfileMonitorDBus" in str(self.power_profile_monitor)) + self.power_profile_monitor.connect("notify::power-saver-enabled", self.power_saver_enabled_cb) + self.mainloop = GLib.MainLoop() + self.main_context = self.mainloop.get_context() +@@ -66,22 +66,27 @@ try: + self.p_mock.terminate() + self.p_mock.wait() + +- def assertEventually(self, condition, message=None, timeout=50): ++ def assertEventually(self, condition, message=None, timeout=5): + '''Assert that condition function eventually returns True. + +- Timeout is in deciseconds, defaulting to 50 (5 seconds). message is ++ Timeout is in seconds, defaulting to 5 seconds. message is + printed on failure. + ''' +- while timeout >= 0: +- context = GLib.MainContext.default() +- while context.iteration(False): +- pass +- if condition(): +- break +- timeout -= 1 +- time.sleep(0.1) +- else: +- self.fail(message or 'timed out waiting for ' + str(condition)) ++ if not message: ++ message = 'timed out waiting for ' + str(condition) ++ ++ def timed_out_cb(message): ++ self.fail(message) ++ return GLib.SOURCE_REMOVE ++ ++ timeout_source = GLib.timeout_source_new_seconds(timeout) ++ timeout_source.set_callback(timed_out_cb, message) ++ timeout_source.attach(self.main_context) ++ ++ while not condition(): ++ self.main_context.iteration(True) ++ ++ timeout_source.destroy() + + def power_saver_enabled_cb(self, spec, data): + self.power_saver_enabled = self.power_profile_monitor.get_power_saver_enabled() +@@ -92,10 +97,10 @@ try: + + self.assertEqual(self.power_profile_monitor.get_power_saver_enabled(), False) + self.dbus_props.Set('net.hadess.PowerProfiles', 'ActiveProfile', dbus.String('power-saver', variant_level=1)) +- self.assertEventually(lambda: self.power_saver_enabled == True, "power-saver didn't become enabled", 10) ++ self.assertEventually(lambda: self.power_saver_enabled == True, "power-saver didn't become enabled", 1) + + self.dbus_props.Set('net.hadess.PowerProfiles', 'ActiveProfile', dbus.String('balanced', variant_level=1)) +- self.assertEventually(lambda: self.power_saver_enabled == False, "power-saver didn't become disabled", 10) ++ self.assertEventually(lambda: self.power_saver_enabled == False, "power-saver didn't become disabled", 1) + + except ImportError as e: + @unittest.skip("Cannot import %s" % e.name) +diff --git a/gio/tests/power-profile-monitor-portal.py.in b/gio/tests/power-profile-monitor-portal.py.in +index 09e9a450d..ad2abf621 100755 +--- a/gio/tests/power-profile-monitor-portal.py.in ++++ b/gio/tests/power-profile-monitor-portal.py.in +@@ -16,7 +16,6 @@ import sys + import subprocess + import fcntl + import os +-import time + + import taptestrunner + +@@ -90,22 +89,27 @@ try: + self.p_mock.terminate() + self.p_mock.wait() + +- def assertEventually(self, condition, message=None, timeout=50): ++ def assertEventually(self, condition, message=None, timeout=5): + '''Assert that condition function eventually returns True. + +- Timeout is in deciseconds, defaulting to 50 (5 seconds). message is ++ Timeout is in seconds, defaulting to 5 seconds. message is + printed on failure. + ''' +- while timeout >= 0: +- context = GLib.MainContext.default() +- while context.iteration(False): +- pass +- if condition(): +- break +- timeout -= 1 +- time.sleep(0.1) +- else: +- self.fail(message or 'timed out waiting for ' + str(condition)) ++ if not message: ++ message = 'timed out waiting for ' + str(condition) ++ ++ def timed_out_cb(message): ++ self.fail(message) ++ return GLib.SOURCE_REMOVE ++ ++ timeout_source = GLib.timeout_source_new_seconds(timeout) ++ timeout_source.set_callback(timed_out_cb, message) ++ timeout_source.attach(self.main_context) ++ ++ while not condition(): ++ self.main_context.iteration(True) ++ ++ timeout_source.destroy() + + def power_saver_enabled_cb(self, spec, data): + self.power_saver_enabled = self.power_profile_monitor.get_power_saver_enabled() +@@ -116,10 +120,10 @@ try: + + self.assertEqual(self.power_profile_monitor.get_power_saver_enabled(), False) + self.dbus_props.Set('net.hadess.PowerProfiles', 'ActiveProfile', dbus.String('power-saver', variant_level=1)) +- self.assertEventually(lambda: self.power_saver_enabled == True, "power-saver didn't become enabled", 10) ++ self.assertEventually(lambda: self.power_saver_enabled == True, "power-saver didn't become enabled", 1) + + self.dbus_props.Set('net.hadess.PowerProfiles', 'ActiveProfile', dbus.String('balanced', variant_level=1)) +- self.assertEventually(lambda: self.power_saver_enabled == False, "power-saver didn't become disabled", 10) ++ self.assertEventually(lambda: self.power_saver_enabled == False, "power-saver didn't become disabled", 1) + + def test_power_profile_power_saver_enabled_portal_default(self): + '''power-saver-enabled property default value''' diff --git a/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common new file mode 100644 index 0000000..0d7c5fa --- /dev/null +++ b/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/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc new file mode 100644 index 0000000..c4648f5 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-glibc @@ -0,0 +1,5 @@ +[properties] +have_c99_vsnprintf = true +have_c99_snprintf = true +have_unix98_printf = true +va_val_copy = true diff --git a/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-linux new file mode 100644 index 0000000..adad7e6 --- /dev/null +++ b/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/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-mingw new file mode 100644 index 0000000..75f911b --- /dev/null +++ b/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/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-morello b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-morello new file mode 100644 index 0000000..ce97555 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-morello @@ -0,0 +1,3 @@ +[properties] +can_run_host_binaries = false +skip_sanity_check = true diff --git a/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl new file mode 100644 index 0000000..3049e51 --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/meson.cross.d/common-musl @@ -0,0 +1,6 @@ +[properties] +have_c99_vsnprintf = true +have_c99_snprintf = true +have_unix98_printf = true +va_val_copy = true +have_strlcpy = true diff --git a/recipes-core/glib-2.0/glib-2.0/skip-timeout.patch b/recipes-core/glib-2.0/glib-2.0/skip-timeout.patch new file mode 100644 index 0000000..97d07ff --- /dev/null +++ b/recipes-core/glib-2.0/glib-2.0/skip-timeout.patch @@ -0,0 +1,30 @@ +From 925243c78f5e3a399be35ed036b47dc8e257c9a1 Mon Sep 17 00:00:00 2001 +From: Ross Burton ross.burton@arm.com +Date: Thu, 28 Mar 2024 16:27:09 +0000 +Subject: [PATCH] Skip /timeout/rounding test + +This test is sensitive to load because it expects certain timeout operations +to succeed in specific time periods. Whilst these timeouts are fairly large, +they're still exceeded inside a qemu on a loaded system. + +https://bugzilla.yoctoproject.org/show_bug.cgi?id=14464 + +Upstream-Status: Inappropriate [OE-specific] +Signed-off-by: Ross Burton ross.burton@arm.com + +--- + glib/tests/timeout.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/glib/tests/timeout.c b/glib/tests/timeout.c +index acbb8f3e1..cdca6bb1d 100644 +--- a/glib/tests/timeout.c ++++ b/glib/tests/timeout.c +@@ -194,7 +194,6 @@ main (int argc, char *argv[]) + g_test_add_func ("/timeout/seconds", test_seconds); + g_test_add_func ("/timeout/weeks-overflow", test_weeks_overflow); + g_test_add_func ("/timeout/far-future-ready-time", test_far_future_ready_time); +- g_test_add_func ("/timeout/rounding", test_rounding); + + return g_test_run (); + } diff --git a/recipes-core/glib-2.0/glib-morello.inc b/recipes-core/glib-2.0/glib-morello.inc new file mode 100644 index 0000000..2924798 --- /dev/null +++ b/recipes-core/glib-2.0/glib-morello.inc @@ -0,0 +1,170 @@ +inherit meson gettext gtk-doc pkgconfig upstream-version-is-even bash-completion manpages gobject-introspection-data purecap-sysroot + +MORELLO_SRC = "poky/meta/recipes-core/glib-2.0/*" + +SUMMARY = "A general-purpose utility library" +DESCRIPTION = "GLib is a general-purpose utility library, which provides many useful data types, macros, type conversions, string utilities, file utilities, a main loop abstraction, and so on." +HOMEPAGE = "https://developer.gnome.org/glib/" + +# pcre is under BSD; +# docs/reference/COPYING is with a 'public domain'-like license! +LICENSE = "LGPL-2.1-or-later & BSD-3-Clause & PD" +LIC_FILES_CHKSUM = "file://COPYING;md5=41890f71f740302b785c27661123bff5 \ + file://glib/glib.h;beginline=4;endline=17;md5=72f7cc2847407f65d8981ef112e4e630 \ + file://LICENSES/LGPL-2.1-or-later.txt;md5=41890f71f740302b785c27661123bff5 \ + file://gmodule/gmodule.h;beginline=4;endline=17;md5=72f7cc2847407f65d8981ef112e4e630 \ + file://docs/reference/COPYING;md5=f51a5100c17af6bae00735cd791e1fcc" +BUGTRACKER = "http://bugzilla.gnome.org" +SECTION = "libs" + +CVE_PRODUCT = "glib" + +DEPENDS = "glib-2.0-native \ + virtual/libintl \ + virtual/libiconv \ + libffi-morello \ + libpcre2-morello \ + zlib-morello \ + python3-packaging-native \ + util-linux-morello \ + " + +CODEGEN_PYTHON_RDEPENDS = "python3 python3-packaging python3-xml" +CODEGEN_PYTHON_RDEPENDS:mingw32 = "" + +RDEPENDS:${PN}-codegen += "${CODEGEN_PYTHON_RDEPENDS}" + +RDEPENDS:${PN}:append = "\ + util-linux-morello \ + zlib-morello \ + " + +PACKAGES += "${PN}-codegen ${PN}-utils" + +LEAD_SONAME = "libglib-2.0.*" + +DEPENDS:append:class-target = "${@' gtk-doc' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}" + +GTKDOC_MESON_OPTION = "gtk_doc" + +S = "${WORKDIR}/git" + +# Allow the configure task to pull in git submodules over the network +do_configure[network] = "1" + +PACKAGECONFIG ??= "libmount \ + ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" + +PACKAGECONFIG[libmount] = "-Dlibmount=enabled,-Dlibmount=disabled,util-linux-morello" +PACKAGECONFIG[manpages] = "-Dman=true, -Dman=false, libxslt-native xmlto-native" +PACKAGECONFIG[libelf] = "-Dlibelf=enabled,-Dlibelf=disabled,elfutils" +PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false," +PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux" + +EXTRA_OEMESON += " -Ddtrace=false -Dsystemtap=false -Dtests=true -Dinstalled_tests=true" +EXTRA_OEMESON += " -Ddisable_cxx=true -Dcan_run_host_binaries=false --cross-file=${THISDIR}/glib-2.0/meson.cross.d/common-morello " + +do_configure:prepend() { + sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in +} + +FILES:${PN} = "${libdir}/lib*${SOLIBS} \ + ${libdir}/gio \ + ${libexecdir}/*gio-querymodules \ + ${libexecdir}/*gio-launch-desktop \ + ${datadir}/glib-2.0/schemas \ + " + +FILES:${PN}-utils += "${bindir}/glib-genmarshal \ + ${bindir}/glib-gettextize \ + ${bindir}/glib-mkenums \ + ${bindir}/glib-compile-resources \ + " + +FILES:${PN}-dev += "${libdir}/glib-2.0/include \ + ${libdir}/gio/modules/lib*${SOLIBSDEV} \ + ${libdir}/gio/modules/*.la \ + ${datadir}/glib-2.0/gettext/po/Makefile.in.in \ + ${datadir}/glib-2.0/schemas/gschema.dtd \ + ${datadir}/glib-2.0/valgrind/glib.supp \ + ${datadir}/gettext/its \ + ${datadir}/glib-2.0/dtds/* \ + " + +FILES:${PN}-dbg += "${datadir}/glib-2.0/gdb \ + ${datadir}/gdb \ + " + +FILES:${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py \ + ${bindir}/gdbus-codegen \ + " + +FILES:${PN}-utils = "${bindir}/*" + +SHAREDMIMEDEP = "shared-mime-info" +# When cross compiling for Windows we don't want to include this +SHAREDMIMEDEP:mingw32 = "" + +RRECOMMENDS:${PN} += "${SHAREDMIMEDEP}" + +ARM_INSTRUCTION_SET:armv4 = "arm" +ARM_INSTRUCTION_SET:armv5 = "arm" +# Valgrind runtime detection works using hand-written assembly, which +# doesn't support mips16e +CPPFLAGS:append:class-target:mips16e = " -DNVALGRIND=1" + +# GLib generally requires gettext to be present so for USE_NLS to yes. For +# native builds as i18n is disabled globally we have to add a gettext-native dependency. +USE_NLS:class-target = "yes" + +EXEEXT = "" +EXEEXT:mingw32 = ".exe" + +do_install() { + meson install --destdir "${D}" --no-rebuild +} + +do_install:append () { + if [ -f ${D}${bindir}/gtester-report ]; then + sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python3|' + fi + + # Remove some unpackaged files + rm -rf ${D}${datadir}/glib-2.0/codegen/__pycache__ + rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc + rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo + + if [ -e ${D}${libdir}/charset.alias ]; then + rm -f ${D}${libdir}/charset.alias + fi + + # Make sure gio-querymodules is unique among multilibs + if test "x${MLPREFIX}" != "x"; then + mv ${D}${libexecdir}/gio-querymodules${EXEEXT} ${D}${libexecdir}/${MLPREFIX}gio-querymodules${EXEEXT} + fi + # Autotools does this, meson does not + mkdir -p ${D}${libdir}/gio/modules +} + +do_install:append:class-target () { + # Tests are only installed on targets, not native builds. Separating this out + # keeps glib-2.0-native from depending on DISTRO_FEATURES + if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; then + if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", "true", d)}; then + rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test + fi + fi + if [ -f ${D}${datadir}/installed-tests/glib/static-link.test ]; then + if test "x${MLPREFIX}" != "x"; then + mv ${D}${datadir}/installed-tests/glib/static-link.test ${D}${datadir}/installed-tests/glib/${MLPREFIX}static-link.test + fi + fi + # https://gitlab.gnome.org/GNOME/glib/-/issues/2810 + rm -f ${D}${datadir}/installed-tests/glib/thread-pool-slow.test +} + +# As we do not build python3 for windows, makes no sense to ship the script that's using it +do_install:append:mingw32() { + rm -f ${D}${bindir}/gtester-report +} +