/[gentoo-x86]/eclass/autotools-utils.eclass
Gentoo

Diff of /eclass/autotools-utils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.26 Revision 1.29
1# Copyright 1999-2011 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/autotools-utils.eclass,v 1.26 2011/11/26 20:42:02 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.29 2011/11/27 09:57:20 mgorny Exp $
4 4
5# @ECLASS: autotools-utils.eclass 5# @ECLASS: autotools-utils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Maciej Mrozowski <reavertm@gentoo.org> 7# Maciej Mrozowski <reavertm@gentoo.org>
8# Michał Górny <mgorny@gentoo.org> 8# Michał Górny <mgorny@gentoo.org>
9# @BLURB: common ebuild functions for autotools-based packages 9# @BLURB: common ebuild functions for autotools-based packages
10# @DESCRIPTION: 10# @DESCRIPTION:
11# autotools-utils.eclass is autotools.eclass(5) and base.eclass(5) wrapper 11# autotools-utils.eclass is autotools.eclass(5) and base.eclass(5) wrapper
12# providing all inherited features along with econf arguments as Bash array, 12# providing all inherited features along with econf arguments as Bash array,
13# out of source build with overridable build dir location, static archives 13# out of source build with overridable build dir location, static archives
14# handling, libtool files removal, enable/disable debug handling. 14# handling, libtool files removal.
15#
16# Please note note that autotools-utils does not support mixing of its phase
17# functions with regular econf/emake calls. If necessary, please call
18# autotools-utils_src_compile instead of the latter.
15# 19#
16# @EXAMPLE: 20# @EXAMPLE:
17# Typical ebuild using autotools-utils.eclass: 21# Typical ebuild using autotools-utils.eclass:
18# 22#
19# @CODE 23# @CODE
199 if [[ ${removing} ]]; then 203 if [[ ${removing} ]]; then
200 einfo "Removing unnecessary ${f#${D%/}} (${removing})" 204 einfo "Removing unnecessary ${f#${D%/}} (${removing})"
201 rm -f "${f}" || die 205 rm -f "${f}" || die
202 fi 206 fi
203 done 207 done
208
209 # check for invalid eclass use
210 # this is the most commonly used function, so do it here
211 _check_build_dir
212 if [[ ! -d "${AUTOTOOLS_BUILD_DIR}" ]]; then
213 eqawarn "autotools-utils used but autotools-utils_src_configure was never called."
214 eqawarn "This is not supported and never was. Please report a bug against"
215 eqawarn "the offending ebuild. This will become a fatal error in a near future."
216 fi
204} 217}
205 218
206# @FUNCTION: autotools-utils_src_prepare 219# @FUNCTION: autotools-utils_src_prepare
207# @DESCRIPTION: 220# @DESCRIPTION:
208# The src_prepare function. 221# The src_prepare function.
230 [[ -z ${myeconfargs+1} || $(declare -p myeconfargs) == 'declare -a'* ]] \ 243 [[ -z ${myeconfargs+1} || $(declare -p myeconfargs) == 'declare -a'* ]] \
231 || die 'autotools-utils.eclass: myeconfargs has to be an array.' 244 || die 'autotools-utils.eclass: myeconfargs has to be an array.'
232 245
233 # Common args 246 # Common args
234 local econfargs=() 247 local econfargs=()
235
236 # Handle debug found in IUSE
237 if in_iuse debug; then
238 local debugarg=$(use_enable debug)
239 if ! has "${debugarg}" "${myeconfargs[@]}"; then
240 eqawarn 'Implicit $(use_enable debug) for IUSE="debug" is no longer supported.'
241 eqawarn 'Please add the necessary arg to myeconfargs if requested.'
242 eqawarn 'The autotools-utils eclass will stop warning about it on Oct 15th.'
243 fi
244 fi
245 248
246 # Handle static-libs found in IUSE, disable them by default 249 # Handle static-libs found in IUSE, disable them by default
247 if in_iuse static-libs; then 250 if in_iuse static-libs; then
248 econfargs+=( 251 econfargs+=(
249 --enable-shared 252 --enable-shared
254 # Append user args 257 # Append user args
255 econfargs+=("${myeconfargs[@]}") 258 econfargs+=("${myeconfargs[@]}")
256 259
257 _check_build_dir 260 _check_build_dir
258 mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" 261 mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed"
259 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 262 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
260 base_src_configure "${econfargs[@]}" "$@" 263 base_src_configure "${econfargs[@]}" "$@"
261 popd > /dev/null || die 264 popd > /dev/null
262} 265}
263 266
264# @FUNCTION: autotools-utils_src_compile 267# @FUNCTION: autotools-utils_src_compile
265# @DESCRIPTION: 268# @DESCRIPTION:
266# The autotools src_compile function, invokes emake in specified AUTOTOOLS_BUILD_DIR. 269# The autotools src_compile function, invokes emake in specified AUTOTOOLS_BUILD_DIR.
267autotools-utils_src_compile() { 270autotools-utils_src_compile() {
268 debug-print-function ${FUNCNAME} "$@" 271 debug-print-function ${FUNCNAME} "$@"
269 272
270 _check_build_dir 273 _check_build_dir
271 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 274 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
272 base_src_compile "$@" 275 base_src_compile "$@"
273 popd > /dev/null || die 276 popd > /dev/null
274} 277}
275 278
276# @FUNCTION: autotools-utils_src_install 279# @FUNCTION: autotools-utils_src_install
277# @DESCRIPTION: 280# @DESCRIPTION:
278# The autotools src_install function. Runs emake install, unconditionally 281# The autotools src_install function. Runs emake install, unconditionally
283# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference. 286# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference.
284autotools-utils_src_install() { 287autotools-utils_src_install() {
285 debug-print-function ${FUNCNAME} "$@" 288 debug-print-function ${FUNCNAME} "$@"
286 289
287 _check_build_dir 290 _check_build_dir
288 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 291 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
289 base_src_install "$@" 292 base_src_install "$@"
290 popd > /dev/null || die 293 popd > /dev/null
291 294
292 # Remove libtool files and unnecessary static libs 295 # Remove libtool files and unnecessary static libs
293 remove_libtool_files 296 remove_libtool_files
294} 297}
295 298
298# The autotools src_test function. Runs emake check in build directory. 301# The autotools src_test function. Runs emake check in build directory.
299autotools-utils_src_test() { 302autotools-utils_src_test() {
300 debug-print-function ${FUNCNAME} "$@" 303 debug-print-function ${FUNCNAME} "$@"
301 304
302 _check_build_dir 305 _check_build_dir
303 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 306 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
304 # Run default src_test as defined in ebuild.sh 307 # Run default src_test as defined in ebuild.sh
305 default_src_test 308 default_src_test
306 popd > /dev/null || die 309 popd > /dev/null
307} 310}

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.29

  ViewVC Help
Powered by ViewVC 1.1.20