1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # Until bug #537330 glib is a reverse dependency of pkgconfig and, then
6 # adding new dependencies end up making stage3 to grow. Every addition needs
7 # then to be think very closely.
10 PYTHON_COMPAT=( python2_7 )
11 # Building with --disable-debug highly unrecommended. It will build glib in
12 # an unusable form as it disables some commonly used API. Please do not
13 # convert this to the use_enable form, as it results in a broken build.
15 # Completely useless with or without USE static-libs, people need to use
19 inherit autotools bash-completion-r1 gnome2 libtool eutils flag-o-matic multilib \
20 pax-utils python-r1 toolchain-funcs versionator virtualx linux-info multilib-minimal
22 DESCRIPTION="The GLib library of C routines"
23 HOMEPAGE="http://www.gtk.org/"
25 http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz" # pkg.m4 for eautoreconf
29 IUSE="dbus fam kernel_linux +mime selinux static-libs systemtap test utils xattr"
31 utils? ( ${PYTHON_REQUIRED_USE} )
32 test? ( ${PYTHON_REQUIRED_USE} )
35 KEYWORDS="alpha amd64 arm ~arm64 hppa ~ia64 ~m68k ~mips ~ppc ppc64 ~s390 ~sh sparc x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux"
38 !<dev-util/gdbus-codegen-${PV}
39 >=virtual/libiconv-0-r1[${MULTILIB_USEDEP}]
40 >=virtual/libffi-3.0.13-r1[${MULTILIB_USEDEP}]
41 >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
43 >=dev-libs/elfutils-0.142
44 >=dev-libs/libelf-0.8.12
45 >=sys-freebsd/freebsd-lib-9.2_rc1
47 selinux? ( >=sys-libs/libselinux-2.2.2-r5[${MULTILIB_USEDEP}] )
48 xattr? ( >=sys-apps/attr-2.4.47-r1[${MULTILIB_USEDEP}] )
49 fam? ( >=virtual/fam-0-r1[${MULTILIB_USEDEP}] )
52 >=dev-util/gdbus-codegen-${PV}[${PYTHON_USEDEP}] )
54 !<=app-emulation/emul-linux-x86-baselibs-20130224-r9
55 !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
59 app-text/docbook-xml-dtd:4.1.2
60 >=dev-libs/libxslt-1.0
61 >=sys-devel/gettext-0.11
62 >=dev-util/gtk-doc-am-1.20
63 systemtap? ( >=dev-util/systemtap-1.3 )
67 >=dev-util/gdbus-codegen-${PV}[${PYTHON_USEDEP}]
68 >=sys-apps/dbus-1.2.14 )
69 !<dev-util/gtk-doc-1.15-r2
71 # gobject-introspection blocker to ensure people don't mix
72 # different g-i and glib major versions
74 PDEPEND="!<gnome-base/gvfs-1.6.4-r990
75 dbus? ( gnome-base/dconf )
76 mime? ( x11-misc/shared-mime-info )
78 # shared-mime-info needed for gio/xdgmime, bug #409481
79 # dconf is needed to be able to save settings, bug #498436
80 # Earlier versions of gvfs do not work with glib
83 if use kernel_linux ; then
84 CONFIG_CHECK="~INOTIFY_USER"
87 WARNING_IPV6="Your kernel needs IPV6 support for running some tests, skipping them."
88 export IPV6_DISABLED="yes"
95 # Prevent build failure in stage3 where pkgconfig is not available, bug #481056
96 mv -f "${WORKDIR}"/pkg-config-*/pkg.m4 "${S}"/m4macros/ || die
99 # Disable tests requiring dev-util/desktop-file-utils when not installed, bug #286629, upstream bug #629163
100 if ! has_version dev-util/desktop-file-utils ; then
101 ewarn "Some tests will be skipped due dev-util/desktop-file-utils not being present on your system,"
102 ewarn "think on installing it to get these tests run."
103 sed -i -e "/appinfo\/associations/d" gio/tests/appinfo.c || die
104 sed -i -e "/desktop-app-info\/default/d" gio/tests/desktop-app-info.c || die
105 sed -i -e "/desktop-app-info\/fallback/d" gio/tests/desktop-app-info.c || die
106 sed -i -e "/desktop-app-info\/lastused/d" gio/tests/desktop-app-info.c || die
109 # gdesktopappinfo requires existing terminal (gnome-terminal or any
110 # other), falling back to xterm if one doesn't exist
111 if ! has_version x11-terms/xterm && ! has_version x11-terms/gnome-terminal ; then
112 ewarn "Some tests will be skipped due to missing terminal program"
113 sed -i -e "/appinfo\/launch/d" gio/tests/appinfo.c || die
116 # Disable tests requiring dbus-python and pygobject; bugs #349236, #377549, #384853
117 if ! has_version dev-python/dbus-python || ! has_version 'dev-python/pygobject:3' ; then
118 ewarn "Some tests will be skipped due to dev-python/dbus-python or dev-python/pygobject:3"
119 ewarn "not being present on your system, think on installing them to get these tests run."
120 sed -i -e "/connection\/filter/d" gio/tests/gdbus-connection.c || die
121 sed -i -e "/connection\/large_message/d" gio/tests/gdbus-connection-slow.c || die
122 sed -i -e "/gdbus\/proxy/d" gio/tests/gdbus-proxy.c || die
123 sed -i -e "/gdbus\/proxy-well-known-name/d" gio/tests/gdbus-proxy-well-known-name.c || die
124 sed -i -e "/gdbus\/introspection-parser/d" gio/tests/gdbus-introspection.c || die
125 sed -i -e "/g_test_add_func/d" gio/tests/gdbus-threading.c || die
126 sed -i -e "/gdbus\/method-calls-in-thread/d" gio/tests/gdbus-threading.c || die
127 # needed to prevent gdbus-threading from asserting
128 ln -sfn $(type -P true) gio/tests/gdbus-testserver.py
131 # Some tests need ipv6, upstream bug #667468
132 if [[ -n "${IPV6_DISABLED}" ]]; then
133 sed -i -e "/gdbus\/peer-to-peer/d" gio/tests/gdbus-peer.c || die
134 sed -i -e "/gdbus\/delayed-message-processing/d" gio/tests/gdbus-peer.c || die
135 sed -i -e "/gdbus\/nonce-tcp/d" gio/tests/gdbus-peer.c || die
138 # thread test fails, upstream bug #679306
139 # FIXME: we need to check if it's still failing as upstream thinks something
140 # is wrong in our setups
141 #epatch "${FILESDIR}/${PN}-2.34.0-testsuite-skip-thread4.patch"
143 # This test is prone to fail, bug #504024, upstream bug #723719
144 sed -i -e '/gdbus-close-pending/d' gio/tests/Makefile.am || die
146 # Don't build tests, also prevents extra deps, bug #512022
147 sed -i -e 's/ tests//' {.,gio,glib}/Makefile.am || die
150 # gdbus-codegen is a separate package
151 epatch "${FILESDIR}/${PN}-2.40.0-external-gdbus-codegen.patch"
153 # leave python shebang alone
154 sed -e '/${PYTHON}/d' \
155 -i glib/Makefile.{am,in} || die
157 # Gentoo handles completions in a different directory
158 sed -i "s|^completiondir =.*|completiondir = $(get_bashcompdir)|" \
159 gio/Makefile.am || die
163 # Also needed to prevent cross-compile failures, see bug #267603
171 multilib_src_configure() {
172 # Avoid circular depend with dev-util/pkgconfig and
173 # native builds (cross-compiles won't need pkg-config
174 # in the target ROOT to work here)
175 if ! tc-is-cross-compiler && ! $(tc-getPKG_CONFIG) --version >& /dev/null; then
176 if has_version sys-apps/dbus; then
177 export DBUS1_CFLAGS="-I/usr/include/dbus-1.0 -I/usr/$(get_libdir)/dbus-1.0/include"
178 export DBUS1_LIBS="-ldbus-1"
180 export LIBFFI_CFLAGS="-I$(echo /usr/$(get_libdir)/libffi-*/include)"
181 export LIBFFI_LIBS="-lffi"
187 *-mingw*) myconf="${myconf} --with-threads=win32" ;;
188 *) myconf="${myconf} --with-threads=posix" ;;
191 # Only used by the gresource bin
192 multilib_is_native_abi || myconf="${myconf} --disable-libelf"
194 # FIXME: Always use internal libpcre, bug #254659
195 # (maybe consider going back to system lib
196 ECONF_SOURCE="${S}" gnome2_src_configure ${myconf} \
197 $(use_enable xattr) \
199 $(use_enable selinux) \
200 $(use_enable static-libs static) \
201 $(use_enable systemtap dtrace) \
202 $(use_enable systemtap systemtap) \
203 --disable-compile-warnings \
205 --with-pcre=internal \
206 --with-xml-catalog="${EPREFIX}/etc/xml/catalog"
208 if multilib_is_native_abi; then
210 for d in glib gio gobject; do
211 ln -s "${S}"/docs/reference/${d}/html docs/reference/${d}/html || die
216 multilib_src_test() {
217 unset DBUS_SESSION_BUS_ADDRESS
218 export XDG_CONFIG_DIRS=/etc/xdg
219 export XDG_DATA_DIRS=/usr/local/share:/usr/share
220 export G_DBUS_COOKIE_SHA1_KEYRING_DIR="${T}/temp"
221 unset GSETTINGS_BACKEND # bug 352451
222 export LC_TIME=C # bug #411967
225 # Related test is a bit nitpicking
226 mkdir "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
227 chmod 0700 "$G_DBUS_COOKIE_SHA1_KEYRING_DIR"
229 # Hardened: gdb needs this, bug #338891
230 if host-is-pax ; then
231 pax-mark -mr "${BUILD_DIR}"/tests/.libs/assert-msg-test \
232 || die "Hardened adjustment failed"
235 # Need X for dbus-launch session X11 initialization
239 multilib_src_install() {
243 multilib_src_install_all() {
244 DOCS="AUTHORS ChangeLog* NEWS* README"
248 python_replicate_script "${ED}"/usr/bin/gtester-report
250 rm "${ED}usr/bin/gtester-report"
251 rm "${ED}usr/share/man/man1/gtester-report.1"
254 # Do not install charset.alias even if generated, leave it to libiconv
255 rm -f "${ED}/usr/lib/charset.alias"
257 # Don't install gdb python macros, bug 291328
258 rm -rf "${ED}/usr/share/gdb/" "${ED}/usr/share/glib-2.0/gdb/"
263 if has_version '<x11-libs/gtk+-3.0.12:3'; then
264 # To have a clear upgrade path for gtk+-3.0.x users, have to resort to
265 # a warning instead of a blocker
267 ewarn "Using <gtk+-3.0.12:3 with ${P} results in frequent crashes."
268 ewarn "You should upgrade to a newer version of gtk+:3 immediately."