This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=c94e16d93815aafe81daf68400ff1debc487b805

commit c94e16d93815aafe81daf68400ff1debc487b805
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Fri Jun 7 03:43:47 2024 +0200

    Dpkg::Vendor::Debian: On native builds map *_FOR_BUILD flags to * flags
    
    This should always be safe to do, and reduces the false positives in
    automatic tools analyzing the flags being set, which can trip over
    the _FOR_BUILD flags being blank.
    
    Closes: #1072332
---
 scripts/Dpkg/Vendor/Debian.pm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index b3be69e86..4a4af3f6b 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -449,9 +449,7 @@ sub add_build_flags {
     }
 
     $flags->append($_, $default_flags) foreach @compile_flags;
-    $flags->append($_ . '_FOR_BUILD', $default_flags) foreach @compile_flags;
     $flags->append('DFLAGS', $default_d_flags);
-    $flags->append('DFLAGS_FOR_BUILD', $default_d_flags);
 
     ## Area: abi
 
@@ -632,6 +630,23 @@ sub add_build_flags {
             $flags->append($_, $flag) foreach @compile_flags;
         }
     }
+
+    # XXX: Handle *_FOR_BUILD flags here until we can properly initialize them.
+    require Dpkg::Arch;
+
+    my $host_arch = Dpkg::Arch::get_host_arch();
+    my $build_arch = Dpkg::Arch::get_build_arch();
+
+    if ($host_arch eq $build_arch) {
+        foreach my $flag ($flags->list()) {
+            next if $flag =~ m/_FOR_BUILD$/;
+            my $value = $flags->get($flag);
+            $flags->append($flag . '_FOR_BUILD', $value);
+        }
+    } else {
+        $flags->append($_ . '_FOR_BUILD', $default_flags) foreach 
@compile_flags;
+        $flags->append('DFLAGS_FOR_BUILD', $default_d_flags);
+    }
 }
 
 sub _build_tainted_by {

-- 
Dpkg.Org's dpkg

Reply via email to