aboutsummaryrefslogtreecommitdiff
blob: 3ab1ced56fc7b8a50baa73a55c29a707810d96b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5
inherit emul-linux-x86

LICENSE="GPL-2 LGPL-2 FTL LGPL-2.1 LGPL-3 MPL-1.1 MIT"
KEYWORDS="-* ~amd64"
IUSE="abi_x86_32"

DEPEND=""
RDEPEND="~app-emulation/emul-linux-x86-baselibs-${PV}
	~app-emulation/emul-linux-x86-xlibs-${PV}
	~app-emulation/emul-linux-x86-opengl-${PV}
	abi_x86_32? (
		dev-libs/atk[abi_x86_32(-)]
		dev-libs/libIDL[abi_x86_32(-)]
		>=gnome-base/gconf-3.2.6-r2[abi_x86_32(-)]
		gnome-base/gnome-vfs[abi_x86_32(-)]
		gnome-base/libglade[abi_x86_32(-)]
		gnome-base/orbit[abi_x86_32(-)]
		media-libs/imlib[abi_x86_32(-)]
		x11-libs/cairo[abi_x86_32(-)]
		>=x11-libs/gtk+-2.24.22-r1[abi_x86_32(-)]
		x11-libs/gdk-pixbuf[abi_x86_32(-)]
		x11-libs/libnotify[abi_x86_32(-)]
		x11-libs/pango[abi_x86_32(-)]
		x11-libs/pangox-compat[abi_x86_32(-)]
		>=x11-libs/pixman-0.30.2-r1[abi_x86_32(-)]
		x11-themes/gtk-engines[abi_x86_32(-)]
		>=gnome-base/gnome-vfs-2.24.4-r2[abi_x86_32(-)]
	)"
# RDEPEND on opengl stuff needed due cairo, bug #410213

my_gdk_pixbuf_query_loaders() {
	use abi_x86_32 && return 0
	# causes segfault if set
	unset __GL_NO_DSO_FINALIZER

	local tmp_file=$(mktemp --suffix=tmp.XXXXXXXXXXgdk_pixbuf_queryloaders)
	if [ -z "${tmp_file}" ]; then
		ewarn "Cannot create temporary file"
		return 1
	fi

	if gdk-pixbuf-query-loaders32 > "${tmp_file}"; then
		cat "${tmp_file}" > "${ROOT}usr/lib32/gdk-pixbuf-2.0/2.10.0/loaders.cache"
	else
		ewarn "Warning, gdk-pixbuf-query-loaders32 failed."
	fi
	rm "${tmp_file}"
}

my_pango_querymodules() {
	use abi_x86_32 && return 0
	PANGO_CONFDIR="/etc/pango/i686-pc-linux-gnu"
	einfo "Generating pango modules listing..."

	mkdir -p "${PANGO_CONFDIR}"
	local pango_conf="${PANGO_CONFDIR}/pango.modules"
	local tmp_file=$(mktemp -t tmp.XXXXXXXXXXpango_querymodules)
	if [ -z "${tmp_file}" ]; then
		ewarn "Cannot create temporary file"
		return 1
	fi

	if pango-querymodules32 > "${tmp_file}"; then
		cat "${tmp_file}" > "${pango_conf}"
	else
		ewarn "Cannot update pango.modules, file generation failed"
	fi
	rm "${tmp_file}"
}

my_gtk_query_immodules() {
	use abi_x86_32 && return 0
	GTK2_CONFDIR="/etc/gtk-2.0/i686-pc-linux-gnu"
	einfo "Generating gtk+ immodules/gdk-pixbuf loaders listing..."

	mkdir -p "${GTK2_CONFDIR}"
	local gtk_conf="${ROOT}${GTK2_CONFDIR}/gtk.immodules"
	local tmp_file=$(mktemp -t tmp.XXXXXXXXXXgtk_query_immodules)
	if [ -z "${tmp_file}" ]; then
		ewarn "Cannot create temporary file"
		return 1
	fi

	if gtk-query-immodules-2.0-32 > "${tmp_file}"; then
		cat "${tmp_file}" > "${gtk_conf}"
	else
		ewarn "Cannot update gtk.immodules, file generation failed"
	fi
	rm "${tmp_file}"
}

src_prepare() {
	query_tools="${S}/usr/bin/gtk-query-immodules-2.0|${S}/usr/bin/gdk-pixbuf-query-loaders|${S}/usr/bin/pango-querymodules"
	ALLOWED="(${S}/etc/env.d|${S}/etc/gtk-2.0|${S}/etc/pango/i686-pc-linux-gnu|${query_tools})"
	emul-linux-x86_src_prepare

	# these tools generate an index in /etc/{pango,gtk-2.0}/${CHOST}
	mv -f "${S}/usr/bin/pango-querymodules"{,32} || die
	mv -f "${S}/usr/bin/gtk-query-immodules-2.0"{,-32} || die
	mv -f "${S}/usr/bin/gdk-pixbuf-query-loaders"{,32} || die

	# Remove migrated stuff.
	use abi_x86_32 && rm -f $(cat "${FILESDIR}/remove-native")
}

pkg_preinst() {
	#bug 169058
	for l in "${ROOT}/usr/lib32/{pango,gtk-2.0}" ; do
		[[ -L ${l} ]] && rm -f ${l}
	done
}

pkg_postinst() {
	my_pango_querymodules
	my_gtk_query_immodules
	my_gdk_pixbuf_query_loaders

	# gdk-pixbuf.loaders should be in their CHOST directories respectively.
	if [[ -e "${ROOT}/etc/gtk-2.0/gdk-pixbuf.loaders" ]] ; then
		ewarn
		ewarn "File /etc/gtk-2.0/gdk-pixbuf.loaders shouldn't be present on"
		ewarn "multilib systems, please remove it by hand."
		ewarn
	fi
}