| 1 | # Copyright 1999-2009 Gentoo Foundation |
1 | # Copyright 1999-2009 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xfconf.eclass,v 1.11 2010/03/26 11:41:57 ssuominen Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xfconf.eclass,v 1.32 2011/04/30 07:38:34 ssuominen Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: xfconf.eclass |
5 | # @ECLASS: xfconf.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # XFCE maintainers <xfce@gentoo.org> |
7 | # XFCE maintainers <xfce@gentoo.org> |
| 8 | # @BLURB: Default XFCE ebuild layout |
8 | # @BLURB: Default XFCE ebuild layout |
| 9 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 10 | # Default XFCE ebuild layout |
10 | # Default XFCE ebuild layout |
| 11 | |
11 | |
| 12 | # @ECLASS-VARIABLE: EAUTORECONF |
12 | # @ECLASS-VARIABLE: EAUTORECONF |
| 13 | # @DESCRIPTION: |
13 | # @DESCRIPTION: |
| 14 | # Run eautoreconf instead of elibtoolize if set "yes" |
14 | # Run eautoreconf instead of elibtoolize if the variable is set |
| 15 | |
15 | |
| 16 | # @ECLASS-VARIABLE: EINTLTOOLIZE |
16 | # @ECLASS-VARIABLE: EINTLTOOLIZE |
| 17 | # @DESCRIPTION: |
17 | # @DESCRIPTION: |
| 18 | # Run intltoolize --force --copy --automake if set "yes" |
18 | # Run intltoolize --force --copy --automake if the variable is set |
| 19 | |
19 | |
| 20 | # @ECLASS-VARIABLE: DOCS |
20 | # @ECLASS-VARIABLE: DOCS |
| 21 | # @DESCRIPTION: |
21 | # @DESCRIPTION: |
| 22 | # Define documentation to install |
22 | # This should be an array defining documentation to install |
| 23 | |
23 | |
| 24 | # @ECLASS-VARIABLE: PATCHES |
24 | # @ECLASS-VARIABLE: PATCHES |
| 25 | # @DESCRIPTION: |
25 | # @DESCRIPTION: |
| 26 | # Define patches to apply |
26 | # This should be an array defining patches to apply |
| 27 | |
27 | |
| 28 | # @ECLASS-VARIABLE: XFCONF |
28 | # @ECLASS-VARIABLE: XFCONF |
| 29 | # @DESCRIPTION: |
29 | # @DESCRIPTION: |
| 30 | # Define options for econf |
30 | # This should be an array defining arguments for econf |
| 31 | |
31 | |
| 32 | inherit autotools base fdo-mime gnome2-utils libtool |
32 | inherit autotools base eutils fdo-mime gnome2-utils libtool |
| 33 | |
33 | |
| 34 | if ! [[ ${MY_P} ]]; then |
|
|
| 35 | MY_P=${P} |
|
|
| 36 | else |
|
|
| 37 | S=${WORKDIR}/${MY_P} |
|
|
| 38 | fi |
|
|
| 39 | |
|
|
| 40 | SRC_URI="mirror://xfce/xfce/${PV}/src/${MY_P}.tar.bz2" |
|
|
| 41 | |
|
|
| 42 | if [[ "${EINTLTOOLIZE}" == "yes" ]]; then |
34 | if [[ -n $EINTLTOOLIZE ]]; then |
| 43 | _xfce4_intltool="dev-util/intltool" |
35 | _xfce4_intltool="dev-util/intltool" |
| 44 | fi |
36 | fi |
| 45 | |
37 | |
| 46 | if [[ "${EAUTORECONF}" == "yes" ]]; then |
38 | if [[ -n $EAUTORECONF ]]; then |
| 47 | _xfce4_m4=">=dev-util/xfce4-dev-tools-4.7.0" |
39 | _xfce4_m4=">=dev-util/xfce4-dev-tools-4.8.0" |
| 48 | fi |
40 | fi |
| 49 | |
41 | |
| 50 | RDEPEND="" |
42 | RDEPEND="" |
| 51 | DEPEND="${_xfce4_intltool} |
43 | DEPEND="${_xfce4_intltool} |
| 52 | ${_xfce4_m4}" |
44 | ${_xfce4_m4}" |
| 53 | |
45 | |
| 54 | unset _xfce4_intltool |
46 | unset _xfce4_intltool |
| 55 | unset _xfce4_m4 |
47 | unset _xfce4_m4 |
| 56 | |
48 | |
| 57 | XFCONF_EXPF="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm" |
|
|
| 58 | case ${EAPI:-0} in |
49 | case ${EAPI:-0} in |
| 59 | 3|2) XFCONF_EXPF="${XFCONF_EXPF} src_prepare src_configure" ;; |
|
|
| 60 | 1|0) ;; |
50 | 4|3) ;; |
| 61 | *) die "Unknown EAPI." ;; |
51 | *) die "Unknown EAPI." ;; |
| 62 | esac |
52 | esac |
| 63 | EXPORT_FUNCTIONS ${XFCONF_EXPF} |
53 | |
|
|
54 | EXPORT_FUNCTIONS src_prepare src_configure src_install pkg_preinst pkg_postinst pkg_postrm |
| 64 | |
55 | |
| 65 | # @FUNCTION: xfconf_use_debug |
56 | # @FUNCTION: xfconf_use_debug |
| 66 | # @RETURN: |
57 | # @DESCRIPTION: |
| 67 | # Return --enable-debug, --enable-debug=full or --disable-debug based on |
58 | # If IUSE has debug, return --enable-debug=minimum. |
| 68 | # I_KNOW_WHAT_I_AM_DOING variable |
59 | # If USE debug is enabled, return --enable-debug which is the same as --enable-debug=yes. |
|
|
60 | # If USE debug is enabled and the XFCONF_FULL_DEBUG variable is set, return --enable-debug=full. |
| 69 | xfconf_use_debug() { |
61 | xfconf_use_debug() { |
|
|
62 | if has debug ${IUSE}; then |
| 70 | if use debug; then |
63 | if use debug; then |
| 71 | if [[ -n $I_KNOW_WHAT_I_AM_DOING ]]; then |
64 | if [[ -n $XFCONF_FULL_DEBUG ]]; then |
| 72 | echo "--enable-debug=full" |
65 | echo "--enable-debug=full" |
|
|
66 | else |
|
|
67 | echo "--enable-debug" |
|
|
68 | fi |
| 73 | else |
69 | else |
| 74 | echo "--enable-debug" |
70 | echo "--enable-debug=minimum" |
| 75 | fi |
|
|
| 76 | else |
|
|
| 77 | if [[ -n $I_KNOW_WHAT_I_AM_DOING ]]; then |
|
|
| 78 | echo "--disable-debug" |
|
|
| 79 | fi |
71 | fi |
| 80 | fi |
72 | fi |
| 81 | } |
73 | } |
| 82 | |
74 | |
| 83 | # @FUNCTION: xfconf_src_unpack |
|
|
| 84 | # @DESCRIPTION: |
|
|
| 85 | # Run base_src_util autopatch and eautoreconf or elibtoolize |
|
|
| 86 | xfconf_src_unpack() { |
|
|
| 87 | unpack ${A} |
|
|
| 88 | cd "${S}" |
|
|
| 89 | has src_prepare ${XFCONF_EXPF} || xfconf_src_prepare |
|
|
| 90 | } |
|
|
| 91 | |
|
|
| 92 | # @FUNCTION: xfconf_src_prepare |
75 | # @FUNCTION: xfconf_src_prepare |
| 93 | # @DESCRIPTION: |
76 | # @DESCRIPTION: |
| 94 | # Run base_src_util autopatch and eautoreconf or elibtoolize |
77 | # Run base_src_prepare and eautoreconf or elibtoolize |
| 95 | xfconf_src_prepare() { |
78 | xfconf_src_prepare() { |
|
|
79 | debug-print-function ${FUNCNAME} "$@" |
| 96 | base_src_prepare |
80 | base_src_prepare |
| 97 | |
81 | |
| 98 | if [[ "${EINTLTOOLIZE}" == "yes" ]]; then |
82 | if [[ -n $EINTLTOOLIZE ]]; then |
| 99 | intltoolize --force --copy --automake || die "intltoolize failed" |
83 | intltoolize --force --copy --automake || die |
| 100 | fi |
84 | fi |
| 101 | |
85 | |
| 102 | if [[ "${EAUTORECONF}" == "yes" ]]; then |
86 | if [[ -n $EAUTORECONF ]]; then |
| 103 | has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
|
|
| 104 | AT_M4DIR="${EPREFIX}/usr/share/xfce4/dev-tools/m4macros" eautoreconf |
87 | AT_M4DIR=${EPREFIX}/usr/share/xfce4/dev-tools/m4macros eautoreconf |
| 105 | else |
88 | else |
| 106 | elibtoolize |
89 | elibtoolize |
| 107 | fi |
90 | fi |
| 108 | } |
91 | } |
| 109 | |
92 | |
| 110 | # @FUNCTION: xfconf_src_configure |
93 | # @FUNCTION: xfconf_src_configure |
| 111 | # @DESCRIPTION: |
94 | # @DESCRIPTION: |
| 112 | # Run econf with opts in XFCONF variable |
95 | # Run econf with opts from the XFCONF array |
| 113 | xfconf_src_configure() { |
96 | xfconf_src_configure() { |
|
|
97 | debug-print-function ${FUNCNAME} "$@" |
| 114 | econf ${XFCONF} |
98 | econf "${XFCONF[@]}" |
| 115 | } |
|
|
| 116 | |
|
|
| 117 | # @FUNCTION: xfconf_src_compile |
|
|
| 118 | # @DESCRIPTION: |
|
|
| 119 | # Run econf with opts in XFCONF variable |
|
|
| 120 | xfconf_src_compile() { |
|
|
| 121 | has src_configure ${XFCONF_EXPF} || xfconf_src_configure |
|
|
| 122 | emake || die "emake failed" |
|
|
| 123 | } |
99 | } |
| 124 | |
100 | |
| 125 | # @FUNCTION: xfconf_src_install |
101 | # @FUNCTION: xfconf_src_install |
| 126 | # @DESCRIPTION: |
102 | # @DESCRIPTION: |
| 127 | # Run emake install and install documentation in DOCS variable |
103 | # Run emake install and install documentation in the DOCS variable |
| 128 | xfconf_src_install() { |
104 | xfconf_src_install() { |
| 129 | emake DESTDIR="${D}" install || die "emake install failed" |
105 | debug-print-function ${FUNCNAME} "$@" |
|
|
106 | emake DESTDIR="${D}" "$@" install || die |
| 130 | |
107 | |
| 131 | if [[ -n ${DOCS} ]]; then |
108 | if [[ -n ${DOCS[@]} ]]; then |
| 132 | dodoc ${DOCS} || die "dodoc failed" |
109 | if [[ $(declare -p DOCS) == "declare -a "* ]]; then |
|
|
110 | dodoc "${DOCS[@]}" || die |
|
|
111 | else |
|
|
112 | dodoc ${DOCS} || die |
|
|
113 | fi |
| 133 | fi |
114 | fi |
|
|
115 | |
|
|
116 | find "${ED}" -name '*.la' -exec rm -f {} + |
|
|
117 | |
|
|
118 | validate_desktop_entries |
| 134 | } |
119 | } |
| 135 | |
120 | |
| 136 | # @FUNCTION: xfconf_pkg_preinst |
121 | # @FUNCTION: xfconf_pkg_preinst |
| 137 | # @DESCRIPTION: |
122 | # @DESCRIPTION: |
| 138 | # Run gnome2_icon_savelist |
123 | # Run gnome2_icon_savelist |
| 139 | xfconf_pkg_preinst() { |
124 | xfconf_pkg_preinst() { |
|
|
125 | debug-print-function ${FUNCNAME} "$@" |
| 140 | gnome2_icon_savelist |
126 | gnome2_icon_savelist |
| 141 | } |
127 | } |
| 142 | |
128 | |
| 143 | # @FUNCTION: xfconf_pkg_postinst |
129 | # @FUNCTION: xfconf_pkg_postinst |
| 144 | # @DESCRIPTION: |
130 | # @DESCRIPTION: |
| 145 | # Run fdo-mime_{desktop,mime}_database_update and gnome2_icon_cache_update |
131 | # Run fdo-mime_{desktop,mime}_database_update and gnome2_icon_cache_update |
| 146 | xfconf_pkg_postinst() { |
132 | xfconf_pkg_postinst() { |
|
|
133 | debug-print-function ${FUNCNAME} "$@" |
| 147 | fdo-mime_desktop_database_update |
134 | fdo-mime_desktop_database_update |
| 148 | fdo-mime_mime_database_update |
135 | fdo-mime_mime_database_update |
| 149 | gnome2_icon_cache_update |
136 | gnome2_icon_cache_update |
| 150 | } |
137 | } |
| 151 | |
138 | |
| 152 | # @FUNCTION: xfconf_pkg_postrm |
139 | # @FUNCTION: xfconf_pkg_postrm |
| 153 | # @DESCRIPTION: |
140 | # @DESCRIPTION: |
| 154 | # Run fdo-mime_{desktop,mime}_database_update and gnome2_icon_cache_update |
141 | # Run fdo-mime_{desktop,mime}_database_update and gnome2_icon_cache_update |
| 155 | xfconf_pkg_postrm() { |
142 | xfconf_pkg_postrm() { |
|
|
143 | debug-print-function ${FUNCNAME} "$@" |
| 156 | fdo-mime_desktop_database_update |
144 | fdo-mime_desktop_database_update |
| 157 | fdo-mime_mime_database_update |
145 | fdo-mime_mime_database_update |
| 158 | gnome2_icon_cache_update |
146 | gnome2_icon_cache_update |
| 159 | } |
147 | } |