diff options
Diffstat (limited to 'eclass/multilib.eclass')
-rw-r--r-- | eclass/multilib.eclass | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass index f958a3d..1f268e8 100644 --- a/eclass/multilib.eclass +++ b/eclass/multilib.eclass @@ -59,6 +59,19 @@ get_libdir() { fi } +# @FUNCTION: get_libdir_subst +# @DESCRIPTION: +# Outputs its input with all occurrences of "@GET_LIBDIR@" +# replaced with the actual results of $(get_libdir) +get_libdir_subst() { + local i result + for i in "$@" ; do + result="${result}${result:+ }${i//@GET_LIBDIR@/$(get_libdir)}" + done + echo "${result}" + return 0 +} + # @FUNCTION: get_abi_var # @USAGE: <VAR> [ABI] # @RETURN: returns the value of ${<VAR>_<ABI>} which should be set in make.defaults @@ -395,7 +408,7 @@ multilib_toolchain_setup() { # First restore any saved state we have laying around. if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then - for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do + for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG{_LIBDIR,_PATH,} ; do vv="__abi_saved_${v}" [[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v} unset ${vv} @@ -407,7 +420,7 @@ multilib_toolchain_setup() { # screws up ccache and distcc. See #196243 for more info. if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then # Back that multilib-ass up so we can restore it later - for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do + for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG{_LIBDIR,_PATH,} ; do vv="__abi_saved_${v}" [[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv} done @@ -419,10 +432,38 @@ multilib_toolchain_setup() { export CC="$(tc-getCC) $(get_abi_CFLAGS)" export CXX="$(tc-getCXX) $(get_abi_CFLAGS)" export LD="$(tc-getLD) $(get_abi_LDFLAGS)" + export CHOST=$(get_abi_CHOST $1) + export CBUILD=$(get_abi_CHOST $1) export PKG_CONFIG_LIBDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig export PKG_CONFIG_PATH=${EPREFIX}/usr/share/pkgconfig + + # I find this pretty confusing. I don't think we want to let tc-getPKG_CONFIG + # look up our pkg-config for us once we change CHOST -- that is now going to + # pick up the <abi-tuple>-pkg-config executable which could come from crossdev + # or god-knows where... so basically unless we are doing a compile for crossdev, we want + # to treat all multi-abi pkg-configs the same, /except/ for the two variables + # above... I guess? Who fucking knows, this will probably break something somewhere + # but I am inclined to think that such breakage might indicate a bug in the + # consuming ebuild instead of here. It's a fucking text-file processor, after all, + # like "sed". Who cares if we run our own so long as we give it the right environment + # variables? An alternative idea would be to always rely on tc-get-BUILD_PKG_CONFIG + # in preference to tc-getPKG_CONFIG. Although the names are confusing, I think + # the results of using that in preference to tc-getPKG_CONFIG would actually fix + # a lot of portage problems. A third alternative would be to special-case tc-getPKG_CONFIG + # to return results from the build machine.... + # + # Not sure I'm happy with any of these solutions or the one below. If anyone + # has a crystal-clear idea of the full semantic import of this... drop me a line! + # + # -gmt Nov. 2013 + # + if ! tc-is-cross-compiler ; then + export PKG_CONFIG=$( tc-getPKG_CONFIG $(get_abi_CHOST ${DEFAULT_ABI}) ) + else + export PKG_CONFIG=$( tc-getPKG_CONFIG $(get_abi_CHOST $1) ) + fi fi } |