aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory M. Turner <gmt@be-evil.net>2013-10-07 04:24:44 -0700
committerGregory M. Turner <gmt@be-evil.net>2013-10-07 04:24:44 -0700
commit3da31ad8e10526d9a576f5b8f1dc5e8b4f4fcd72 (patch)
tree18e7063d941c4c6cd907a08160712f5e39139cf8 /eclass/multilib.eclass
parentClone upstream multilib.eclass (diff)
downloadgmt-3da31ad8e10526d9a576f5b8f1dc5e8b4f4fcd72.tar.gz
gmt-3da31ad8e10526d9a576f5b8f1dc5e8b4f4fcd72.tar.bz2
gmt-3da31ad8e10526d9a576f5b8f1dc5e8b4f4fcd72.zip
eclass/multilib.eclass: new function, export PKG_CONFIG
Two additions to multilib.eclass: First, add the new get_libdir_subst convenience function. Second, export PKG_CONFIG* variables during multilib_toolchain_setup. Doing so has proved essential to avoiding all kinds of "ignoring blah due to wrong architecture" gcc messages and general failures. I have yet to see any downside to this change although some complication may turn up sooner or later.
Diffstat (limited to 'eclass/multilib.eclass')
-rw-r--r--eclass/multilib.eclass45
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
}