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=372d2a73c0524c41d38e4ed5130a111b1617f2a0

commit 372d2a73c0524c41d38e4ed5130a111b1617f2a0
Author: Guillem Jover <[email protected]>
AuthorDate: Mon Dec 26 00:43:55 2022 +0100

    Dpkg::Vendor::Ubuntu: Use new build flag option override support to set -O3
---
 scripts/Dpkg/Vendor/Ubuntu.pm | 31 ++++++++++++++-----------------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/scripts/Dpkg/Vendor/Ubuntu.pm b/scripts/Dpkg/Vendor/Ubuntu.pm
index f55e58d65..228e5a429 100644
--- a/scripts/Dpkg/Vendor/Ubuntu.pm
+++ b/scripts/Dpkg/Vendor/Ubuntu.pm
@@ -99,23 +99,6 @@ sub run_hook {
         # Run the Debian hook to add hardening flags
         $self->SUPER::run_hook($hook, $flags);
 
-        require Dpkg::BuildOptions;
-
-       my $build_opts = Dpkg::BuildOptions->new();
-
-       if (!$build_opts->has('noopt')) {
-            require Dpkg::Arch;
-
-            my $arch = Dpkg::Arch::get_host_arch();
-            if ($arch eq 'ppc64el') {
-               for my $flag (qw(CFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS
-                                FFLAGS FCFLAGS)) {
-                    my $value = $flags->get($flag);
-                    $value =~ s/-O[0-9]/-O3/;
-                    $flags->set($flag, $value);
-               }
-           }
-       }
        # Per https://wiki.ubuntu.com/DistCompilerFlags
         $flags->prepend('LDFLAGS', '-Wl,-Bsymbolic-functions');
     } else {
@@ -123,6 +106,20 @@ sub run_hook {
     }
 }
 
+# Override Debian default features.
+sub set_build_features {
+    my ($self, $flags) = @_;
+
+    $self->SUPER::set_build_features($flags);
+
+    require Dpkg::Arch;
+    my $arch = Dpkg::Arch::get_host_arch();
+
+    if ($arch eq 'ppc64el' && $flags->get_option_value('optimize-level') != 0) 
{
+        $flags->set_option_value('optimize-level', 3);
+    }
+}
+
 =head1 PUBLIC FUNCTIONS
 
 =over

-- 
Dpkg.Org's dpkg

Reply via email to