summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2014-04-29 20:59:41 +0000
committerMichał Górny <mgorny@gentoo.org>2014-04-29 20:59:41 +0000
commitbd84d6e25b676b7d9b249ef00209f9cf8d1aa4fe (patch)
tree5bb59c1bcdf5567a64edeb7d832471ba3d45c7e5 /eclass/multilib-build.eclass
parentReorder the operations in multilib_prepare_wrappers for easier reading. (diff)
downloadgentoo-2-bd84d6e25b676b7d9b249ef00209f9cf8d1aa4fe.tar.gz
gentoo-2-bd84d6e25b676b7d9b249ef00209f9cf8d1aa4fe.tar.bz2
gentoo-2-bd84d6e25b676b7d9b249ef00209f9cf8d1aa4fe.zip
Disable header wrapping on unsupported ABIs.
Diffstat (limited to 'eclass/multilib-build.eclass')
-rw-r--r--eclass/multilib-build.eclass103
1 files changed, 58 insertions, 45 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 92d9c2a4acbb..450b9cf2722b 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.44 2014/04/29 20:59:00 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.45 2014/04/29 20:59:41 mgorny Exp $
# @ECLASS: multilib-build.eclass
# @MAINTAINER:
@@ -342,22 +342,52 @@ multilib_prepare_wrappers() {
fi
done
- for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
- # drop leading slash if it's there
- f=${f#/}
-
- if [[ ${f} != usr/include/* ]]; then
- die "Wrapping headers outside of /usr/include is not supported at the moment."
- fi
- # and then usr/include
- f=${f#usr/include}
+ 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
+ for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
+ # drop leading slash if it's there
+ f=${f#/}
+
+ if [[ ${f} != usr/include/* ]]; then
+ die "Wrapping headers outside of /usr/include is not supported at the moment."
+ fi
+ # and then usr/include
+ f=${f#usr/include}
- local dir=${f%/*}
+ local dir=${f%/*}
- if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
- dodir "/tmp/multilib-include${dir}"
- # a generic template
- cat > "${ED}/tmp/multilib-include${f}" <<_EOF_
+ if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
+ dodir "/tmp/multilib-include${dir}"
+ # a generic template
+ cat > "${ED}/tmp/multilib-include${f}" <<_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.
@@ -383,38 +413,21 @@ multilib_prepare_wrappers() {
# error "No ABI matched, please report a bug to bugs.gentoo.org"
#endif
_EOF_
- fi
+ fi
+
+ # Some ABIs may have install less files than others.
+ if [[ -f ${root}/usr/include${f} ]]; then
+ # $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
- # Some ABIs may have install less files than others.
- if [[ -f ${root}/usr/include${f} ]]; then
- # $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
-
- # 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;;
- *)
- die "Header wrapping for ${ABI} not supported yet";;
- esac
-
- # 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
+ # 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
+ fi
+ done
fi
- done
+ fi
}
# @FUNCTION: multilib_install_wrappers