| 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.39 2012/01/14 18:14:39 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-utils.eclass,v 1.50 2012/05/22 14:29:06 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 |
| … | |
… | |
| 324 | # gnome-doc |
325 | # gnome-doc |
| 325 | if [[ $(autotools_check_macro GNOME_DOC_INIT) ]]; then |
326 | if [[ $(autotools_check_macro GNOME_DOC_INIT) ]]; then |
| 326 | autotools_run_tool gnome-doc-prepare --copy --force |
327 | autotools_run_tool gnome-doc-prepare --copy --force |
| 327 | fi |
328 | fi |
| 328 | |
329 | |
| 329 | # We need to perform the check twice to know whether to run eaclocal. |
|
|
| 330 | # (_elibtoolize does that itself) |
|
|
| 331 | if [[ $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] |
330 | if [[ $(autotools_check_macro AC_PROG_LIBTOOL AM_PROG_LIBTOOL LT_INIT) ]] |
| 332 | then |
331 | then |
| 333 | _elibtoolize --copy --force --install |
332 | _elibtoolize --copy --force --install |
| 334 | else |
333 | fi |
|
|
334 | |
| 335 | eaclocal |
335 | eaclocal |
| 336 | fi |
|
|
| 337 | |
|
|
| 338 | eautoconf |
336 | eautoconf |
| 339 | eautoheader |
337 | eautoheader |
| 340 | FROM_EAUTORECONF=sure eautomake |
338 | FROM_EAUTORECONF=sure eautomake |
| 341 | |
339 | |
| 342 | local x |
340 | local x |
| 343 | for x in $(autotools_get_subdirs); do |
341 | for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS); do |
| 344 | if [[ -d ${x} ]] ; then |
342 | if [[ -d ${x} ]] ; then |
| 345 | pushd "${x}" >/dev/null |
343 | pushd "${x}" >/dev/null |
| 346 | autotools-utils_eautoreconf |
344 | autotools-utils_autoreconf |
| 347 | popd >/dev/null |
345 | popd >/dev/null |
| 348 | fi |
346 | fi |
| 349 | done |
347 | done |
| 350 | } |
348 | } |
| 351 | |
349 | |
| … | |
… | |
| 357 | autotools-utils_src_prepare() { |
355 | autotools-utils_src_prepare() { |
| 358 | debug-print-function ${FUNCNAME} "$@" |
356 | debug-print-function ${FUNCNAME} "$@" |
| 359 | |
357 | |
| 360 | local want_autoreconf=${AUTOTOOLS_AUTORECONF} |
358 | local want_autoreconf=${AUTOTOOLS_AUTORECONF} |
| 361 | |
359 | |
| 362 | touch "${T}"/.autotools-utils.timestamp || die |
|
|
| 363 | [[ ${PATCHES} ]] && epatch "${PATCHES[@]}" |
360 | [[ ${PATCHES} ]] && epatch "${PATCHES[@]}" |
|
|
361 | |
|
|
362 | at_checksum() { |
|
|
363 | find '(' -name 'Makefile.am' \ |
|
|
364 | -o -name 'configure.ac' \ |
|
|
365 | -o -name 'configure.in' ')' \ |
|
|
366 | -exec cksum {} + | sort -k2 |
|
|
367 | } |
|
|
368 | |
|
|
369 | [[ ! ${want_autoreconf} ]] && local checksum=$(at_checksum) |
| 364 | epatch_user |
370 | epatch_user |
| 365 | if [[ ! ${want_autoreconf} ]]; then |
371 | if [[ ! ${want_autoreconf} ]]; then |
| 366 | if [[ $(find . -newer "${T}"/.autotools-utils.timestamp \ |
372 | 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.' |
373 | einfo 'Will autoreconfigure due to user patches applied.' |
| 372 | want_autoreconf=yep |
374 | want_autoreconf=yep |
| 373 | fi |
375 | fi |
| 374 | fi |
376 | fi |
| 375 | |
377 | |
| 376 | [[ ${want_autoreconf} ]] && autotools-utils_autoreconf |
378 | [[ ${want_autoreconf} ]] && autotools-utils_autoreconf |
| … | |
… | |
| 393 | || die 'autotools-utils.eclass: myeconfargs has to be an array.' |
395 | || die 'autotools-utils.eclass: myeconfargs has to be an array.' |
| 394 | |
396 | |
| 395 | [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX= |
397 | [[ ${EAPI} == 2 ]] && ! use prefix && EPREFIX= |
| 396 | |
398 | |
| 397 | # Common args |
399 | # Common args |
| 398 | local econfargs=( |
400 | local econfargs=() |
|
|
401 | |
|
|
402 | _check_build_dir |
|
|
403 | if "${ECONF_SOURCE}"/configure --help 2>&1 | grep -q '^ *--docdir='; then |
|
|
404 | econfargs+=( |
| 399 | --docdir="${EPREFIX}/usr/share/doc/${PF}" |
405 | --docdir="${EPREFIX}"/usr/share/doc/${PF} |
| 400 | ) |
406 | ) |
|
|
407 | fi |
| 401 | |
408 | |
| 402 | # Handle static-libs found in IUSE, disable them by default |
409 | # Handle static-libs found in IUSE, disable them by default |
| 403 | if in_iuse static-libs; then |
410 | if in_iuse static-libs; then |
| 404 | econfargs+=( |
411 | econfargs+=( |
| 405 | --enable-shared |
412 | --enable-shared |
| … | |
… | |
| 408 | fi |
415 | fi |
| 409 | |
416 | |
| 410 | # Append user args |
417 | # Append user args |
| 411 | econfargs+=("${myeconfargs[@]}") |
418 | econfargs+=("${myeconfargs[@]}") |
| 412 | |
419 | |
| 413 | _check_build_dir |
|
|
| 414 | mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" |
420 | mkdir -p "${AUTOTOOLS_BUILD_DIR}" || die "mkdir '${AUTOTOOLS_BUILD_DIR}' failed" |
| 415 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
421 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
| 416 | econf "${econfargs[@]}" "$@" |
422 | econf "${econfargs[@]}" "$@" |
| 417 | popd > /dev/null |
423 | popd > /dev/null |
| 418 | } |
424 | } |
| … | |
… | |
| 444 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
450 | pushd "${AUTOTOOLS_BUILD_DIR}" > /dev/null |
| 445 | emake DESTDIR="${D}" "$@" install || die "emake install failed" |
451 | emake DESTDIR="${D}" "$@" install || die "emake install failed" |
| 446 | popd > /dev/null |
452 | popd > /dev/null |
| 447 | |
453 | |
| 448 | # Move docs installed by autotools (in EAPI < 4). |
454 | # Move docs installed by autotools (in EAPI < 4). |
| 449 | if [[ ${EAPI} == [23] && -d ${D}${EPREFIX}/usr/share/doc/${PF} ]]; then |
455 | if [[ ${EAPI} == [23] ]] \ |
|
|
456 | && path_exists "${D}${EPREFIX}"/usr/share/doc/${PF}/*; then |
| 450 | if [[ $(find "${D}${EPREFIX}"/usr/share/doc/${PF}/* -type d) ]]; then |
457 | if [[ $(find "${D}${EPREFIX}"/usr/share/doc/${PF}/* -type d) ]]; then |
| 451 | eqawarn "autotools-utils: directories in docdir require at least EAPI 4" |
458 | eqawarn "autotools-utils: directories in docdir require at least EAPI 4" |
| 452 | else |
459 | else |
| 453 | mkdir "${T}"/temp-docdir |
460 | mkdir "${T}"/temp-docdir |
| 454 | mv "${D}${EPREFIX}"/usr/share/doc/${PF}/* "${T}"/temp-docdir/ \ |
461 | mv "${D}${EPREFIX}"/usr/share/doc/${PF}/* "${T}"/temp-docdir/ \ |