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