/[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.23 Revision 1.31
1# Copyright 1999-2010 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.23 2011/09/18 21:03:59 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.31 2011/12/22 18:01:12 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
87case ${EAPI:-0} in 91case ${EAPI:-0} in
88 2|3|4) ;; 92 2|3|4) ;;
89 *) die "EAPI=${EAPI} is not supported" ;; 93 *) die "EAPI=${EAPI} is not supported" ;;
90esac 94esac
91 95
92inherit autotools base eutils 96inherit autotools eutils libtool
93 97
94EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test 98EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test
95 99
96# @ECLASS-VARIABLE: AUTOTOOLS_BUILD_DIR 100# @ECLASS-VARIABLE: AUTOTOOLS_BUILD_DIR
101# @DEFAULT_UNSET
97# @DESCRIPTION: 102# @DESCRIPTION:
98# Build directory, location where all autotools generated files should be 103# Build directory, location where all autotools generated files should be
99# placed. For out of source builds it defaults to ${WORKDIR}/${P}_build. 104# placed. For out of source builds it defaults to ${WORKDIR}/${P}_build.
100 105
101# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD 106# @ECLASS-VARIABLE: AUTOTOOLS_IN_SOURCE_BUILD
107# @DEFAULT_UNSET
102# @DESCRIPTION: 108# @DESCRIPTION:
103# Set to enable in-source build. 109# Set to enable in-source build.
104 110
105# @ECLASS-VARIABLE: ECONF_SOURCE 111# @ECLASS-VARIABLE: ECONF_SOURCE
112# @DEFAULT_UNSET
106# @DESCRIPTION: 113# @DESCRIPTION:
107# Specify location of autotools' configure script. By default it uses ${S}. 114# Specify location of autotools' configure script. By default it uses ${S}.
108 115
109# @ECLASS-VARIABLE: myeconfargs 116# @ECLASS-VARIABLE: myeconfargs
117# @DEFAULT_UNSET
110# @DESCRIPTION: 118# @DESCRIPTION:
111# Optional econf arguments as Bash array. Should be defined before calling src_configure. 119# Optional econf arguments as Bash array. Should be defined before calling src_configure.
112# @CODE 120# @CODE
113# src_configure() { 121# src_configure() {
114# local myeconfargs=( 122# local myeconfargs=(
117# $(use_enable debug cnddebug) 125# $(use_enable debug cnddebug)
118# $(use_enable threads multithreading) 126# $(use_enable threads multithreading)
119# ) 127# )
120# autotools-utils_src_configure 128# autotools-utils_src_configure
121# } 129# }
130# @CODE
131
132# @ECLASS-VARIABLE: DOCS
133# @DEFAULT_UNSET
134# @DESCRIPTION:
135# Array containing documents passed to dodoc command.
136#
137# Example:
138# @CODE
139# DOCS=( NEWS README )
140# @CODE
141
142# @ECLASS-VARIABLE: HTML_DOCS
143# @DEFAULT_UNSET
144# @DESCRIPTION:
145# Array containing documents passed to dohtml command.
146#
147# Example:
148# @CODE
149# HTML_DOCS=( doc/html/ )
150# @CODE
151
152# @ECLASS-VARIABLE: PATCHES
153# @DEFAULT_UNSET
154# @DESCRIPTION:
155# PATCHES array variable containing all various patches to be applied.
156#
157# Example:
158# @CODE
159# PATCHES=( "${FILESDIR}"/${P}-mypatch.patch )
122# @CODE 160# @CODE
123 161
124# Determine using IN or OUT source build 162# Determine using IN or OUT source build
125_check_build_dir() { 163_check_build_dir() {
126 : ${ECONF_SOURCE:=${S}} 164 : ${ECONF_SOURCE:=${S}}
199 if [[ ${removing} ]]; then 237 if [[ ${removing} ]]; then
200 einfo "Removing unnecessary ${f#${D%/}} (${removing})" 238 einfo "Removing unnecessary ${f#${D%/}} (${removing})"
201 rm -f "${f}" || die 239 rm -f "${f}" || die
202 fi 240 fi
203 done 241 done
242
243 # check for invalid eclass use
244 # this is the most commonly used function, so do it here
245 _check_build_dir
246 if [[ ! -d "${AUTOTOOLS_BUILD_DIR}" ]]; then
247 eqawarn "autotools-utils used but autotools-utils_src_configure was never called."
248 eqawarn "This is not supported and never was. Please report a bug against"
249 eqawarn "the offending ebuild. This will become a fatal error in a near future."
250 fi
204} 251}
205 252
206# @FUNCTION: autotools-utils_src_prepare 253# @FUNCTION: autotools-utils_src_prepare
207# @DESCRIPTION: 254# @DESCRIPTION:
208# The src_prepare function. 255# The src_prepare function.
209# 256#
210# Supporting PATCHES array and user patches. See base.eclass(5) for reference. 257# Supporting PATCHES array and user patches. See base.eclass(5) for reference.
258#
259# This function calls elibtoolize implicitly. If you need to call eautoreconf
260# afterwards, please use AT_NOELIBTOOLIZE=yes to avoid it being called twice.
211autotools-utils_src_prepare() { 261autotools-utils_src_prepare() {
212 debug-print-function ${FUNCNAME} "$@" 262 debug-print-function ${FUNCNAME} "$@"
213 263
214 base_src_prepare 264 [[ ${PATCHES} ]] && epatch "${PATCHES[@]}"
265 epatch_user
266
267 elibtoolize --patch-only
215} 268}
216 269
217# @FUNCTION: autotools-utils_src_configure 270# @FUNCTION: autotools-utils_src_configure
218# @DESCRIPTION: 271# @DESCRIPTION:
219# The src_configure function. For out of source build it creates build 272# The src_configure function. For out of source build it creates build
230 || die 'autotools-utils.eclass: myeconfargs has to be an array.' 283 || die 'autotools-utils.eclass: myeconfargs has to be an array.'
231 284
232 # Common args 285 # Common args
233 local econfargs=() 286 local econfargs=()
234 287
235 # Handle debug found in IUSE
236 if has debug ${IUSE//+}; then
237 local debugarg=$(use_enable debug)
238 if ! has "${debugarg}" "${myeconfargs[@]}"; then
239 eqawarn 'Implicit $(use_enable debug) for IUSE="debug" is no longer supported.'
240 eqawarn 'Please add the necessary arg to myeconfargs if requested.'
241 eqawarn 'The autotools-utils eclass will stop warning about it on Oct 15th.'
242 fi
243 fi
244
245 # Handle static-libs found in IUSE, disable them by default 288 # Handle static-libs found in IUSE, disable them by default
246 if has static-libs ${IUSE//+}; then 289 if in_iuse static-libs; then
247 econfargs+=( 290 econfargs+=(
248 --enable-shared 291 --enable-shared
249 $(use_enable static-libs static) 292 $(use_enable static-libs static)
250 ) 293 )
251 fi 294 fi
254 econfargs+=("${myeconfargs[@]}") 297 econfargs+=("${myeconfargs[@]}")
255 298
256 _check_build_dir 299 _check_build_dir
257 mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" 300 mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed"
258 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null 301 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
259 base_src_configure "${econfargs[@]}" "$@" 302 econf "${econfargs[@]}" "$@"
260 popd > /dev/null 303 popd > /dev/null
261} 304}
262 305
263# @FUNCTION: autotools-utils_src_compile 306# @FUNCTION: autotools-utils_src_compile
264# @DESCRIPTION: 307# @DESCRIPTION:
266autotools-utils_src_compile() { 309autotools-utils_src_compile() {
267 debug-print-function ${FUNCNAME} "$@" 310 debug-print-function ${FUNCNAME} "$@"
268 311
269 _check_build_dir 312 _check_build_dir
270 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null 313 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
271 base_src_compile "$@" 314 emake "$@" || die 'emake failed'
272 popd > /dev/null 315 popd > /dev/null
273} 316}
274 317
275# @FUNCTION: autotools-utils_src_install 318# @FUNCTION: autotools-utils_src_install
276# @DESCRIPTION: 319# @DESCRIPTION:
283autotools-utils_src_install() { 326autotools-utils_src_install() {
284 debug-print-function ${FUNCNAME} "$@" 327 debug-print-function ${FUNCNAME} "$@"
285 328
286 _check_build_dir 329 _check_build_dir
287 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null 330 pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null
288 base_src_install "$@" 331 emake DESTDIR="${D}" "$@" install || die "emake install failed"
289 popd > /dev/null 332 popd > /dev/null
333
334 # XXX: support installing them from builddir as well?
335 if [[ ${DOCS} ]]; then
336 dodoc "${DOCS[@]}" || die "dodoc failed"
337 fi
338 if [[ ${HTML_DOCS} ]]; then
339 dohtml -r "${HTML_DOCS[@]}" || die "dohtml failed"
340 fi
290 341
291 # Remove libtool files and unnecessary static libs 342 # Remove libtool files and unnecessary static libs
292 remove_libtool_files 343 remove_libtool_files
293} 344}
294 345

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.31

  ViewVC Help
Powered by ViewVC 1.1.20