summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* go-env.eclass: fix GO386 handlingSam James2023-11-241-1/+22
| | | | | | | | | | | | | | | | | | Go 1.16 dropped explicit support for 386 FP and relies on software emulation instead in the absence of SSE2. * First, check if cpu_flags_x86_sse2 is used in the ebuild. If it is and it's enabled, then act in SSE2 mode. * If not, fall back to checking whether the compiler has __SSE2__ defined via e.g. -march in CFLAGS. * Failing that, use softfloat mode. Fixes the issue mentioned in 5718f8440197298e0aa1df2a88a66057d2cdaf83 (where we tried to use a USE flag which isn't implicit). Signed-off-by: Sam James <sam@gentoo.org>
* go-env.eclass: Reapply "also set GOARM & GO386 when applicable"Sam James2023-11-241-0/+21
| | | | | | | | | | | This reverts commit 5718f8440197298e0aa1df2a88a66057d2cdaf83. Reverted because of the issue mentioned in 5718f8440197298e0aa1df2a88a66057d2cdaf83 to not leave things broken while investigating a fix. Reapplying and fixing it up in a followup. Signed-off-by: Sam James <sam@gentoo.org>
* Revert "go-env.eclass: also set GOARM & GO386 when applicable"Sam James2023-11-241-21/+0
| | | | | | | | | This reverts commit 64224abbe06824d47c554dced4149b51f3cebe91. Ionen raises on the ML that this won't work unless cpu_flags_x86_sse2 is in IUSE, so revert for now until can figure that bit out. Signed-off-by: Sam James <sam@gentoo.org>
* go-env.eclass: also set GOARM & GO386 when applicableWANG Xuerui2023-11-241-0/+21
| | | | | | | | | | 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> Closes: https://github.com/gentoo/gentoo/pull/33941 Signed-off-by: Sam James <sam@gentoo.org>
* go-env.eclass: unify GOARCH mapping logic with dev-lang/goWANG Xuerui2023-11-241-14/+26
| | | | | | | | | | | | | | | | Previously the eclass featured its own GOARCH mapping, that took care of less cases than the dev-lang/go ebuild did, and broke Go packages on arches like loong (GOARCH=loong64), mips (4 GOARCHes supported in total) or riscv (GOARCH=riscv64). This patch adds a copy of the go_arch() helper from dev-lang/go to the eclass and switches the go-env_set_compile_environment() function to use that, to fix the problem at hand. Fixes: 878d04daaf34765e6224e58139a9c45921d7a0c3 Closes: https://bugs.gentoo.org/917750 Signed-off-by: WANG Xuerui <xen0n@gentoo.org> Signed-off-by: Sam James <sam@gentoo.org>
* eclass/go-env.eclass: add helper to set compile envThilo Fromm2023-11-201-0/+48
This change adds a helper function to explicitly set CC, CXX, and GOARCH, and carrying over CFLAGS, LDFLAGS and friends to CGO equivalents, to provide a minimal sane compile environment for Go. It enables Go builds to play nice with crossdev's wrappers for emerge/ebuild etc. Previously, Go ebuilds emitted binaries for the host architecture. For example, when running on an x86_64 host: emerge-aarch64-cross-linux-gnu foo will now correctly emerge Go package "foo" for aarch64 instead of x86_64. The eclass provides a single helper function go-env_set_compile_environment() intended to be called by other Go eclasses in an early build stage. Ebuilds may also explicitly call this function. Signed-off-by: Thilo Fromm <thilo.alexander@gmail.com> Signed-off-by: James Le Cuirot <chewi@gentoo.org>