mgorny      14/04/29 20:59:41

  Modified:             ChangeLog multilib-build.eclass
  Log:
  Disable header wrapping on unsupported ABIs.

Revision  Changes    Path
1.1232               eclass/ChangeLog

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1232&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1232&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1231&r2=1.1232

Index: ChangeLog
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
retrieving revision 1.1231
retrieving revision 1.1232
diff -u -r1.1231 -r1.1232
--- ChangeLog   29 Apr 2014 20:59:00 -0000      1.1231
+++ ChangeLog   29 Apr 2014 20:59:41 -0000      1.1232
@@ -1,6 +1,9 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1231 2014/04/29 
20:59:00 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1232 2014/04/29 
20:59:41 mgorny Exp $
+
+  29 Apr 2014; Michał Górny <[email protected]> multilib-build.eclass:
+  Disable header wrapping on unsupported ABIs.
 
   29 Apr 2014; Michał Górny <[email protected]> multilib-build.eclass:
   Reorder the operations in multilib_prepare_wrappers for easier reading.



1.45                 eclass/multilib-build.eclass

file : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multilib-build.eclass?rev=1.45&view=markup
plain: 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multilib-build.eclass?rev=1.45&content-type=text/plain
diff : 
http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/multilib-build.eclass?r1=1.44&r2=1.45

Index: multilib-build.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -r1.44 -r1.45
--- multilib-build.eclass       29 Apr 2014 20:59:00 -0000      1.44
+++ multilib-build.eclass       29 Apr 2014 20:59:41 -0000      1.45
@@ -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 @@
                fi
        done
 
-       for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do
-               # drop leading slash if it's there
-               f=${f#/}
+       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}
+                               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 @@
 #      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
-
-                       # 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
+                               # 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
+
+                                       # 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




Reply via email to