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