| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2012 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.38 2012/01/14 15:18:05 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.47 2012/02/02 22:01:13 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> |
| … | |
… | |
| 282 | # Override this func to not require unnecessary eaclocal calls. |
282 | # Override this func to not require unnecessary eaclocal calls. |
| 283 | autotools_check_macro() { |
283 | autotools_check_macro() { |
| 284 | local x |
284 | local x |
| 285 | |
285 | |
| 286 | # Add a few additional variants as we don't get expansions. |
286 | # Add a few additional variants as we don't get expansions. |
| 287 | [[ ${1} = AC_CONFIG_HEADERS ]] && set -- "${@}" AC_CONFIG_HEADER |
287 | [[ ${1} = AC_CONFIG_HEADERS ]] && set -- "${@}" \ |
|
|
288 | AC_CONFIG_HEADER AM_CONFIG_HEADER |
| 288 | |
289 | |
| 289 | for x; do |
290 | for x; do |
| 290 | grep -h "^${x}" configure.{ac,in} 2>/dev/null |
291 | grep -h "^${x}" configure.{ac,in} 2>/dev/null |
| 291 | done |
292 | done |
| 292 | } |
293 | } |
| … | |
… | |
| 303 | # Support running additional tools like gnome-autogen.sh. |
304 | # Support running additional tools like gnome-autogen.sh. |
| 304 | # Note: you need to add additional depends to the ebuild. |
305 | # Note: you need to add additional depends to the ebuild. |
| 305 | |
306 | |
| 306 | # gettext |
307 | # gettext |
| 307 | if [[ $(autotools_check_macro AM_GLIB_GNU_GETTEXT) ]]; then |
308 | if [[ $(autotools_check_macro AM_GLIB_GNU_GETTEXT) ]]; then |
| 308 | echo 'no' | autotools_run_tool glib-gettextize --copy |
309 | echo 'no' | autotools_run_tool glib-gettextize --copy --force |
| 309 | elif [[ $(autotools_check_macro AM_GNU_GETTEXT) ]]; then |
310 | elif [[ $(autotools_check_macro AM_GNU_GETTEXT) ]]; then |
| 310 | eautopoint --force |
311 | eautopoint --force |
| 311 | fi |
312 | fi |
| 312 | |
313 | |
| 313 | # intltool |
314 | # intltool |
| … | |
… | |
| 357 | autotools-utils_src_prepare() { |
358 | autotools-utils_src_prepare() { |
| 358 | debug-print-function ${FUNCNAME} "$@" |
359 | debug-print-function ${FUNCNAME} "$@" |
| 359 | |
360 | |
| 360 | local want_autoreconf=${AUTOTOOLS_AUTORECONF} |
361 | local want_autoreconf=${AUTOTOOLS_AUTORECONF} |
| 361 | |
362 | |
| 362 | touch "${T}"/.autotools-utils.timestamp || die |
|
|
| 363 | [[ ${PATCHES} ]] && epatch "${PATCHES[@]}" |
363 | [[ ${PATCHES} ]] && epatch "${PATCHES[@]}" |
|
|
364 | |
|
|
365 | at_checksum() { |
|
|
366 | find '(' -name 'Makefile.am' \ |
|
|
367 | -o -name 'configure.ac' \ |
|
|
368 | -o -name 'configure.in' ')' \ |
|
|
369 | -exec cksum {} + | sort -k2 |
|
|
370 | } |
|
|
371 | |
|
|
372 | [[ ! ${want_autoreconf} ]] && local checksum=$(at_checksum) |
| 364 | epatch_user |
373 | epatch_user |
| 365 | if [[ ! ${want_autoreconf} ]]; then |
374 | if [[ ! ${want_autoreconf} ]]; then |
| 366 | if [[ $(find . -newer "${T}"/.autotools-utils.timestamp \ |
375 | if [[ ${checksum} != $(at_checksum) ]]; then |
| 367 | -a '(' -name 'Makefile.am' \ |
|
|
| 368 | -o -name 'configure.ac' \ |
|
|
| 369 | -o -name 'configure.in' ')' \ |
|
|
| 370 | -print -quit) ]]; then |
|
|
| 371 | einfo 'Will autoreconfigure due to patches applied.' |
376 | einfo 'Will autoreconfigure due to user patches applied.' |
| 372 | want_autoreconf=yep |
377 | want_autoreconf=yep |
| 373 | fi |
378 | fi |
| 374 | fi |
379 | fi |
| 375 | |
380 | |
| 376 | [[ ${want_autoreconf} ]] && autotools-utils_autoreconf |
381 | [[ ${want_autoreconf} ]] && autotools-utils_autoreconf |
| … | |
… | |
| 393 | || die 'autotools-utils.eclass: myeconfargs has to be an array.' |
398 | || die 'autotools-utils.eclass: myeconfargs has to be an array.' |
| 394 | |
399 | |
| 395 | [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX= |
400 | [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX= |
| 396 | |
401 | |
| 397 | # Common args |
402 | # Common args |
| 398 | local econfargs=( |
403 | local econfargs=() |
|
|
404 | |
|
|
405 | _check_build_dir |
|
|
406 | if "${ECONF_SOURCE}"/configure --help 2>&1 | grep -q '^ *--docdir='; then |
|
|
407 | econfargs+=( |
| 399 | --docdir="${EPREFIX}/usr/share/doc/${PF}" |
408 | --docdir="${EPREFIX}"/usr/share/doc/${PF} |
| 400 | ) |
409 | ) |
|
|
410 | fi |
| 401 | |
411 | |
| 402 | # Handle static-libs found in IUSE, disable them by default |
412 | # Handle static-libs found in IUSE, disable them by default |
| 403 | if in_iuse static-libs; then |
413 | if in_iuse static-libs; then |
| 404 | econfargs+=( |
414 | econfargs+=( |
| 405 | --enable-shared |
415 | --enable-shared |
| … | |
… | |
| 408 | fi |
418 | fi |
| 409 | |
419 | |
| 410 | # Append user args |
420 | # Append user args |
| 411 | econfargs+=("${myeconfargs[@]}") |
421 | econfargs+=("${myeconfargs[@]}") |
| 412 | |
422 | |
| 413 | _check_build_dir |
|
|
| 414 | mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" |
423 | mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" |
| 415 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
424 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
| 416 | econf "${econfargs[@]}" "$@" |
425 | econf "${econfargs[@]}" "$@" |
| 417 | popd > /dev/null |
426 | popd > /dev/null |
| 418 | } |
427 | } |
| … | |
… | |
| 444 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
453 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
| 445 | emake DESTDIR="${D}" "$@" install || die "emake install failed" |
454 | emake DESTDIR="${D}" "$@" install || die "emake install failed" |
| 446 | popd > /dev/null |
455 | popd > /dev/null |
| 447 | |
456 | |
| 448 | # Move docs installed by autotools (in EAPI < 4). |
457 | # Move docs installed by autotools (in EAPI < 4). |
| 449 | if [[ ${EAPI} == [23] && -d ${D}${EPREFIX}/usr/share/doc/${PF} ]]; then |
458 | if [[ ${EAPI} == [23] ]] \ |
|
|
459 | && path_exists "${D}${EPREFIX}"/usr/share/doc/${PF}/*; then |
|
|
460 | if [[ $(find "${D}${EPREFIX}"/usr/share/doc/${PF}/* -type d) ]]; then |
|
|
461 | eqawarn "autotools-utils: directories in docdir require at least EAPI 4" |
|
|
462 | else |
| 450 | mkdir "${T}"/temp-docdir |
463 | mkdir "${T}"/temp-docdir |
| 451 | mv "${D}${EPREFIX}"/usr/share/doc/${PF}/* "${T}"/temp-docdir/ \ |
464 | mv "${D}${EPREFIX}"/usr/share/doc/${PF}/* "${T}"/temp-docdir/ \ |
| 452 | || die "moving docs to tempdir failed" |
465 | || die "moving docs to tempdir failed" |
| 453 | |
466 | |
| 454 | local f |
|
|
| 455 | for f in "${T}"/temp-docdir/*; do |
|
|
| 456 | [[ -d ${f} ]] \ |
|
|
| 457 | && die "directories in docdir require at least EAPI 4" |
|
|
| 458 | done |
|
|
| 459 | |
|
|
| 460 | dodoc "${T}"/temp-docdir/* || die "docdir dodoc failed" |
467 | dodoc "${T}"/temp-docdir/* || die "docdir dodoc failed" |
| 461 | rm -r "${T}"/temp-docdir || die |
468 | rm -r "${T}"/temp-docdir || die |
|
|
469 | fi |
| 462 | fi |
470 | fi |
| 463 | |
471 | |
| 464 | # XXX: support installing them from builddir as well? |
472 | # XXX: support installing them from builddir as well? |
| 465 | if [[ ${DOCS} ]]; then |
473 | if [[ ${DOCS} ]]; then |
| 466 | dodoc "${DOCS[@]}" || die "dodoc failed" |
474 | dodoc "${DOCS[@]}" || die "dodoc failed" |