/[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.56 Revision 1.68
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 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.56 2012/06/08 17:50:10 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.68 2013/05/05 20:22:25 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>
35# IUSE="debug doc examples qt4 static-libs tiff" 35# IUSE="debug doc examples qt4 static-libs tiff"
36# 36#
37# CDEPEND=" 37# CDEPEND="
38# media-libs/libpng:0 38# media-libs/libpng:0
39# qt4? ( 39# qt4? (
40# x11-libs/qt-core:4 40# dev-qt/qtcore:4
41# x11-libs/qt-gui:4 41# dev-qt/qtgui:4
42# ) 42# )
43# tiff? ( media-libs/tiff:0 ) 43# tiff? ( media-libs/tiff:0 )
44# " 44# "
45# RDEPEND="${CDEPEND} 45# RDEPEND="${CDEPEND}
46# !media-gfx/bar 46# !media-gfx/bar
74# autotools-utils_src_compile 74# autotools-utils_src_compile
75# use doc && autotools-utils_src_compile docs 75# use doc && autotools-utils_src_compile docs
76# } 76# }
77# 77#
78# src_install() { 78# src_install() {
79# use doc && HTML_DOCS=("${AUTOTOOLS_BUILD_DIR}/apidocs/html/") 79# use doc && HTML_DOCS=("${BUILD_DIR}/apidocs/html/")
80# autotools-utils_src_install 80# autotools-utils_src_install
81# if use examples; then 81# if use examples; then
82# dobin "${AUTOTOOLS_BUILD_DIR}"/foo_example{1,2,3} \\ 82# dobin "${BUILD_DIR}"/foo_example{1,2,3} \\
83# || die 'dobin examples failed' 83# || die 'dobin examples failed'
84# fi 84# fi
85# } 85# }
86# 86#
87# @CODE 87# @CODE
88 88
89# Keep variable names synced with cmake-utils and the other way around! 89# Keep variable names synced with cmake-utils and the other way around!
90 90
91case ${EAPI:-0} in 91case ${EAPI:-0} in
92 2|3|4) ;; 92 2|3|4|5) ;;
93 *) die "EAPI=${EAPI} is not supported" ;; 93 *) die "EAPI=${EAPI} is not supported" ;;
94esac 94esac
95 95
96# @ECLASS-VARIABLE: AUTOTOOLS_AUTORECONF 96# @ECLASS-VARIABLE: AUTOTOOLS_AUTORECONF
97# @DEFAULT_UNSET 97# @DEFAULT_UNSET
115 115
116inherit autotools eutils libtool 116inherit autotools eutils libtool
117 117
118EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test 118EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test
119 119
120# @ECLASS-VARIABLE: AUTOTOOLS_BUILD_DIR 120# @ECLASS-VARIABLE: BUILD_DIR
121# @DEFAULT_UNSET 121# @DEFAULT_UNSET
122# @DESCRIPTION: 122# @DESCRIPTION:
123# Build directory, location where all autotools generated files should be 123# Build directory, location where all autotools generated files should be
124# placed. For out of source builds it defaults to ${WORKDIR}/${P}_build. 124# placed. For out of source builds it defaults to ${WORKDIR}/${P}_build.
125#
126# This variable has been called AUTOTOOLS_BUILD_DIR formerly.
127# It is set under that name for compatibility.
125 128
126# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD 129# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD
127# @DEFAULT_UNSET 130# @DEFAULT_UNSET
128# @DESCRIPTION: 131# @DESCRIPTION:
129# Set to enable in-source build. 132# Set to enable in-source build.
152# @ECLASS-VARIABLE: DOCS 155# @ECLASS-VARIABLE: DOCS
153# @DEFAULT_UNSET 156# @DEFAULT_UNSET
154# @DESCRIPTION: 157# @DESCRIPTION:
155# Array containing documents passed to dodoc command. 158# Array containing documents passed to dodoc command.
156# 159#
160# In EAPIs 4+, can list directories as well.
161#
157# Example: 162# Example:
158# @CODE 163# @CODE
159# DOCS=( NEWS README ) 164# DOCS=( NEWS README )
160# @CODE 165# @CODE
161 166
176# 181#
177# Example: 182# Example:
178# @CODE 183# @CODE
179# PATCHES=( "${FILESDIR}"/${P}-mypatch.patch ) 184# PATCHES=( "${FILESDIR}"/${P}-mypatch.patch )
180# @CODE 185# @CODE
186
187# @ECLASS-VARIABLE: AUTOTOOLS_PRUNE_LIBTOOL_FILES
188# @DEFAULT_UNSET
189# @DESCRIPTION:
190# Sets the mode of pruning libtool files. The values correspond to
191# prune_libtool_files parameters, with leading dashes stripped.
192#
193# Defaults to pruning the libtool files when static libraries are not
194# installed or can be linked properly without them. Libtool files
195# for modules (plugins) will be kept in case plugin loader needs them.
196#
197# If set to 'modules', the .la files for modules will be removed
198# as well. This is often the preferred option.
199#
200# If set to 'all', all .la files will be removed unconditionally. This
201# option is discouraged and shall be used only if 'modules' does not
202# remove the files.
203#
204# If set to 'none', no .la files will be pruned ever. Use in corner
205# cases only.
181 206
182# Determine using IN or OUT source build 207# Determine using IN or OUT source build
183_check_build_dir() { 208_check_build_dir() {
184 : ${ECONF_SOURCE:=${S}} 209 : ${ECONF_SOURCE:=${S}}
185 if [[ -n ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then 210 if [[ -n ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
186 AUTOTOOLS_BUILD_DIR="${ECONF_SOURCE}" 211 BUILD_DIR="${ECONF_SOURCE}"
187 else 212 else
213 # Respect both the old variable and the new one, depending
214 # on which one was set by the ebuild.
215 if [[ ! ${BUILD_DIR} && ${AUTOTOOLS_BUILD_DIR} ]]; then
216 eqawarn "The AUTOTOOLS_BUILD_DIR variable has been renamed to BUILD_DIR."
217 eqawarn "Please migrate the ebuild to use the new one."
218
219 # In the next call, both variables will be set already
220 # and we'd have to know which one takes precedence.
221 _RESPECT_AUTOTOOLS_BUILD_DIR=1
222 fi
223
224 if [[ ${_RESPECT_AUTOTOOLS_BUILD_DIR} ]]; then
225 BUILD_DIR=${AUTOTOOLS_BUILD_DIR:-${WORKDIR}/${P}_build}
226 else
188 : ${AUTOTOOLS_BUILD_DIR:=${WORKDIR}/${P}_build} 227 : ${BUILD_DIR:=${WORKDIR}/${P}_build}
189 fi 228 fi
229 fi
230
231 # Backwards compatibility for getting the value.
232 AUTOTOOLS_BUILD_DIR=${BUILD_DIR}
190 echo ">>> Working in BUILD_DIR: \"$AUTOTOOLS_BUILD_DIR\"" 233 echo ">>> Working in BUILD_DIR: \"${BUILD_DIR}\""
191} 234}
192 235
193# @FUNCTION: remove_libtool_files 236# @FUNCTION: remove_libtool_files
194# @USAGE: [all] 237# @USAGE: [all]
195# @DESCRIPTION: 238# @DESCRIPTION:
411 fi 454 fi
412 455
413 # Append user args 456 # Append user args
414 econfargs+=("${myeconfargs[@]}") 457 econfargs+=("${myeconfargs[@]}")
415 458
416 mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" 459 mkdir -p "${BUILD_DIR}" || die
417 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 460 pushd "${BUILD_DIR}" > /dev/null || die
418 econf "${econfargs[@]}" "$@" 461 econf "${econfargs[@]}" "$@"
419 popd > /dev/null || die 462 popd > /dev/null || die
420} 463}
421 464
422# @FUNCTION: autotools-utils_src_compile 465# @FUNCTION: autotools-utils_src_compile
423# @DESCRIPTION: 466# @DESCRIPTION:
424# The autotools src_compile function, invokes emake in specified AUTOTOOLS_BUILD_DIR. 467# The autotools src_compile function, invokes emake in specified BUILD_DIR.
425autotools-utils_src_compile() { 468autotools-utils_src_compile() {
426 debug-print-function ${FUNCNAME} "$@" 469 debug-print-function ${FUNCNAME} "$@"
427 470
428 _check_build_dir 471 _check_build_dir
429 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 472 pushd "${BUILD_DIR}" > /dev/null || die
430 emake "$@" || die 'emake failed' 473 emake "$@" || die 'emake failed'
431 popd > /dev/null || die 474 popd > /dev/null || die
432} 475}
433 476
434# @FUNCTION: autotools-utils_src_install 477# @FUNCTION: autotools-utils_src_install
441# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference. 484# DOCS and HTML_DOCS arrays are supported. See base.eclass(5) for reference.
442autotools-utils_src_install() { 485autotools-utils_src_install() {
443 debug-print-function ${FUNCNAME} "$@" 486 debug-print-function ${FUNCNAME} "$@"
444 487
445 _check_build_dir 488 _check_build_dir
446 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 489 pushd "${BUILD_DIR}" > /dev/null || die
447 emake DESTDIR="${D}" "$@" install || die "emake install failed" 490 emake DESTDIR="${D}" "$@" install || die "emake install failed"
448 popd > /dev/null || die 491 popd > /dev/null || die
449 492
450 # Move docs installed by autotools (in EAPI < 4). 493 # Move docs installed by autotools (in EAPI < 4).
451 if [[ ${EAPI} == [23] ]] \ 494 if [[ ${EAPI} == [23] ]] \
461 rm -r "${T}"/temp-docdir || die 504 rm -r "${T}"/temp-docdir || die
462 fi 505 fi
463 fi 506 fi
464 507
465 # XXX: support installing them from builddir as well? 508 # XXX: support installing them from builddir as well?
509 if declare -p DOCS &>/dev/null; then
510 # an empty list == don't install anything
466 if [[ ${DOCS} ]]; then 511 if [[ ${DOCS[@]} ]]; then
512 if [[ ${EAPI} == [23] ]]; then
467 dodoc "${DOCS[@]}" || die "dodoc failed" 513 dodoc "${DOCS[@]}" || die
514 else
515 # dies by itself
516 dodoc -r "${DOCS[@]}"
517 fi
518 fi
468 else 519 else
469 local f 520 local f
470 # same list as in PMS 521 # same list as in PMS
471 for f in README* ChangeLog AUTHORS NEWS TODO CHANGES \ 522 for f in README* ChangeLog AUTHORS NEWS TODO CHANGES \
472 THANKS BUGS FAQ CREDITS CHANGELOG; do 523 THANKS BUGS FAQ CREDITS CHANGELOG; do
478 if [[ ${HTML_DOCS} ]]; then 529 if [[ ${HTML_DOCS} ]]; then
479 dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed" 530 dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed"
480 fi 531 fi
481 532
482 # Remove libtool files and unnecessary static libs 533 # Remove libtool files and unnecessary static libs
483 prune_libtool_files 534 local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES}
535 if [[ ${prune_ltfiles} != none ]]; then
536 prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}}
537 fi
484} 538}
485 539
486# @FUNCTION: autotools-utils_src_test 540# @FUNCTION: autotools-utils_src_test
487# @DESCRIPTION: 541# @DESCRIPTION:
488# The autotools src_test function. Runs emake check in build directory. 542# The autotools src_test function. Runs emake check in build directory.
489autotools-utils_src_test() { 543autotools-utils_src_test() {
490 debug-print-function ${FUNCNAME} "$@" 544 debug-print-function ${FUNCNAME} "$@"
491 545
492 _check_build_dir 546 _check_build_dir
493 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null || die 547 pushd "${BUILD_DIR}" > /dev/null || die
494 # Run default src_test as defined in ebuild.sh 548
495 default_src_test 549 if make -n check &>/dev/null; then
550 emake check "${@}" || die 'emake check failed.'
551 elif make -n test &>/dev/null; then
552 emake test "${@}" || die 'emake test failed.'
553 fi
554
496 popd > /dev/null || die 555 popd > /dev/null || die
497} 556}

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.68

  ViewVC Help
Powered by ViewVC 1.1.20