summaryrefslogtreecommitdiff
blob: cd322b134c5f25567de33b16a24aa835eeaff250 (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: gnome-meson.eclass
# @MAINTAINER:
# gnome@gentoo.org
# @BLURB: Provides phases for Gnome/Gtk+ based packages that use meosn.
# @DESCRIPTION:
# Exports portage base functions used by ebuilds written for packages using the
# GNOME framework and meson. For additional functions, see gnome2-utils.eclass.

inherit eutils gnome.org gnome2-utils meson xdg

case "${EAPI:-0}" in
	6)
		EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install pkg_preinst pkg_postinst pkg_postrm
		;;
	*) die "EAPI=${EAPI} is not supported" ;;
esac

# @ECLASS-VARIABLE: GNOME-MESON_ECLASS_GIO_MODULES
# @INTERNAL
# @DESCRIPTION:
# Array containing glib GIO modules

# @FUNCTION: gnome-meson_src_prepare
# @DESCRIPTION:
# Prepare environment for build, fix build of scrollkeeper documentation,
# run elibtoolize.
gnome-meson_src_prepare() {
	# FIXME add gtk-doc stuff if needed
	xdg_src_prepare

	# Prevent assorted access violations and test failures
	gnome2_environment_reset
}

# @FUNCTION: gnome-meson_src_configure
# @DESCRIPTION:
# Gnome specific configure handling
gnome-meson_src_configure() {
	# Avoid sandbox violations caused by gnome-vfs (bug #128289 and #345659)
	addpredict "$(unset	 HOME; echo ~)/.gnome2"
	
	#FIXME are these valid/needed
	#	"-Dgtk-doc=no"
	#	"-Dmaintainer-mode=no"
	#	"-Dschemas-install=no"
	#	"-Dupdate-mimedb=no"
	#	"-Dcompile-warnings=minimum"
	local emesonargs=(
		"$@"
	)
	
	meson_src_configure
}

# @FUNCTION: gnome-meson_src_compile
# @DESCRIPTION:
# Only default src_compile for now
gnome-meson_src_compile() {
	meson_src_compile
}

# @FUNCTION: gnome-meson_src_install
# @DESCRIPTION:
# Gnome specific install. Handles typical GConf and scrollkeeper setup
# in packages and removal of .la files if requested
gnome-meson_src_install() {
	# install docs
	default
	
	# files that are really common in gnome packages (bug #573390)
	local d
	for d in HACKING MAINTAINERS; do
		[[ -s "${d}" ]] && dodoc "${d}"
	done
	
	# Make sure this one doesn't get in the portage db
	rm -fr "${ED}/usr/share/applications/mimeinfo.cache"

	# Delete all .la files
	case "${GNOME2_LA_PUNT}" in
		yes)    prune_libtool_files --modules;;
		no)     ;;
		*)      prune_libtool_files;;
	esac
	
	meson_src_install
}

# @FUNCTION: gnome-meson_pkg_preinst
# @DESCRIPTION:
# Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst
gnome-meson_pkg_preinst() {
	xdg_pkg_preinst
	gnome2_gconf_savelist
	gnome2_icon_savelist
	gnome2_schemas_savelist
	gnome2_scrollkeeper_savelist
	gnome2_gdk_pixbuf_savelist

	local f

	GNOME2_ECLASS_GIO_MODULES=()
	while IFS= read -r -d '' f; do
		GNOME2_ECLASS_GIO_MODULES+=( ${f} )
	done < <(cd "${D}" && find usr/$(get_libdir)/gio/modules -type f -print0 2>/dev/null)

	export GNOME2_ECLASS_GIO_MODULES
}

# @FUNCTION: gnome-meson_pkg_postinst
# @DESCRIPTION:
# Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime
# database updates.
gnome-meson_pkg_postinst() {
	xdg_pkg_postinst
	gnome2_gconf_install
	if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
		gnome2_icon_cache_update
	fi
	if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
		gnome2_schemas_update
	fi
	gnome2_scrollkeeper_update
	gnome2_gdk_pixbuf_update

	if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then
		gnome2_giomodule_cache_update
	fi
	
	# This should only be in the overlay
	ewarn "**************************************************************"
	ewarn "This is the *experimental* Gentoo GNOME Overlay"
	ewarn "Please report bugs at #gentoo-desktop @ FreeNode"
	ewarn "Do NOT go to upstream with bugs without checking with us first"
	ewarn "**************************************************************"
}

# # FIXME Handle GConf schemas removal
#gnome2_pkg_prerm() {
#	gnome2_gconf_uninstall
#}

# @FUNCTION: gnome-meson_pkg_postrm
# @DESCRIPTION:
# GSettings, Icons, desktop and mime database updates.
gnome-meson_pkg_postrm() {
	xdg_pkg_postrm
	if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
		gnome2_icon_cache_update
	fi
	if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
		gnome2_schemas_update
	fi

	if [[ ${#GNOME2_ECLASS_GIO_MODULES[@]} -gt 0 ]]; then
		gnome2_giomodule_cache_update
	fi
}