commit:     8b05c1c26ef96bb9324db626572f3c4a73e3178c
Author:     Emanuele Torre <torreemanuele6 <AT> gmail <DOT> com>
AuthorDate: Wed Aug 14 05:36:34 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Aug 15 21:18:22 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8b05c1c2

dev-util/github-cli: fix build failure when -ggdb3 is in CFLAGS

After experiencing the bug described in https://bugs.gentoo.org/924496,
I was surprised to see  filter-flags "-ggdb3"  in the ebuilds for this
package.

I did some digging and found that go's goc does not use CFLAGS, LDFLAGS,
etc by default; it only uses the GOC_*FLAGS environment variables.
What causes goc to use CFLAGS if GOC_FLAGS is unset or empty is the
go-env_set_compile_environment function from the go-env eclass, that is
indirectly called by the go-module_live_vendor and go-module_src_unpack
functions from the go-module eclass that are being called from the
src_unpack of this ebuild.

So, calling  filter-lto ,  filter-flags "-ggdb3" , and  unset LDFLAGS
from src_compile before emake seems completely useless since those will
only filter regular  *FLAGS  environment variable, and not the
GOC_*FLAGS  environment variables initialised from the  *FLAGS
variables earlier on in src_unpack.

Moving those filter/unset commands to the start of  src_unpack  makes
them filter/unset *FLAGS variables before GOC_*FLAGS variables are set,
and actually fix the build problem encountered when CFLAGS contains
-ggdb3.

Bump copyright of touched ebuild files.

Bug: https://bugs.gentoo.org/847991
Closes: https://bugs.gentoo.org/924496
Signed-off-by: Emanuele Torre <torreemanuele6 <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/38140
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/github-cli/github-cli-2.27.0.ebuild | 15 ++++++++-------
 dev-util/github-cli/github-cli-2.31.0.ebuild | 15 ++++++++-------
 dev-util/github-cli/github-cli-2.32.1.ebuild | 15 ++++++++-------
 dev-util/github-cli/github-cli-2.33.0.ebuild | 15 ++++++++-------
 dev-util/github-cli/github-cli-2.42.0.ebuild | 13 +++++++------
 dev-util/github-cli/github-cli-2.52.0.ebuild | 13 +++++++------
 dev-util/github-cli/github-cli-9999.ebuild   | 15 ++++++++-------
 7 files changed, 54 insertions(+), 47 deletions(-)

diff --git a/dev-util/github-cli/github-cli-2.27.0.ebuild 
b/dev-util/github-cli/github-cli-2.27.0.ebuild
index 6ee5a5968dbd..49f74d520f92 100644
--- a/dev-util/github-cli/github-cli-2.27.0.ebuild
+++ b/dev-util/github-cli/github-cli-2.27.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

diff --git a/dev-util/github-cli/github-cli-2.31.0.ebuild 
b/dev-util/github-cli/github-cli-2.31.0.ebuild
index 6ee5a5968dbd..49f74d520f92 100644
--- a/dev-util/github-cli/github-cli-2.31.0.ebuild
+++ b/dev-util/github-cli/github-cli-2.31.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

diff --git a/dev-util/github-cli/github-cli-2.32.1.ebuild 
b/dev-util/github-cli/github-cli-2.32.1.ebuild
index 6ee5a5968dbd..49f74d520f92 100644
--- a/dev-util/github-cli/github-cli-2.32.1.ebuild
+++ b/dev-util/github-cli/github-cli-2.32.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

diff --git a/dev-util/github-cli/github-cli-2.33.0.ebuild 
b/dev-util/github-cli/github-cli-2.33.0.ebuild
index 6ee5a5968dbd..49f74d520f92 100644
--- a/dev-util/github-cli/github-cli-2.33.0.ebuild
+++ b/dev-util/github-cli/github-cli-2.33.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

diff --git a/dev-util/github-cli/github-cli-2.42.0.ebuild 
b/dev-util/github-cli/github-cli-2.42.0.ebuild
index 2d0c1da34ead..49f74d520f92 100644
--- a/dev-util/github-cli/github-cli-2.42.0.ebuild
+++ b/dev-util/github-cli/github-cli-2.42.0.ebuild
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

diff --git a/dev-util/github-cli/github-cli-2.52.0.ebuild 
b/dev-util/github-cli/github-cli-2.52.0.ebuild
index 2d0c1da34ead..49f74d520f92 100644
--- a/dev-util/github-cli/github-cli-2.52.0.ebuild
+++ b/dev-util/github-cli/github-cli-2.52.0.ebuild
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

diff --git a/dev-util/github-cli/github-cli-9999.ebuild 
b/dev-util/github-cli/github-cli-9999.ebuild
index 95a298653b46..a6d2c60b5a03 100644
--- a/dev-util/github-cli/github-cli-9999.ebuild
+++ b/dev-util/github-cli/github-cli-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -25,6 +25,13 @@ RDEPEND=">=dev-vcs/git-1.7.3"
 RESTRICT="test"
 
 src_unpack() {
+       # Filter LTO flags to avoid build failures.
+       filter-lto
+       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
+       filter-flags "-ggdb3"
+       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
+       unset LDFLAGS
+
        if [[ ${PV} == *9999 ]]; then
                git-r3_src_unpack
                go-module_live_vendor
@@ -35,12 +42,6 @@ src_unpack() {
 
 src_compile() {
        [[ ${PV} == *9999 ]] || export GH_VERSION="v${PV}"
-       # Filter LTO flags to avoid build failures.
-       filter-lto
-       # Filter '-ggdb3' flag to avoid build failures. bugs.gentoo.org/847991
-       filter-flags "-ggdb3"
-       # Go LDFLAGS are not the same as GCC/Binutils LDFLAGS
-       unset LDFLAGS
        # Once we set up cross compiling, this line will need to be adjusted
        # to compile for the target.
        # Everything else in this function happens on the host.

Reply via email to