| 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.48 2010/01/24 13:43:26 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/base.eclass,v 1.55 2011/12/14 23:38:09 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 |
| … | |
… | |
| 63 | } |
66 | } |
| 64 | |
67 | |
| 65 | # @FUNCTION: base_src_prepare |
68 | # @FUNCTION: base_src_prepare |
| 66 | # @DESCRIPTION: |
69 | # @DESCRIPTION: |
| 67 | # The base src_prepare function, which is exported |
70 | # The base src_prepare function, which is exported |
| 68 | # EAPI is greater or equal to 2. |
71 | # EAPI is greater or equal to 2. Here the PATCHES array is evaluated. |
| 69 | base_src_prepare() { |
72 | base_src_prepare() { |
| 70 | debug-print-function $FUNCNAME "$@" |
73 | debug-print-function $FUNCNAME "$@" |
| 71 | debug-print "$FUNCNAME: PATCHES=$PATCHES" |
74 | debug-print "$FUNCNAME: PATCHES=$PATCHES" |
| 72 | |
75 | |
| 73 | local patches_failed=0 |
76 | local patches_failed=0 |
| … | |
… | |
| 85 | # in order to preserve normal EPATCH_SOURCE value that can |
88 | # in order to preserve normal EPATCH_SOURCE value that can |
| 86 | # be used other way than with base eclass store in local |
89 | # be used other way than with base eclass store in local |
| 87 | # variable and restore later |
90 | # variable and restore later |
| 88 | oldval=${EPATCH_SOURCE} |
91 | oldval=${EPATCH_SOURCE} |
| 89 | EPATCH_SOURCE=${x} |
92 | EPATCH_SOURCE=${x} |
|
|
93 | EPATCH_FORCE=yes |
| 90 | epatch |
94 | epatch |
| 91 | EPATCH_SOURCE=${oldval} |
95 | EPATCH_SOURCE=${oldval} |
| 92 | elif [[ -f "${x}" ]]; then |
96 | elif [[ -f "${x}" ]]; then |
| 93 | epatch "${x}" |
97 | epatch "${x}" |
| 94 | else |
98 | else |
| … | |
… | |
| 113 | } |
117 | } |
| 114 | |
118 | |
| 115 | # @FUNCTION: base_src_configure |
119 | # @FUNCTION: base_src_configure |
| 116 | # @DESCRIPTION: |
120 | # @DESCRIPTION: |
| 117 | # The base src_configure function, which is exported when |
121 | # 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 |
122 | # EAPI is greater or equal to 2. Runs basic econf. |
| 119 | # evaluated. |
|
|
| 120 | base_src_configure() { |
123 | base_src_configure() { |
| 121 | debug-print-function $FUNCNAME "$@" |
124 | debug-print-function $FUNCNAME "$@" |
| 122 | |
125 | |
| 123 | # there is no pushd ${S} so we can override its place where to run |
126 | # there is no pushd ${S} so we can override its place where to run |
| 124 | [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf |
127 | [[ -x ${ECONF_SOURCE:-.}/configure ]] && econf "$@" |
| 125 | } |
128 | } |
| 126 | |
129 | |
| 127 | # @FUNCTION: base_src_compile |
130 | # @FUNCTION: base_src_compile |
| 128 | # @DESCRIPTION: |
131 | # @DESCRIPTION: |
| 129 | # The base src_compile function, calls src_configure with |
132 | # The base src_compile function, calls src_configure with |
| 130 | # EAPI older than 2. |
133 | # EAPI older than 2. |
| 131 | base_src_compile() { |
134 | base_src_compile() { |
| 132 | debug-print-function $FUNCNAME "$@" |
135 | debug-print-function $FUNCNAME "$@" |
| 133 | |
136 | |
| 134 | has src_configure ${BASE_EXPF} || base_src_configure |
137 | has src_configure ${BASE_EXPF} || base_src_configure |
| 135 | base_src_make $@ |
138 | base_src_make "$@" |
| 136 | } |
139 | } |
| 137 | |
140 | |
| 138 | # @FUNCTION: base_src_make |
141 | # @FUNCTION: base_src_make |
| 139 | # @DESCRIPTION: |
142 | # @DESCRIPTION: |
| 140 | # Actual function that runs emake command. |
143 | # Actual function that runs emake command. |
| 141 | base_src_make() { |
144 | base_src_make() { |
| 142 | debug-print-function $FUNCNAME "$@" |
145 | debug-print-function $FUNCNAME "$@" |
| 143 | |
146 | |
| 144 | if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then |
147 | if [[ -f Makefile || -f GNUmakefile || -f makefile ]]; then |
| 145 | emake $@ || die "died running emake, $FUNCNAME:make" |
148 | emake "$@" || die "died running emake, $FUNCNAME" |
| 146 | fi |
149 | fi |
| 147 | } |
150 | } |
| 148 | |
151 | |
| 149 | # @FUNCTION: base_src_install |
152 | # @FUNCTION: base_src_install |
| 150 | # @DESCRIPTION: |
153 | # @DESCRIPTION: |
| … | |
… | |
| 152 | # installs documents and html documents from DOCS and HTML_DOCS |
155 | # installs documents and html documents from DOCS and HTML_DOCS |
| 153 | # arrays. |
156 | # arrays. |
| 154 | base_src_install() { |
157 | base_src_install() { |
| 155 | debug-print-function $FUNCNAME "$@" |
158 | debug-print-function $FUNCNAME "$@" |
| 156 | |
159 | |
| 157 | emake DESTDIR="${D}" $@ install || die "died running make install, $FUNCNAME:make" |
160 | emake DESTDIR="${D}" "$@" install || die "died running make install, $FUNCNAME" |
| 158 | base_src_install_docs |
161 | base_src_install_docs |
| 159 | } |
162 | } |
| 160 | |
163 | |
| 161 | # @FUNCTION: base_src_install_docs |
164 | # @FUNCTION: base_src_install_docs |
| 162 | # @DESCRIPTION: |
165 | # @DESCRIPTION: |
| … | |
… | |
| 170 | pushd "${S}" > /dev/null |
173 | pushd "${S}" > /dev/null |
| 171 | |
174 | |
| 172 | if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then |
175 | if [[ "$(declare -p DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then |
| 173 | for x in "${DOCS[@]}"; do |
176 | for x in "${DOCS[@]}"; do |
| 174 | debug-print "$FUNCNAME: docs: creating document from ${x}" |
177 | debug-print "$FUNCNAME: docs: creating document from ${x}" |
| 175 | dodoc -r "${x}" || die "dodoc failed" |
178 | dodoc "${x}" || die "dodoc failed" |
| 176 | done |
179 | done |
| 177 | fi |
180 | fi |
| 178 | if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then |
181 | if [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" == "declare -a"* ]]; then |
| 179 | for x in "${HTML_DOCS[@]}"; do |
182 | for x in "${HTML_DOCS[@]}"; do |
| 180 | debug-print "$FUNCNAME: docs: creating html document from ${x}" |
183 | debug-print "$FUNCNAME: docs: creating html document from ${x}" |
| … | |
… | |
| 182 | done |
185 | done |
| 183 | fi |
186 | fi |
| 184 | |
187 | |
| 185 | popd > /dev/null |
188 | popd > /dev/null |
| 186 | } |
189 | } |
|
|
190 | |
|
|
191 | fi |