meson.eclass: Don't mix host *FLAGS with build *FLAGS
[gentoo.git] / eclass / xfconf.eclass
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: xfconf.eclass
5 # @MAINTAINER:
6 # XFCE maintainers <xfce@gentoo.org>
7 # @BLURB: Default XFCE ebuild layout
8 # @DESCRIPTION:
9 # Default XFCE ebuild layout
10
11 # @ECLASS-VARIABLE: EAUTORECONF
12 # @DESCRIPTION:
13 # Run eautoreconf instead of elibtoolize if the variable is set
14
15 if [[ -n ${EAUTORECONF} ]] ; then
16         AUTOTOOLS_AUTO_DEPEND=yes
17 else
18         : ${AUTOTOOLS_AUTO_DEPEND:=no}
19 fi
20
21 # @ECLASS-VARIABLE: XFCONF
22 # @DESCRIPTION:
23 # This should be an array defining arguments for econf
24
25 unset _xfconf_live
26 [[ $PV == *9999* ]] && _xfconf_live=git-2
27
28 inherit ${_xfconf_live} autotools eutils gnome2-utils libtool xdg-utils
29
30 EGIT_BOOTSTRAP=autogen.sh
31 EGIT_REPO_URI="git://git.xfce.org/xfce/${MY_PN:-${PN}}"
32
33 _xfconf_deps=""
34 _xfconf_m4=">=dev-util/xfce4-dev-tools-4.10"
35
36 [[ -n $_xfconf_live ]] && _xfconf_deps+=" dev-util/gtk-doc ${_xfconf_m4}"
37 [[ -n $EAUTORECONF ]] && _xfconf_deps+=" ${_xfconf_m4}"
38
39 RDEPEND=""
40 DEPEND="${_xfconf_deps}"
41
42 unset _xfconf_deps
43 unset _xfconf_m4
44
45 case ${EAPI:-0} in
46         5) ;;
47         *) die "Unknown EAPI." ;;
48 esac
49
50 [[ -n $_xfconf_live ]] && _xfconf_live=src_unpack
51
52 EXPORT_FUNCTIONS ${_xfconf_live} src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm
53
54 # @FUNCTION: xfconf_use_debug
55 # @DESCRIPTION:
56 # If IUSE has debug, return --enable-debug=minimum.
57 # If USE debug is enabled, return --enable-debug which is the same as --enable-debug=yes.
58 # If USE debug is enabled and the XFCONF_FULL_DEBUG variable is set, return --enable-debug=full.
59 xfconf_use_debug() {
60         if has debug ${IUSE}; then
61                 if use debug; then
62                         if [[ -n $XFCONF_FULL_DEBUG ]]; then
63                                 echo "--enable-debug=full"
64                         else
65                                 echo "--enable-debug"
66                         fi
67                 else
68                         echo "--enable-debug=minimum"
69                 fi
70         else
71                 ewarn "${FUNCNAME} called without debug in IUSE"
72         fi
73 }
74
75 # @FUNCTION: xfconf_src_unpack
76 # @DESCRIPTION:
77 # Run git-2_src_unpack if required
78 xfconf_src_unpack() {
79         NOCONFIGURE=1 git-2_src_unpack
80 }
81
82 # @FUNCTION: xfconf_src_prepare
83 # @DESCRIPTION:
84 # Process PATCHES with epatch and run epatch_user followed by run of
85 # elibtoolize, or eautoreconf if EAUTORECONF is set.
86 xfconf_src_prepare() {
87         debug-print-function ${FUNCNAME} "$@"
88
89         [[ ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
90         epatch_user
91
92         if [[ -n $EAUTORECONF ]]; then
93                 AT_M4DIR=${EPREFIX}/usr/share/xfce4/dev-tools/m4macros eautoreconf
94         else
95                 elibtoolize
96         fi
97 }
98
99 # @FUNCTION: xfconf_src_configure
100 # @DESCRIPTION:
101 # Run econf with opts from the XFCONF array
102 xfconf_src_configure() {
103         debug-print-function ${FUNCNAME} "$@"
104         [[ -n $_xfconf_live ]] && XFCONF+=( --enable-maintainer-mode )
105         econf "${XFCONF[@]}"
106 }
107
108 # @FUNCTION: xfconf_src_install
109 # @DESCRIPTION:
110 # Run emake install to DESTDIR, einstalldocs to process DOCS and
111 # prune_libtool_files --all to always remove libtool files (.la)
112 xfconf_src_install() {
113         debug-print-function ${FUNCNAME} "$@"
114
115         # FIXME
116         if [[ -n $_xfconf_live ]] && ! [[ -e ChangeLog ]]; then
117                 touch ChangeLog
118         fi
119
120         emake DESTDIR="${D}" "$@" install
121
122         einstalldocs
123
124         prune_libtool_files --all
125 }
126
127 # @FUNCTION: xfconf_pkg_preinst
128 # @DESCRIPTION:
129 # Run gnome2_icon_savelist
130 xfconf_pkg_preinst() {
131         debug-print-function ${FUNCNAME} "$@"
132         gnome2_icon_savelist
133 }
134
135 # @FUNCTION: xfconf_pkg_postinst
136 # @DESCRIPTION:
137 # Run xdg_{desktop,mimeinfo}_database_update and gnome2_icon_cache_update
138 xfconf_pkg_postinst() {
139         debug-print-function ${FUNCNAME} "$@"
140         xdg_desktop_database_update
141         xdg_mimeinfo_database_update
142         if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
143                 gnome2_icon_cache_update
144         fi
145 }
146
147 # @FUNCTION: xfconf_pkg_postrm
148 # @DESCRIPTION:
149 # Run xdg_{desktop,mimeinfo}_database_update and gnome2_icon_cache_update
150 xfconf_pkg_postrm() {
151         debug-print-function ${FUNCNAME} "$@"
152         xdg_desktop_database_update
153         xdg_mimeinfo_database_update
154         if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
155                 gnome2_icon_cache_update
156         fi
157 }