public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Ionen Wolkens <ionen@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: WANG Xuerui <xen0n@gentoo.org>,
	Thilo Fromm <thilo.alexander@gmail.com>,
	Flatcar Linux Maintainers <infra@flatcar-linux.org>
Subject: Re: [gentoo-dev] [PATCH 2/2] go-env.eclass: also set GOARM & GO386 when applicable
Date: Thu, 23 Nov 2023 18:01:10 -0500	[thread overview]
Message-ID: <ZV_ZtuUdHkljxiw5@eversor> (raw)
In-Reply-To: <20231123093159.1228864-3-xen0n@gentoo.org>

[-- Attachment #1: Type: text/plain, Size: 2225 bytes --]

On Thu, Nov 23, 2023 at 05:31:59PM +0800, WANG Xuerui wrote:
> This is necessary for the build artifact to conform to the configured
> ISA level and features on those arches. The logic is also taken from
> the dev-lang/go ebuild.
> 
> Signed-off-by: WANG Xuerui <xen0n@gentoo.org>
> ---
>  eclass/go-env.eclass | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/eclass/go-env.eclass b/eclass/go-env.eclass
> index 08e3cf498a70..4bc8c4b15c65 100644
> --- a/eclass/go-env.eclass
> +++ b/eclass/go-env.eclass
> @@ -19,6 +19,8 @@ inherit toolchain-funcs
>  # @FUNCTION: go-env_set_compile_environment
>  # @DESCRIPTION:
>  # Set up basic compile environment: CC, CXX, and GOARCH.
> +# Necessary platform-specific settings such as GOARM or GO386 are also set
> +# according to the Portage configuration when building for those architectures.
>  # Also carry over CFLAGS, LDFLAGS and friends.
>  # Required for cross-compiling with crossdev.
>  # If not set, host defaults will be used and the resulting binaries are host arch.
> @@ -28,6 +30,9 @@ go-env_set_compile_environment() {
>  	tc-export CC CXX
>  
>  	export GOARCH="$(go-env_goarch)"
> +	use arm && export GOARM=$(go-env_goarm)
> +	use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')

cpu_flags_x86_sse2 is not an IUSE_IMPLICIT, meaning that emerging a
package without it in IUSE for x86 will result in:

 * ERROR: x11-terms/kitty-0.31.0::gentoo failed (compile phase):
 *   USE Flag 'cpu_flags_x86_sse2' not in IUSE for x11-terms/kitty-0.31.0

> +
>  	export CGO_CFLAGS="${CGO_CFLAGS:-$CFLAGS}"
>  	export CGO_CPPFLAGS="${CGO_CPPFLAGS:-$CPPFLAGS}"
>  	export CGO_CXXFLAGS="${CGO_CXXFLAGS:-$CXXFLAGS}"
> @@ -57,4 +62,20 @@ go-env_goarch() {
>  	esac
>  }
>  
> +# @FUNCTION: go-env_goarm
> +# @USAGE: [CHOST-value]
> +# @DESCRIPTION:
> +# Returns the appropriate GOARM setting for the CHOST given, or the default
> +# CHOST.
> +go-env_goarm() {
> +	case "${1:-${CHOST}}" in
> +		armv5*)	echo 5;;
> +		armv6*)	echo 6;;
> +		armv7*)	echo 7;;
> +		*)
> +			die "unknown GOARM for ${1:-${CHOST}}"
> +			;;
> +	esac
> +}
> +
>  fi
> -- 
> 2.42.1
> 
> 

-- 
ionen

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

      reply	other threads:[~2023-11-23 23:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23  9:31 [gentoo-dev] [PATCH 0/2] go-env.eclass: niche platform fixes WANG Xuerui
2023-11-23  9:31 ` [gentoo-dev] [PATCH 1/2] go-env.eclass: unify GOARCH mapping logic with dev-lang/go WANG Xuerui
2023-11-23  9:31 ` [gentoo-dev] [PATCH 2/2] go-env.eclass: also set GOARM & GO386 when applicable WANG Xuerui
2023-11-23 23:01   ` Ionen Wolkens [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZV_ZtuUdHkljxiw5@eversor \
    --to=ionen@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=infra@flatcar-linux.org \
    --cc=thilo.alexander@gmail.com \
    --cc=xen0n@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox