commit:     176c1daa9c86574370fdf5ebfd23dd0edd163bdd
Author:     Jeremi Piotrowski <jpiotrowski <AT> microsoft <DOT> com>
AuthorDate: Tue Aug 31 08:49:06 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep  1 00:48:55 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=176c1daa

dev-lang/perl: append required cflags when x-compiling

The cross-build system wants to append cflags required by the build to the
'optimize' variable, but doesn't touch the variable when the user overrides it.
Since the ebuild passes '-Doptimize="${CFLAGS}"', we are responsible for
passing the correct flags, so append '-fwrapv -fno-strict-aliasing' to cflags
when we are cross-compiling.

Bug: https://bugs.gentoo.org/811237
Reported-by: Github User DRKV333
Signed-off-by: Jeremi Piotrowski <jpiotrowski <AT> microsoft.com>
Closes: https://github.com/gentoo/gentoo/pull/22167
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/perl/perl-5.32.1.ebuild    | 5 +++++
 dev-lang/perl/perl-5.34.0-r1.ebuild | 5 +++++
 dev-lang/perl/perl-5.34.0-r2.ebuild | 5 +++++
 dev-lang/perl/perl-5.34.0.ebuild    | 5 +++++
 4 files changed, 20 insertions(+)

diff --git a/dev-lang/perl/perl-5.32.1.ebuild b/dev-lang/perl/perl-5.32.1.ebuild
index 149bcd1b624..97963cf4402 100644
--- a/dev-lang/perl/perl-5.32.1.ebuild
+++ b/dev-lang/perl/perl-5.32.1.ebuild
@@ -585,6 +585,11 @@ src_configure() {
                myconf -DDEBUGGING=none
        fi
 
+       # modifying 'optimize' prevents cross configure script from appending 
required flags
+       if tc-is-cross-compiler; then
+               append-cflags "-fwrapv -fno-strict-aliasing"
+       fi
+
        # Autodiscover all old version directories, some of them will even be 
newer
        # if you downgrade
        if [[ -z ${PERL_OLDVERSEN} ]]; then

diff --git a/dev-lang/perl/perl-5.34.0-r1.ebuild 
b/dev-lang/perl/perl-5.34.0-r1.ebuild
index 6d709db3098..8f4017c8989 100644
--- a/dev-lang/perl/perl-5.34.0-r1.ebuild
+++ b/dev-lang/perl/perl-5.34.0-r1.ebuild
@@ -585,6 +585,11 @@ src_configure() {
                myconf -DDEBUGGING=none
        fi
 
+       # modifying 'optimize' prevents cross configure script from appending 
required flags
+       if tc-is-cross-compiler; then
+               append-cflags "-fwrapv -fno-strict-aliasing"
+       fi
+
        # Autodiscover all old version directories, some of them will even be 
newer
        # if you downgrade
        if [[ -z ${PERL_OLDVERSEN} ]]; then

diff --git a/dev-lang/perl/perl-5.34.0-r2.ebuild 
b/dev-lang/perl/perl-5.34.0-r2.ebuild
index 37a81ddac84..2ec3fee9bfa 100644
--- a/dev-lang/perl/perl-5.34.0-r2.ebuild
+++ b/dev-lang/perl/perl-5.34.0-r2.ebuild
@@ -586,6 +586,11 @@ src_configure() {
                myconf -DDEBUGGING=none
        fi
 
+       # modifying 'optimize' prevents cross configure script from appending 
required flags
+       if tc-is-cross-compiler; then
+               append-cflags "-fwrapv -fno-strict-aliasing"
+       fi
+
        # Autodiscover all old version directories, some of them will even be 
newer
        # if you downgrade
        if [[ -z ${PERL_OLDVERSEN} ]]; then

diff --git a/dev-lang/perl/perl-5.34.0.ebuild b/dev-lang/perl/perl-5.34.0.ebuild
index 6af9e5af88f..a9aa55e7376 100644
--- a/dev-lang/perl/perl-5.34.0.ebuild
+++ b/dev-lang/perl/perl-5.34.0.ebuild
@@ -582,6 +582,11 @@ src_configure() {
                myconf -DDEBUGGING=none
        fi
 
+       # modifying 'optimize' prevents cross configure script from appending 
required flags
+       if tc-is-cross-compiler; then
+               append-cflags "-fwrapv -fno-strict-aliasing"
+       fi
+
        # Autodiscover all old version directories, some of them will even be 
newer
        # if you downgrade
        if [[ -z ${PERL_OLDVERSEN} ]]; then

Reply via email to