1SUMMARY = "A general-purpose utility library" 2DESCRIPTION = "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." 3HOMEPAGE = "https://developer.gnome.org/glib/" 4 5# pcre is under BSD; 6# docs/reference/COPYING is with a 'public domain'-like license! 7LICENSE = "LGPL-2.1-or-later & BSD-3-Clause & PD" 8LIC_FILES_CHKSUM = "file://COPYING;md5=41890f71f740302b785c27661123bff5 \ 9 file://glib/glib.h;beginline=4;endline=17;md5=72f7cc2847407f65d8981ef112e4e630 \ 10 file://LICENSES/LGPL-2.1-or-later.txt;md5=41890f71f740302b785c27661123bff5 \ 11 file://gmodule/gmodule.h;beginline=4;endline=17;md5=72f7cc2847407f65d8981ef112e4e630 \ 12 file://docs/reference/COPYING;md5=f51a5100c17af6bae00735cd791e1fcc" 13BUGTRACKER = "http://bugzilla.gnome.org" 14SECTION = "libs" 15 16CVE_PRODUCT = "glib" 17 18BBCLASSEXTEND = "native nativesdk" 19 20DEPENDS = "glib-2.0-native \ 21 virtual/libintl \ 22 virtual/libiconv \ 23 libffi \ 24 libpcre2 \ 25 zlib" 26 27PACKAGES += "${PN}-codegen ${PN}-utils" 28 29LEAD_SONAME = "libglib-2.0.*" 30 31inherit meson gettext gi-docgen pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache manpages gobject-introspection-data 32 33S = "${WORKDIR}/glib-${PV}" 34 35GIDOCGEN_MESON_OPTION = "documentation" 36 37PACKAGECONFIG ??= "libmount \ 38 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'introspection', '', d)} \ 39 ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}" 40PACKAGECONFIG:class-native = "" 41 42PACKAGECONFIG[libmount] = "-Dlibmount=enabled,-Dlibmount=disabled,util-linux" 43PACKAGECONFIG[manpages] = "-Dman-pages=enabled, -Dman-pages=disabled, python3-docutils-native" 44PACKAGECONFIG[libelf] = "-Dlibelf=enabled,-Dlibelf=disabled,elfutils" 45PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false," 46PACKAGECONFIG[selinux] = "-Dselinux=enabled,-Dselinux=disabled,libselinux" 47PACKAGECONFIG[introspection] = "-Dintrospection=enabled,-Dintrospection=disabled,gobject-introspection-native gobject-introspection glib-2.0-initial" 48 49EXTRA_OEMESON = "-Ddtrace=disabled -Dsystemtap=disabled -Dsysprof=disabled" 50 51EXTRA_OEMESON:append:class-target = " ${@'-Dgir_dir_prefix=${libdir}' if d.getVar('MULTILIBS') else ''}" 52 53do_configure:prepend() { 54 sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in 55} 56 57FILES:${PN} = "${libdir}/lib*${SOLIBS} \ 58 ${libdir}/gio \ 59 ${libexecdir}/*gio-querymodules \ 60 ${libexecdir}/*gio-launch-desktop \ 61 ${datadir}/glib-2.0/dtds \ 62 ${datadir}/glib-2.0/schemas \ 63 ${libdir}/girepository-*/*.typelib \ 64" 65FILES:${PN}-dev += "${libdir}/glib-2.0/include \ 66 ${libdir}/gio/modules/lib*${SOLIBSDEV} \ 67 ${libdir}/gio/modules/*.la \ 68 ${datadir}/glib-2.0/gettext/po/Makefile.in.in \ 69 ${datadir}/glib-2.0/schemas/gschema.dtd \ 70 ${datadir}/glib-2.0/valgrind/glib.supp \ 71 ${datadir}/gir-*/*.gir ${libdir}/gir-*/*.gir \ 72 ${datadir}/gettext/its" 73FILES:${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb" 74FILES:${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py \ 75 ${bindir}/gdbus-codegen" 76FILES:${PN}-utils = "${bindir}/*" 77 78SHAREDMIMEDEP = "shared-mime-info" 79SHAREDMIMEDEP:class-native = "" 80# When cross compiling for Windows we don't want to include this 81SHAREDMIMEDEP:mingw32 = "" 82 83RRECOMMENDS:${PN} += "${SHAREDMIMEDEP}" 84 85ARM_INSTRUCTION_SET:armv4 = "arm" 86ARM_INSTRUCTION_SET:armv5 = "arm" 87# Valgrind runtime detection works using hand-written assembly, which 88# doesn't support mips16e 89CPPFLAGS:append:class-target:mips16e = " -DNVALGRIND=1" 90 91# GLib generally requires gettext to be present so for USE_NLS to yes. For 92# native builds as i18n is disabled globally we have to add a gettext-native dependency. 93USE_NLS:class-target = "yes" 94USE_NLS:class-nativesdk = "yes" 95DEPENDS:append:class-native = " gettext-native" 96 97EXEEXT = "" 98EXEEXT:mingw32 = ".exe" 99 100do_install:append () { 101 if [ -f ${D}${bindir}/gtester-report ]; then 102 sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python3|' 103 fi 104 105 # Remove some unpackaged files 106 rm -rf ${D}${datadir}/glib-2.0/codegen/__pycache__ 107 rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc 108 rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo 109 110 if [ -e ${D}${libdir}/charset.alias ]; then 111 rm -f ${D}${libdir}/charset.alias 112 fi 113 114 # Make sure gio-querymodules is unique among multilibs 115 if test "x${MLPREFIX}" != "x"; then 116 mv ${D}${libexecdir}/gio-querymodules${EXEEXT} ${D}${libexecdir}/${MLPREFIX}gio-querymodules${EXEEXT} 117 fi 118 # Autotools does this, meson does not 119 mkdir -p ${D}${libdir}/gio/modules 120} 121 122do_install:append:class-native () { 123 # Link gio-querymodules into ${bindir} as otherwise tools like meson won't find it 124 ln -rs ${D}${libexecdir}/gio-querymodules ${D}${bindir} 125} 126 127do_install:append:class-target () { 128 # Tests are only installed on targets, not native builds. Separating this out 129 # keeps glib-2.0-native from depending on DISTRO_FEATURES 130 if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; then 131 if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", "true", d)}; then 132 rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test 133 fi 134 fi 135 if [ -f ${D}${datadir}/installed-tests/glib/static-link.test ]; then 136 if test "x${MLPREFIX}" != "x"; then 137 mv ${D}${datadir}/installed-tests/glib/static-link.test ${D}${datadir}/installed-tests/glib/${MLPREFIX}static-link.test 138 fi 139 fi 140 # https://gitlab.gnome.org/GNOME/glib/-/issues/2810 141 rm -f ${D}${datadir}/installed-tests/glib/thread-pool-slow.test 142} 143do_install:append:class-target:libc-musl () { 144 # Remove failing tests on musl libc systems, this helps set baseline for musl testing 145 # they remain to be rootcaused and fixed but marked known failures here. 146 for t in convert.test collate.test gdatetime.test date.test converter-stream.test option-context.test; do 147 rm -rf ${D}${datadir}/installed-tests/glib/$t 148 done 149} 150# As we do not build python3 for windows, makes no sense to ship the script that's using it 151do_install:append:mingw32() { 152 rm -f ${D}${bindir}/gtester-report 153} 154 155CODEGEN_PYTHON_RDEPENDS = "python3 python3-packaging python3-xml" 156CODEGEN_PYTHON_RDEPENDS:mingw32 = "" 157 158RDEPENDS:${PN}-codegen += "${CODEGEN_PYTHON_RDEPENDS}" 159 160RDEPENDS:${PN}-ptest += "${PN}-utils" 161 162RDEPENDS:${PN}-ptest += "\ 163 coreutils \ 164 libgcc \ 165 dbus \ 166 desktop-file-utils \ 167 gnome-desktop-testing \ 168 tzdata \ 169 tzdata-americas \ 170 tzdata-asia \ 171 tzdata-europe \ 172 tzdata-posix \ 173 shared-mime-info \ 174 ${PN}-locale-ja \ 175 ${PN}-locale-fr \ 176 ${PN}-locale-el \ 177 ${PN}-locale-hr \ 178 ${PN}-locale-lt \ 179 ${PN}-locale-pl \ 180 ${PN}-locale-ru \ 181 ${PN}-locale-th \ 182 python3-core \ 183 python3-modules \ 184 ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-dbusmock', '', d)} \ 185 ${PN}-codegen \ 186 locale-base-de-de \ 187 locale-base-es-es \ 188 locale-base-en-gb \ 189 locale-base-en-us \ 190 locale-base-fr-fr \ 191 locale-base-ru-ru \ 192 " 193 194RDEPENDS:${PN}-ptest:append:libc-glibc = "\ 195 glibc-gconv-utf-16 \ 196 glibc-charmap-utf-8 \ 197 glibc-gconv-cp1255 \ 198 glibc-charmap-cp1255 \ 199 glibc-gconv-utf-32 \ 200 glibc-gconv-utf-7 \ 201 glibc-gconv-euc-jp \ 202 glibc-gconv-iso8859-1 \ 203 glibc-gconv-iso8859-15 \ 204 glibc-charmap-invariant \ 205 glibc-localedata-translit-cjk-variants \ 206 locale-base-lt-lt \ 207 locale-base-ja-jp.euc-jp \ 208 locale-base-fa-ir \ 209 locale-base-hr-hr \ 210 locale-base-el-gr \ 211 locale-base-pl-pl \ 212 locale-base-pl-pl.iso-8859-2 \ 213 locale-base-tr-tr \ 214 " 215 216PE = "1" 217 218SHRT_VER = "${@oe.utils.trim_version("${PV}", 2)}" 219 220SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \ 221 file://run-ptest \ 222 file://0001-Fix-DATADIRNAME-on-uclibc-Linux.patch \ 223 file://0001-Remove-the-warning-about-deprecated-paths-in-schemas.patch \ 224 file://0001-Install-gio-querymodules-as-libexec_PROGRAM.patch \ 225 file://0001-Do-not-write-bindir-into-pkg-config-files.patch \ 226 file://0001-meson-Run-atomics-test-on-clang-as-well.patch \ 227 file://0001-gio-tests-resources.c-comment-out-a-build-host-only-.patch \ 228 file://0010-Do-not-hardcode-python-path-into-various-tools.patch \ 229 file://skip-timeout.patch \ 230 " 231SRC_URI:append:class-native = " file://relocate-modules.patch \ 232 file://0001-meson.build-do-not-enable-pidfd-features-on-native-g.patch \ 233 " 234 235SRC_URI[sha256sum] = "37dd0877fe964cd15e9a2710b044a1830fb1bd93652a6d0cb6b8b2dff187c709" 236 237# Find any meson cross files in FILESPATH that are relevant for the current 238# build (using siteinfo) and add them to EXTRA_OEMESON. 239inherit siteinfo 240def find_meson_cross_files(d): 241 if bb.data.inherits_class('native', d): 242 return "" 243 244 thisdir = os.path.normpath(d.getVar("THISDIR")) 245 import collections 246 sitedata = siteinfo_data(d) 247 # filename -> found 248 files = collections.OrderedDict() 249 for path in d.getVar("FILESPATH").split(":"): 250 for element in sitedata: 251 filename = os.path.normpath(os.path.join(path, "meson.cross.d", element)) 252 sanitized_path = filename.replace(thisdir, "${THISDIR}") 253 if sanitized_path == filename: 254 if os.path.exists(filename): 255 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)) 256 continue 257 files[filename.replace(thisdir, "${THISDIR}")] = os.path.exists(filename) 258 259 items = ["--cross-file=" + k for k,v in files.items() if v] 260 d.appendVar("EXTRA_OEMESON", " " + " ".join(items)) 261 items = ["%s:%s" % (k, "True" if v else "False") for k,v in files.items()] 262 d.appendVarFlag("do_configure", "file-checksums", " " + " ".join(items)) 263 264python () { 265 find_meson_cross_files(d) 266} 267