| 1 | # Copyright 1999-2008 Gentoo Foundation |
1 | # Copyright 1999-2011 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/base.eclass,v 1.49 2010/02/02 10:20:25 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.56 2012/02/06 21:33:59 vapier Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: base.eclass |
5 | # @ECLASS: base.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # QA Team <qa@gentoo.org> |
7 | # QA Team <qa@gentoo.org> |
| 8 | # |
8 | # @AUTHOR: |
| 9 | # Original author Dan Armak <danarmak@gentoo.org> |
9 | # Original author: Dan Armak <danarmak@gentoo.org> |
| 10 | # @BLURB: The base eclass defines some default functions and variables. |
10 | # @BLURB: The base eclass defines some default functions and variables. |
| 11 | # @DESCRIPTION: |
11 | # @DESCRIPTION: |
| 12 | # The base eclass defines some default functions and variables. Nearly |
12 | # The base eclass defines some default functions and variables. Nearly |
| 13 | # everything else inherits from here. |
13 | # everything else inherits from here. |
|
|
14 | |
|
|
15 | if [[ ${___ECLASS_ONCE_BASE} != "recur -_+^+_- spank" ]] ; then |
|
|
16 | ___ECLASS_ONCE_BASE="recur -_+^+_- spank" |
| 14 | |
17 | |
| 15 | inherit eutils |
18 | inherit eutils |
| 16 | |
19 | |
| 17 | BASE_EXPF="src_unpack src_compile src_install" |
20 | BASE_EXPF="src_unpack src_compile src_install" |
| 18 | case "${EAPI:-0}" in |
21 | case "${EAPI:-0}" in |
| … | |
… | |
| 54 | base_src_unpack() { |
57 | base_src_unpack() { |
| 55 | debug-print-function $FUNCNAME "$@" |
58 | debug-print-function $FUNCNAME "$@" |
| 56 | |
59 | |
| 57 | pushd "${WORKDIR}" > /dev/null |
60 | pushd "${WORKDIR}" > /dev/null |
| 58 | |
61 | |
| 59 | [[ -n "${A}" ]] && unpack ${A} |
62 | if [[ $(type -t unpacker_src_unpack) == "function" ]] ; then |
|
|
63 | unpacker_src_unpack |
|
|
64 | elif [[ -n ${A} ]] ; then |
|
|
65 | unpack ${A} |
|
|
66 | fi |
| 60 | has src_prepare ${BASE_EXPF} || base_src_prepare |
67 | has src_prepare ${BASE_EXPF} || base_src_prepare |
| 61 | |
68 | |
| 62 | popd > /dev/null |
69 | popd > /dev/null |
| 63 | } |
70 | } |
| 64 | |
71 | |
| 65 | # @FUNCTION: base_src_prepare |
72 | # @FUNCTION: base_src_prepare |
| 66 | # @DESCRIPTION: |
73 | # @DESCRIPTION: |
| 67 | # The base src_prepare function, which is exported |
74 | # The base src_prepare function, which is exported |
| 68 | # EAPI is greater or equal to 2. |
75 | # EAPI is greater or equal to 2. Here the PATCHES array is evaluated. |
| 69 | base_src_prepare() { |
76 | base_src_prepare() { |
| 70 | debug-print-function $FUNCNAME "$@" |
77 | debug-print-function $FUNCNAME "$@" |
| 71 | debug-print "$FUNCNAME: PATCHES=$PATCHES" |
78 | debug-print "$FUNCNAME: PATCHES=$PATCHES" |
| 72 | |
79 | |
| 73 | local patches_failed=0 |
80 | local patches_failed=0 |
| … | |
… | |
| 85 | # in order to preserve normal EPATCH_SOURCE value that can |
92 | # in order to preserve normal EPATCH_SOURCE value that can |
| 86 | # be used other way than with base eclass store in local |
93 | # be used other way than with base eclass store in local |
| 87 | # variable and restore later |
94 | # variable and restore later |
| 88 | oldval=${EPATCH_SOURCE} |
95 | oldval=${EPATCH_SOURCE} |
| 89 | EPATCH_SOURCE=${x} |
96 | EPATCH_SOURCE=${x} |
|
|
97 | EPATCH_FORCE=yes |
| 90 | epatch |
98 | epatch |
| 91 | EPATCH_SOURCE=${oldval} |
99 | EPATCH_SOURCE=${oldval} |
| 92 | elif [[ -f "${x}" ]]; then |
100 | elif [[ -f "${x}" ]]; then |
| 93 | epatch "${x}" |
101 | epatch "${x}" |
| 94 | else |
102 | else |
| … | |
… | |
| 113 | } |
121 | } |
| 114 | |
122 | |
| 115 | # @FUNCTION: base_src_configure |
123 | # @FUNCTION: base_src_configure |
| 116 | # @DESCRIPTION: |
124 | # @DESCRIPTION: |
| 117 | # The base src_configure function, which is exported when |
125 | # The base src_configure function, which is exported when |
| 118 | # EAPI is greater or equal to 2. Runs basic econf. Here the PATCHES array is |
126 | # EAPI is greater or equal to 2. Runs basic econf. |
| 119 | # evaluated. |
|
|
| 120 | base_src_configure() { |
127 | base_src_configure() { |
| 121 | debug-print-function $FUNCNAME "$@" |
128 | debug-print-function $FUNCNAME "$@" |
| 122 | |
129 | |
| 123 | # there is no pushd ${S} so we can override its place where to run |
130 | # there is no pushd ${S} so we can override its place where to run |
| 124 | [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf |
131 | [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "$@" |
| 125 | } |
132 | } |
| 126 | |
133 | |
| 127 | # @FUNCTION: base_src_compile |
134 | # @FUNCTION: base_src_compile |
| 128 | # @DESCRIPTION: |
135 | # @DESCRIPTION: |
| 129 | # The base src_compile function, calls src_configure with |
136 | # The base src_compile function, calls src_configure with |
| 130 | # EAPI older than 2. |
137 | # EAPI older than 2. |
| 131 | base_src_compile() { |
138 | base_src_compile() { |
| 132 | debug-print-function $FUNCNAME "$@" |
139 | debug-print-function $FUNCNAME "$@" |
| 133 | |
140 | |
| 134 | has src_configure ${BASE_EXPF} || base_src_configure |
141 | has src_configure ${BASE_EXPF} || base_src_configure |
| 135 | base_src_make $@ |
142 | base_src_make "$@" |
| 136 | } |
143 | } |
| 137 | |
144 | |
| 138 | # @FUNCTION: base_src_make |
145 | # @FUNCTION: base_src_make |
| 139 | # @DESCRIPTION: |
146 | # @DESCRIPTION: |
| 140 | # Actual function that runs emake command. |
147 | # Actual function that runs emake command. |
| 141 | base_src_make() { |
148 | base_src_make() { |
| 142 | debug-print-function $FUNCNAME "$@" |
149 | debug-print-function $FUNCNAME "$@" |
| 143 | |
150 | |
| 144 | if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then |
151 | if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then |
| 145 | emake $@ || die "died running emake, $FUNCNAME:make" |
152 | emake "$@" || die "died running emake, $FUNCNAME" |
| 146 | fi |
153 | fi |
| 147 | } |
154 | } |
| 148 | |
155 | |
| 149 | # @FUNCTION: base_src_install |
156 | # @FUNCTION: base_src_install |
| 150 | # @DESCRIPTION: |
157 | # @DESCRIPTION: |
| … | |
… | |
| 152 | # installs documents and html documents from DOCS and HTML_DOCS |
159 | # installs documents and html documents from DOCS and HTML_DOCS |
| 153 | # arrays. |
160 | # arrays. |
| 154 | base_src_install() { |
161 | base_src_install() { |
| 155 | debug-print-function $FUNCNAME "$@" |
162 | debug-print-function $FUNCNAME "$@" |
| 156 | |
163 | |
| 157 | emake DESTDIR="${D}" $@ install || die "died running make install, $FUNCNAME:make" |
164 | emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME" |
| 158 | base_src_install_docs |
165 | base_src_install_docs |
| 159 | } |
166 | } |
| 160 | |
167 | |
| 161 | # @FUNCTION: base_src_install_docs |
168 | # @FUNCTION: base_src_install_docs |
| 162 | # @DESCRIPTION: |
169 | # @DESCRIPTION: |
| … | |
… | |
| 182 | done |
189 | done |
| 183 | fi |
190 | fi |
| 184 | |
191 | |
| 185 | popd > /dev/null |
192 | popd > /dev/null |
| 186 | } |
193 | } |
|
|
194 | |
|
|
195 | fi |