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 = "LGPLv2.1+ & BSD & PD"
8LIC_FILES_CHKSUM = "file://COPYING;md5=4fbd65380cdd255951079008b364516c \
9                    file://glib/glib.h;beginline=4;endline=17;md5=b88abb7f3ad09607e71cb9d530155906 \
10                    file://gmodule/COPYING;md5=4fbd65380cdd255951079008b364516c \
11                    file://gmodule/gmodule.h;beginline=4;endline=17;md5=b88abb7f3ad09607e71cb9d530155906 \
12                    file://glib/pcre/pcre.h;beginline=8;endline=36;md5=3e2977dae4ad05217f58c446237298fc \
13                    file://docs/reference/COPYING;md5=f51a5100c17af6bae00735cd791e1fcc"
14BUGTRACKER = "http://bugzilla.gnome.org"
15SECTION = "libs"
16
17CVE_PRODUCT = "glib"
18
19BBCLASSEXTEND = "native nativesdk"
20
21DEPENDS = "glib-2.0-native \
22           virtual/libintl \
23           virtual/libiconv \
24           libffi \
25           zlib"
26
27PACKAGES += "${PN}-codegen ${PN}-utils"
28
29LEAD_SONAME = "libglib-2.0.*"
30
31inherit meson gettext gtk-doc pkgconfig ptest-gnome upstream-version-is-even bash-completion gio-module-cache manpages
32
33DEPENDS:append:class-target = "${@' gtk-doc' if d.getVar('GTKDOC_ENABLED') == 'True' else ''}"
34
35GTKDOC_MESON_OPTION = "gtk_doc"
36
37S = "${WORKDIR}/glib-${PV}"
38
39PACKAGECONFIG ??= "system-pcre libmount \
40                   ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
41# To use the system pcre it must be configured with --enable-unicode-properties
42PACKAGECONFIG[system-pcre] = "-Dinternal_pcre=false,-Dinternal_pcre=true,libpcre"
43PACKAGECONFIG[libmount] = "-Dlibmount=enabled,-Dlibmount=disabled,util-linux"
44PACKAGECONFIG[manpages] = "-Dman=true, -Dman=false, libxslt-native xmlto-native"
45# libelf is auto-detected without a configuration option
46PACKAGECONFIG[libelf] = ",,elfutils"
47PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false,dbus"
48
49EXTRA_OEMESON = "-Ddtrace=false -Dfam=false -Dsystemtap=false -Dselinux=disabled"
50
51do_configure:prepend() {
52	sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
53}
54
55FILES:${PN} = "${libdir}/lib*${SOLIBS} \
56               ${libdir}/gio \
57               ${libexecdir}/*gio-querymodules \
58               ${datadir}/glib-2.0/schemas"
59
60FILES:${PN}-utils += "${bindir}/glib-genmarshal \
61                      ${bindir}/glib-gettextize \
62                      ${bindir}/glib-mkenums \
63                      ${bindir}/glib-compile-resources"
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}/gettext/its"
72FILES:${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb"
73FILES:${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py \
74                       ${bindir}/gdbus-codegen"
75FILES:${PN}-utils = "${bindir}/*"
76
77SHAREDMIMEDEP = "shared-mime-info"
78SHAREDMIMEDEP:class-native = ""
79# When cross compiling for Windows we don't want to include this
80SHAREDMIMEDEP:mingw32 = ""
81
82RRECOMMENDS:${PN} += "${SHAREDMIMEDEP}"
83
84ARM_INSTRUCTION_SET:armv4 = "arm"
85ARM_INSTRUCTION_SET:armv5 = "arm"
86# Valgrind runtime detection works using hand-written assembly, which
87# doesn't support mips16e
88CPPFLAGS:append:class-target:mips16e = " -DNVALGRIND=1"
89
90# GLib generally requires gettext to be present so for USE_NLS to yes.  For
91# native builds as i18n is disabled globally we have to add a gettext-native dependency.
92USE_NLS:class-target = "yes"
93USE_NLS:class-nativesdk = "yes"
94DEPENDS:append:class-native = " gettext-native"
95
96EXEEXT = ""
97EXEEXT:mingw32 = ".exe"
98
99do_install:append () {
100	if [ -f ${D}${bindir}/gtester-report ]; then
101		sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python3|'
102	fi
103
104	# Remove some unpackaged files
105	rm -rf ${D}${datadir}/glib-2.0/codegen/__pycache__
106	rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc
107	rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo
108
109	if [ -e ${D}${libdir}/charset.alias ]; then
110		rm -f ${D}${libdir}/charset.alias
111	fi
112
113        # Make sure gio-querymodules is unique among multilibs
114        if test "x${MLPREFIX}" != "x"; then
115                mv ${D}${libexecdir}/gio-querymodules${EXEEXT} ${D}${libexecdir}/${MLPREFIX}gio-querymodules${EXEEXT}
116        fi
117        # Autotools does this, meson does not
118        mkdir -p ${D}${libdir}/gio/modules
119}
120
121do_install:append:class-target () {
122	# Tests are only installed on targets, not native builds.  Separating this out
123	# keeps glib-2.0-native from depending on DISTRO_FEATURES
124	if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; then
125		if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", "true", d)}; then
126			rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test
127		fi
128	fi
129	if [ -f ${D}${datadir}/installed-tests/glib/static-link.test ]; then
130        if test "x${MLPREFIX}" != "x"; then
131                mv ${D}${datadir}/installed-tests/glib/static-link.test ${D}${datadir}/installed-tests/glib/${MLPREFIX}static-link.test
132        fi
133	fi
134}
135
136# As we do not build python3 for windows, makes no sense to ship the script that's using it
137do_install:append:mingw32() {
138        rm -f ${D}${bindir}/gtester-report
139}
140
141CODEGEN_PYTHON_RDEPENDS = "python3 python3-distutils python3-xml"
142CODEGEN_PYTHON_RDEPENDS:mingw32 = ""
143
144RDEPENDS:${PN}-codegen += "${CODEGEN_PYTHON_RDEPENDS}"
145
146RDEPENDS:${PN}-ptest += "${PN}-utils"
147
148RDEPENDS:${PN}-ptest += "\
149            coreutils \
150            libgcc \
151            dbus \
152            gnome-desktop-testing \
153            tzdata \
154            tzdata-americas \
155            tzdata-asia \
156            tzdata-europe \
157            tzdata-posix \
158            shared-mime-info \
159            ${PN}-locale-ja \
160            ${PN}-locale-fr \
161            ${PN}-locale-el \
162            ${PN}-locale-hr \
163            ${PN}-locale-lt \
164            ${PN}-locale-pl \
165            ${PN}-locale-ru \
166            ${PN}-locale-th \
167            python3-core \
168            python3-modules \
169            ${@bb.utils.contains('GI_DATA_ENABLED', 'True', 'python3-dbusmock', '', d)} \
170            ${PN}-codegen \
171           "
172
173RDEPENDS:${PN}-ptest:append:libc-glibc = "\
174            glibc-gconv-utf-16 \
175            glibc-charmap-utf-8 \
176            glibc-gconv-cp1255 \
177            glibc-charmap-cp1255 \
178            glibc-gconv-utf-32 \
179            glibc-gconv-utf-7 \
180            glibc-gconv-euc-jp \
181            glibc-gconv-iso8859-1 \
182            glibc-gconv-iso8859-15 \
183            glibc-charmap-invariant \
184            glibc-localedata-translit-cjk-variants \
185            locale-base-tr-tr \
186            locale-base-lt-lt \
187            locale-base-ja-jp.euc-jp \
188            locale-base-fa-ir \
189            locale-base-ru-ru \
190            locale-base-de-de \
191            locale-base-hr-hr \
192            locale-base-el-gr \
193            locale-base-fr-fr \
194            locale-base-es-es \
195            locale-base-en-gb \
196            locale-base-en-us \
197            locale-base-pl-pl \
198            locale-base-pl-pl.iso-8859-2 \
199           "
200