sys-process/glances: revbump 3.1.4.1, add missing doc dep
[gentoo.git] / eclass / mate.eclass
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: mate.eclass
5 # @MAINTAINER:
6 # mate@gentoo.org
7 # @AUTHOR:
8 # Authors: NP-Hardass <NP-Hardass@gentoo.org> based upon the gnome2
9 # and autotools-utils eclasses
10 # @SUPPORTED_EAPIS: 6
11 # @BLURB: Provides phases for MATE based packages.
12 # @DESCRIPTION:
13 # Exports portage base functions used by ebuilds written for packages using the
14 # MATE framework. Occassionally acts as a wrapper to gnome2 due to the
15 # fact that MATE is a GNOME fork. For additional functions, see gnome2-utils.eclass.
16
17 # Check EAPI only
18 case "${EAPI:-0}" in
19         6) ;;
20         *) die "EAPI=${EAPI:-0} is not supported" ;;
21 esac
22
23 # Inherit happens below after declaration of GNOME2_LA_PUNT
24
25 # @ECLASS-VARIABLE: MATE_LA_PUNT
26 # @DESCRIPTION:
27 # Available values for MATE_LA_PUNT:
28 # - "no": will not clean any .la files
29 # - "yes": will run prune_libtool_files --modules
30 # - If it is not set, it will run prune_libtool_files
31 # MATE_LA_PUNT is a stub to GNOME2_LA_PUNT
32 GNOME2_LA_PUNT=${MATE_LA_PUNT:-""}
33
34 inherit gnome2 autotools mate-desktop.org
35
36 case "${EAPI:-0}" in
37         6) EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm ;;
38         *) die "EAPI=${EAPI:-0} is not supported" ;;
39 esac
40
41 # Autotools requires our MATE m4 files
42 DEPEND=">=mate-base/mate-common-${MATE_BRANCH}"
43
44 # @FUNCTION: mate_py_cond_func_wrap
45 # @DESCRIPTION:
46 # Wraps a function for conditional python use, to run for each
47 # python implementation in the build directory.
48 # This function should only be used if the ebuild also inherits the
49 # python-r1 eclass
50 mate_py_cond_func_wrap() {
51         if [[ ! ${_PYTHON_R1} ]]; then
52                 die "This function requires the inheritence of the python-r1 eclass"
53         fi
54         if use python; then
55                 python_foreach_impl run_in_build_dir "$@"
56         else
57                 $@
58         fi
59 }
60
61 # @ECLASS-VARIABLE: MATE_FORCE_AUTORECONF
62 # @DESCRIPTION:
63 # Available values for MATE_FORCE_AUTORECONF:
64 # - true: will always run eautoreconf
65 # - false: will default to automatic detect
66 # - If it is not set, it will default to false
67 : ${MATE_FORCE_AUTORECONF:="false"}
68
69 # @FUNCTION: ematedocize
70 # @DESCRIPTION:
71 # A wrapper around mate-doc-common
72 ematedocize() {
73         ebegin "Running mate-doc-common --copy"
74                 mate-doc-common --copy || die
75         eend $?
76 }
77
78 # @FUNCTION: want_mate_doc
79 # @DESCRIPTION:
80 # Returns true/false based on whether eautoreconf should call
81 # ematedocize
82 want_mate_doc() {
83         grep -q USE_COMMON_DOC_BUILD autogen.sh
84 }
85
86 # @FUNCTION: mate_src_prepare
87 # @DESCRIPTION:
88 # Call gnome2_src_prepare to handle environment setup and patching, then
89 # call eautoreconf if necessary
90 mate_src_prepare() {
91         debug-print-function ${FUNCNAME} "$@"
92
93         local force_autoreconf=${MATE_FORCE_AUTORECONF}
94         [[ ${PV} == 9999 ]] && force_autoreconf="true"
95
96         gen_chksum() {
97                 find '(' -name 'Makefile.am' \
98                         -o -name 'configure.ac' \
99                         -o -name 'configure.in' ')' \
100                         -exec cksum {} + | sort -k2
101         }
102
103         local chksum=$(gen_chksum)
104
105         gnome2_src_prepare "$@"
106
107         if [[ "${force_autoreconf}" == "true" ]] || [[ ${chksum} != $(gen_chksum) ]]; then
108                 want_mate_doc && ematedocize
109                 AT_NOELIBTOOLIZE="yes" eautoreconf # gnome2_src_prepare calls elibtoolize
110         fi
111 }
112
113 # @FUNCTION: mate_src_configure
114 # @DESCRIPTION:
115 # MATE specific configure handling
116 # Stub to gnome2_src_configure()
117 mate_src_configure() {
118         gnome2_src_configure "$@"
119 }
120
121 # @FUNCTION: mate_src_install
122 # @DESCRIPTION:
123 # MATE specific install. Stub to gnome2_src_install
124 mate_src_install() {
125         gnome2_src_install "$@"
126 }
127
128 # @FUNCTION: mate_pkg_preinst
129 # @DESCRIPTION:
130 # Finds Icons, GConf and GSettings schemas for later handling in pkg_postinst
131 # Stub to gnome2_pkg_preinst
132 mate_pkg_preinst() {
133         gnome2_pkg_preinst "$@"
134 }
135
136 # @FUNCTION: mate_pkg_postinst
137 # @DESCRIPTION:
138 # Handle scrollkeeper, GConf, GSettings, Icons, desktop and mime
139 # database updates.
140 # Stub to gnome2_pkg_postinst
141 mate_pkg_postinst() {
142         gnome2_pkg_postinst "$@"
143 }
144
145 # @FUNCTION: mate_pkg_postrm
146 # @DESCRIPTION:
147 # Handle scrollkeeper, GSettings, Icons, desktop and mime database updates.
148 # Stub to gnome2_pkg_postrm
149 mate_pkg_postrm() {
150         gnome2_pkg_postrm "$@"
151 }