diff options
author | Gregory M. Tuner <gmt@be-evil.net> | 2013-11-28 03:57:48 -0800 |
---|---|---|
committer | Gregory M. Tuner <gmt@be-evil.net> | 2013-11-28 03:57:48 -0800 |
commit | 5d6d7fba04eaae960836c6c78eba0dd758df787e (patch) | |
tree | 0bc4a515edbe028a7b1d190bac3bf115df8904ab /eclass/autotools-multilib.eclass | |
parent | sys-libs/db: use myeconfargs instead of the (going away) autotools_multilib_i... (diff) | |
download | gmt-5d6d7fba04eaae960836c6c78eba0dd758df787e.tar.gz gmt-5d6d7fba04eaae960836c6c78eba0dd758df787e.tar.bz2 gmt-5d6d7fba04eaae960836c6c78eba0dd758df787e.zip |
eclass/autotools-multilib: rebase from scratch relative to upstream version (now multilib-minimal-based)
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass/autotools-multilib.eclass')
-rw-r--r-- | eclass/autotools-multilib.eclass | 148 |
1 files changed, 148 insertions, 0 deletions
diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass new file mode 100644 index 0000000..bc911b7 --- /dev/null +++ b/eclass/autotools-multilib.eclass @@ -0,0 +1,148 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.19 2013/11/24 10:53:43 mgorny Exp $ + +# @ECLASS: autotools-multilib.eclass +# @MAINTAINER: +# Michał Górny <mgorny@gentoo.org> +# @BLURB: autotools-utils wrapper for multilib builds +# @DESCRIPTION: +# The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper +# introducing support for building for more than one ABI (multilib). +# +# Inheriting this eclass sets the USE flags and exports autotools-utils +# phase function wrappers which build the package for each supported ABI +# when the relevant flag is enabled. Other than that, it works like +# regular autotools-utils. +# +# The multilib phase functions can be overriden via defining multilib_* +# phase functions as in multilib-minimal.eclass. In some cases you may +# need to call the underlying autotools-utils_* phase though. +# +# Note that the multilib support requires out-of-source builds to be +# enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with +# it. + +# EAPI=4 is required for meaningful MULTILIB_USEDEP. +case ${EAPI:-0} in + 4|5) ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac + +if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then + die "${ECLASS}: multilib support requires out-of-source builds." +fi + +inherit autotools-utils eutils multilib-build multilib-minimal ehooker multilib + +EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install + +# Note: _at_args[@] passing is a backwards compatibility measure. +# Don't use it in new packages. + +autotools-multilib_src_prepare() { + debug-print-function ${FUNCNAME} "$@" + + if ehook_fire autotools-multilib-global-pre_src_prepare ; then + autotools-utils_src_prepare "${@}" + [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && multilib_copy_sources + fi + ehook_fire autotools-multilib-global-post_src_prepare -u +} + +_autotools-multilib_wrap_autotools_utils_phase_hooks() { + local phase evaltext + for phase in src_configure src_compile src_test src_install ; do + read -r -d '' evaltext <<-EOF + _autotools-multilib-autotools-utils-pre_${phase}_wrapper() { + debug-print-function \${FUNCNAME} "\$@" + ehook_fire autotools-multilib-per-abi-pre_${phase} + local rslt=\$? + if [[ \${rslt} == 0 ]] ; then + if multilib_is_native_abi ; then + ehook_fire autotools-multilib-native-pre_${phase} + rslt=\$? + fi + fi + return \$rslt + } + _autotools-multilib-autotools-utils-post_${phase}_wrapper() { + debug-print-function \${FUNCNAME} "\$@" + ehook_fire autotools-multilib-per-abi-post_${phase} -u + if multilib_is_native_abi ; then + ehook_fire autotools-multilib-native-post_${phase} -u + fi + } + ehook autotools-utils-pre_${phase} _autotools-multilib-autotools-utils-pre_${phase}_wrapper + ehook autotools-utils-post_${phase} _autotools-multilib-autotools-utils-post_${phase}_wrapper + EOF + eval "${evaltext}" + done + _AUTOTOOLS_MULTILIB_AUTOTOOLS_UTILS_HOOKS_WRAPPED=yes +} +[[ ${_AUTOTOOLS_MULTILIB_AUTOTOOLS_UTILS_HOOKS_WRAPPED} ]] || \ + _autotools-multilib_wrap_autotools_utils_phase_hooks + +multilib_src_configure() { + debug-print-function ${FUNCNAME} "$@" + [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]] && local ECONF_SOURCE=${BUILD_DIR} + do_with_get_libdir_subst autotools-utils_src_configure "${_at_args[@]}" +} + +autotools-multilib_src_configure() { + debug-print-function ${FUNCNAME} "$@" + local _at_args=( "${@}" ) + ehook_fire autotools-multilib-global-pre_src_configure && \ + multilib-minimal_src_configure + ehook_fire autotools-multilib-global-post_src_configure -u +} + +multilib_src_compile() { + debug-print-function ${FUNCNAME} "$@" + do_with_get_libdir_subst emake "${_at_args[@]}" +} + +autotools-multilib_src_compile() { + debug-print-function ${FUNCNAME} "$@" + local _at_args=( "${@}" ) + ehook_fire autotools-multilib-global-pre_src_compile && \ + multilib-minimal_src_compile + ehook_fire autotools-multilib-global-post_src_compile -u +} + +multilib_src_test() { + debug-print-function ${FUNCNAME} "$@" + do_with_get_libdir_subst autotools-utils_src_test "${_at_args[@]}" +} + +autotools-multilib_src_test() { + debug-print-function ${FUNCNAME} "$@" + local _at_args=( "${@}" ) + ehook_fire autotools-multilib-global-pre_src_test && \ + multilib-minimal_src_test + ehook_fire autotools-multilib-global-post_src_test -u +} + +multilib_src_install() { + debug-print-function ${FUNCNAME} "$@" + do_with_get_libdir_subst emake DESTDIR="${D}" "${_at_args[@]}" install +} + +multilib_src_install_all() { + debug-print-function ${FUNCNAME} "$@" + einstalldocs + + # Remove libtool files and unnecessary static libs + local prune_ltfiles=${AUTOTOOLS_PRUNE_LIBTOOL_FILES} + if [[ ${prune_ltfiles} != none ]]; then + prune_libtool_files ${prune_ltfiles:+--${prune_ltfiles}} + fi +} + +autotools-multilib_src_install() { + debug-print-function ${FUNCNAME} "$@" + local _at_args=( "${@}" ) + ehook_fire autotools-multilib-global-pre_src_install && \ + multilib-minimal_src_install + ehook_fire autotools-multilib-global-post_src_install -u +} |