From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B3001138010 for ; Sun, 24 Mar 2013 15:15:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 93F1AE083D; Sun, 24 Mar 2013 15:15:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7A141E0818 for ; Sun, 24 Mar 2013 15:14:59 +0000 (UTC) Received: from portable (AMontpellier-651-1-406-46.w81-251.abo.wanadoo.fr [81.251.237.46]) (using SSLv3 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aballier) by smtp.gentoo.org (Postfix) with ESMTPSA id A5AC033DB42; Sun, 24 Mar 2013 15:14:57 +0000 (UTC) Date: Sun, 24 Mar 2013 16:14:52 +0100 From: Alexis Ballier To: gentoo-dev@lists.gentoo.org Cc: mgorny@gentoo.org Subject: Re: [gentoo-dev] [PATCH 2/2] Support wrapping headers for multilib ABIs. Message-ID: <20130324161452.63a55140@portable> In-Reply-To: <1364055998-23674-2-git-send-email-mgorny@gentoo.org> References: <20130323172532.1b1100e2@pomiocik.lan> <1364055998-23674-2-git-send-email-mgorny@gentoo.org> Organization: Gentoo X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.17; x86_64-pc-linux-gnu) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 547b7661-0400-46a0-9090-f5af4797d5d9 X-Archives-Hash: 6e2d8b9b7b75be8345640f10b07df3fb On Sat, 23 Mar 2013 17:26:38 +0100 Micha=C5=82 G=C3=B3rny wrote: > --- > gx86/eclass/autotools-multilib.eclass | 82 > +++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) >=20 > diff --git a/gx86/eclass/autotools-multilib.eclass > b/gx86/eclass/autotools-multilib.eclass index d7372b0..c65c777 100644 > --- a/gx86/eclass/autotools-multilib.eclass > +++ b/gx86/eclass/autotools-multilib.eclass why not multilib-build ? > @@ -33,6 +33,28 @@ inherit autotools-utils multilib-build > =20 > EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test > src_install=20 > +# @ECLASS-VARIABLE: MULTILIB_WRAPPED_HEADERS > +# @DESCRIPTION: > +# A list of headers to wrap for multilib support. The listed headers > +# will be moved to a non-standard location and replace with a file > +# including them conditionally to current ABI. > +# > +# This variable has to be a bash array. Paths shall be relative to > +# installation root (${D}), and name regular files. Recursive > wrapping +# is not supported. > +# > +# Please note that header wrapping is *discouraged*. It is preferred > to +# install all headers in a subdirectory of libdir and use > pkg-config to +# locate the headers. Some C preprocessors will not > work with wrapped +# headers. > +# > +# Example: > +# @CODE > +# MULTILIB_WRAPPED_HEADERS=3D( > +# /usr/include/foobar/config.h > +# ) > +# @CODE > + > autotools-multilib_src_prepare() { > autotools-utils_src_prepare "${@}" > } > @@ -49,13 +71,73 @@ autotools-multilib_src_test() { > multilib_foreach_abi autotools-utils_src_test "${@}" > } > =20 > +_autotools-multilib_wrap_headers() { > + debug-print-function ${FUNCNAME} "$@" > + local f > + > + for f in "${MULTILIB_WRAPPED_HEADERS[@]}"; do > + # drop leading slash if it's there > + f=3D${f#/} > + > + if [[ ${f} !=3D usr/include/* ]]; then > + die "Wrapping headers outside > of /usr/include is not supported at the moment." > + fi Do you really want to support this at some point? Why? I'd just go for paths relative to $EPREFIX/usr/include (or $ED/usr/include) for MULTILIB_WRAPPED_HEADERS. That would simplify the code. > + # and then usr/include > + f=3D${f#usr/include/} > + > + local dir=3D${f%/*} > + > + # $CHOST shall be set by multilib_toolchain_setup > + dodir "/tmp/multilib-include/${CHOST}/${dir}" > + mv "${ED}/usr/include/${f}" > "${ED}/tmp/multilib-include/${CHOST}/${dir}/" || die + why not use $T rather than $ED/tmp ? > + if [[ ! -f ${ED}/tmp/multilib-include/${f} ]]; then > + dodir "/tmp/multilib-include/${dir}" > + cat > "${ED}/tmp/multilib-include/${f}" > <<_EOF_ || die +/* This file is auto-generated by > autotools-multilib.eclass > + * as a multilib-friendly wrapper to /${f}. For the original content, > + * please see the files that are #included below. > + */ > +_EOF_ > + fi > + > + local defs > + case "${ABI}" in didn't you say $ABI may have name collisions? considering the code below, it seems much safer to match on $CHOST [...] It'd be nice to have an attempt to support all the ABIs gentoo supports in that file: I'd prefer to spot possible problems with this solution vs. sedding a template for example to be seen before having to rewrite it. For example, IIRC, ppc64 defines both __powerpc__ and __powerpc64__, the natural way would be: #if defined(__powerpc64__) ppc64 stuff #elif defined(__powerpc__) ppc stuff #endif with your approach that'd be: #if defined(__powerpc__) && !defined(__powerpc64__) ppc stuff #elif defined(__powerpc64__) ppc64 stuff #endif doing with a template has its disadvantages but allows more flexibility in how the #ifery is written; I don't want to realize your approach cannot deal with some weird arches after it has been deployed. thanks for working on this, Alexis.