summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-05-23 07:47:39 +0000
committerMichał Górny <mgorny@gentoo.org>2014-05-23 07:47:39 +0000
commit41b73e0849476358ccb465149b937c129aa4982a (patch)
tree5394b75e7a4f771ecd6bcddcfa46a23c18d257e6 /eclass/multilib-build.eclass
parentDeprecate multilib_for_best_abi() to decrease confusion. (diff)
downloadgentoo-2-41b73e0849476358ccb465149b937c129aa4982a.tar.gz
gentoo-2-41b73e0849476358ccb465149b937c129aa4982a.tar.bz2
gentoo-2-41b73e0849476358ccb465149b937c129aa4982a.zip
Use MULTILIB_ABI_FLAG for header wrapping. Also, use explicit error when ABI is omitted in wrapper template.
Diffstat (limited to 'eclass/multilib-build.eclass')
-rw-r--r--eclass/multilib-build.eclass52
1 files changed, 18 insertions, 34 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 0eb194a9eae8..c3e48bcfdc65 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.51 2014/05/23 07:39:26 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.52 2014/05/23 07:47:39 mgorny Exp $
# @ECLASS: multilib-build.eclass
# @MAINTAINER:
@@ -411,35 +411,12 @@ multilib_prepare_wrappers() {
done
if [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]; then
- # XXX: get abi_* directly
- local abi_flag
- case "${ABI}" in
- amd64|amd64_fbsd)
- abi_flag=abi_x86_64;;
- x86|x86_fbsd)
- abi_flag=abi_x86_32;;
- x32)
- abi_flag=abi_x86_x32;;
- n32)
- abi_flag=abi_mips_n32;;
- n64)
- abi_flag=abi_mips_n64;;
- o32)
- abi_flag=abi_mips_o32;;
- esac
-
- # If abi_flag is unset, then header wrapping is unsupported
- # on this ABI. This could mean either that:
- #
- # 1) the arch doesn't support multilib at all -- in this case,
- # the headers are not wrapped and everything works as expected,
- #
- # 2) someone added new ABI and forgot to update the function --
- # in this case, the header consistency check will notice one of
- # those ABIs has an extra header (compared to the header moved
- # for wrapping) and will fail.
-
- if [[ ${abi_flag} ]]; then
+ # If abi_flag is unset, then header wrapping is unsupported on
+ # this ABI. This means the arch doesn't support multilib at all
+ # -- in this case, the headers are not wrapped and everything
+ # works as expected.
+
+ if [[ ${MULTILIB_ABI_FLAG} ]]; then
for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
# drop leading slash if it's there
f=${f#/}
@@ -454,10 +431,12 @@ multilib_prepare_wrappers() {
# Some ABIs may have install less files than others.
if [[ -f ${root}/usr/include${f} ]]; then
+ local wrapper=${ED}/tmp/multilib-include${f}
+
if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
dodir "/tmp/multilib-include${dir}"
# a generic template
- cat > "${ED}/tmp/multilib-include${f}" <<_EOF_
+ cat > "${wrapper}" <<_EOF_
/* This file is auto-generated by multilib-build.eclass
* as a multilib-friendly wrapper. For the original content,
* please see the files that are #included below.
@@ -485,20 +464,25 @@ multilib_prepare_wrappers() {
_EOF_
fi
+ if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"
+ then
+ die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org."
+ fi
+
# $CHOST shall be set by multilib_toolchain_setup
dodir "/tmp/multilib-include/${CHOST}${dir}"
mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
# Note: match a space afterwards to avoid collision potential.
- sed -e "/${abi_flag} /s&error.*&include <${CHOST}${f}>&" \
- -i "${ED}/tmp/multilib-include${f}" || die
+ sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
+ -i "${wrapper}" || die
# Hack for emul-linux-x86 compatibility.
# It assumes amd64 will come after x86, and will use amd64
# headers if no specific x86 headers were installed.
if [[ ${ABI} == amd64 ]]; then
sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
- -i "${ED}/tmp/multilib-include${f}" || die
+ -i "${wrapper}" || die
fi
fi
done