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
37# This avoids the need to depend on target python3, which in case of mingw is not even possible.
38# meson's python configuration pokes into python3 configuration, so this provides the native config to it.
39unset _PYTHON_SYSCONFIGDATA_NAME
40
41S = "${WORKDIR}/glib-${PV}"
42
43PACKAGECONFIG ??= "system-pcre libmount \
44                   ${@bb.utils.contains('PTEST_ENABLED', '1', 'tests', '', d)}"
45# To use the system pcre it must be configured with --enable-unicode-properties
46PACKAGECONFIG[system-pcre] = "-Dinternal_pcre=false,-Dinternal_pcre=true,libpcre"
47PACKAGECONFIG[libmount] = "-Dlibmount=enabled,-Dlibmount=disabled,util-linux"
48PACKAGECONFIG[manpages] = "-Dman=true, -Dman=false, libxslt-native xmlto-native"
49# libelf is auto-detected without a configuration option
50PACKAGECONFIG[libelf] = ",,elfutils"
51PACKAGECONFIG[tests] = "-Dinstalled_tests=true,-Dinstalled_tests=false,dbus"
52
53EXTRA_OEMESON = "-Ddtrace=false -Dfam=false -Dsystemtap=false -Dselinux=disabled"
54
55do_configure_prepend() {
56	sed -i -e '1s,#!.*,#!${USRBINPATH}/env python3,' ${S}/gio/gdbus-2.0/codegen/gdbus-codegen.in
57}
58
59FILES_${PN} = "${libdir}/lib*${SOLIBS} \
60               ${libdir}/gio \
61               ${libexecdir}/*gio-querymodules \
62               ${datadir}/glib-2.0/schemas"
63
64FILES_${PN}-utils += "${bindir}/glib-genmarshal \
65                      ${bindir}/glib-gettextize \
66                      ${bindir}/glib-mkenums \
67                      ${bindir}/glib-compile-resources"
68
69FILES_${PN}-dev += "${libdir}/glib-2.0/include \
70                    ${libdir}/gio/modules/lib*${SOLIBSDEV} \
71                    ${libdir}/gio/modules/*.la \
72                    ${datadir}/glib-2.0/gettext/po/Makefile.in.in \
73                    ${datadir}/glib-2.0/schemas/gschema.dtd \
74                    ${datadir}/glib-2.0/valgrind/glib.supp \
75                    ${datadir}/gettext/its"
76FILES_${PN}-dbg += "${datadir}/glib-2.0/gdb ${datadir}/gdb"
77FILES_${PN}-codegen = "${datadir}/glib-2.0/codegen/*.py \
78                       ${bindir}/gdbus-codegen"
79FILES_${PN}-utils = "${bindir}/*"
80
81SHAREDMIMEDEP = "shared-mime-info"
82SHAREDMIMEDEP_class-native = ""
83# When cross compiling for Windows we don't want to include this
84SHAREDMIMEDEP_mingw32 = ""
85
86RRECOMMENDS_${PN} += "${SHAREDMIMEDEP}"
87
88ARM_INSTRUCTION_SET_armv4 = "arm"
89ARM_INSTRUCTION_SET_armv5 = "arm"
90# Valgrind runtime detection works using hand-written assembly, which
91# doesn't support mips16e
92CPPFLAGS_append_class-target_mips16e = " -DNVALGRIND=1"
93
94# GLib generally requires gettext to be present so for USE_NLS to yes.  For
95# native builds as i18n is disabled globally we have to add a gettext-native dependency.
96USE_NLS_class-target = "yes"
97USE_NLS_class-nativesdk = "yes"
98DEPENDS_append_class-native = " gettext-native"
99
100EXEEXT = ""
101EXEEXT_mingw32 = ".exe"
102
103do_install_append () {
104	if [ -f ${D}${bindir}/gtester-report ]; then
105		sed ${D}${bindir}/gtester-report -i -e '1s|^#!.*|#!/usr/bin/env python3|'
106	fi
107
108	# Remove some unpackaged files
109	rm -rf ${D}${datadir}/glib-2.0/codegen/__pycache__
110	rm -f ${D}${datadir}/glib-2.0/codegen/*.pyc
111	rm -f ${D}${datadir}/glib-2.0/codegen/*.pyo
112
113	if [ -e ${D}${libdir}/charset.alias ]; then
114		rm -f ${D}${libdir}/charset.alias
115	fi
116
117        # Make sure gio-querymodules is unique among multilibs
118        if test "x${MLPREFIX}" != "x"; then
119                mv ${D}${libexecdir}/gio-querymodules${EXEEXT} ${D}${libexecdir}/${MLPREFIX}gio-querymodules${EXEEXT}
120        fi
121        # Autotools does this, meson does not
122        mkdir -p ${D}${libdir}/gio/modules
123}
124
125do_install_append_class-target () {
126	# Tests are only installed on targets, not native builds.  Separating this out
127	# keeps glib-2.0-native from depending on DISTRO_FEATURES
128	if [ -f ${D}${datadir}/installed-tests/glib/gdbus-serialization.test ]; then
129		if ${@bb.utils.contains("DISTRO_FEATURES", "x11", "false", "true", d)}; then
130			rm ${D}${datadir}/installed-tests/glib/gdbus-serialization.test
131		fi
132	fi
133	if [ -f ${D}${datadir}/installed-tests/glib/static-link.test ]; then
134        if test "x${MLPREFIX}" != "x"; then
135                mv ${D}${datadir}/installed-tests/glib/static-link.test ${D}${datadir}/installed-tests/glib/${MLPREFIX}static-link.test
136        fi
137	fi
138}
139
140# As we do not build python3 for windows, makes no sense to ship the script that's using it
141do_install_append_mingw32() {
142        rm -f ${D}${bindir}/gtester-report
143}
144
145CODEGEN_PYTHON_RDEPENDS = "python3 python3-distutils python3-xml"
146CODEGEN_PYTHON_RDEPENDS_mingw32 = ""
147
148RDEPENDS_${PN}-codegen += "${CODEGEN_PYTHON_RDEPENDS}"
149
150RDEPENDS_${PN}-ptest += "${PN}-utils"
151
152RDEPENDS_${PN}-ptest += "\
153            coreutils \
154            libgcc \
155            dbus \
156            gnome-desktop-testing \
157            tzdata \
158            tzdata-americas \
159            tzdata-asia \
160            tzdata-europe \
161            tzdata-posix \
162            shared-mime-info \
163            ${PN}-locale-ja \
164            ${PN}-locale-fr \
165            ${PN}-locale-el \
166            ${PN}-locale-hr \
167            ${PN}-locale-lt \
168            ${PN}-locale-pl \
169            ${PN}-locale-ru \
170            ${PN}-locale-th \
171            python3-core \
172            python3-modules \
173            python3-dbusmock \
174            ${PN}-codegen \
175           "
176
177RDEPENDS_${PN}-ptest_append_libc-glibc = "\
178            glibc-gconv-utf-16 \
179            glibc-charmap-utf-8 \
180            glibc-gconv-cp1255 \
181            glibc-charmap-cp1255 \
182            glibc-gconv-utf-32 \
183            glibc-gconv-utf-7 \
184            glibc-gconv-euc-jp \
185            glibc-gconv-iso8859-1 \
186            glibc-gconv-iso8859-15 \
187            glibc-charmap-invariant \
188            glibc-localedata-translit-cjk-variants \
189            locale-base-tr-tr \
190            locale-base-lt-lt \
191            locale-base-ja-jp.euc-jp \
192            locale-base-fa-ir \
193            locale-base-ru-ru \
194            locale-base-de-de \
195            locale-base-hr-hr \
196            locale-base-el-gr \
197            locale-base-fr-fr \
198            locale-base-es-es \
199            locale-base-en-gb \
200            locale-base-en-us \
201            locale-base-pl-pl \
202            locale-base-pl-pl.iso-8859-2 \
203           "
204