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

guillem pushed a commit to branch master
in repository dpkg.

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

commit d5374bc618310917557daa9c9ac2f4930515a0b2
Author: Guillem Jover <[email protected]>
AuthorDate: Sat Jun 16 18:33:15 2018 +0200

    Dpkg::BuildFlags: Move default flags setting into the Dpkg::Vendor modules
    
    This should really be a vendor specific default. It's also documented
    that way in the man page.
---
 debian/changelog              |  2 ++
 scripts/Dpkg/BuildFlags.pm    | 18 +++++++-----------
 scripts/Dpkg/Vendor/Debian.pm | 18 +++++++++++++++++-
 3 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 98146943d..1a1dbe0c8 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -125,6 +125,8 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     - Dpkg::Shlibs: Disable bool overload Dpkg::Version warnings.
     - Dpkg::Vendor::Debian: Inline _parse_feature_area() into
       _add_build_flags(), for a small speed up and line count reduction.
+    - Dpkg::BuildFlags: Move default flags setting into the Dpkg::Vendor
+      modules.
   * Documentation:
     - Update gettext minimal version in README.
     - Add a missing dot on the dpkg-buildflags(1) «lfs» feature paragraph.
diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm
index 0533b12b5..a8fd4584a 100644
--- a/scripts/Dpkg/BuildFlags.pm
+++ b/scripts/Dpkg/BuildFlags.pm
@@ -23,7 +23,6 @@ our $VERSION = '1.03';
 use Dpkg ();
 use Dpkg::Gettext;
 use Dpkg::Build::Env;
-use Dpkg::BuildOptions;
 use Dpkg::ErrorHandling;
 use Dpkg::Vendor qw(run_vendor_hook);
 
@@ -72,18 +71,15 @@ sub load_vendor_defaults {
     $self->{options} = {};
     $self->{source} = {};
     $self->{features} = {};
-    my $build_opts = Dpkg::BuildOptions->new();
-    $self->{build_options} = $build_opts;
-    my $default_flags = $build_opts->has('noopt') ? '-g -O0' : '-g -O2';
     $self->{flags} = {
        CPPFLAGS => '',
-       CFLAGS   => $default_flags,
-       CXXFLAGS => $default_flags,
-       OBJCFLAGS   => $default_flags,
-       OBJCXXFLAGS => $default_flags,
-       GCJFLAGS => $default_flags,
-       FFLAGS   => $default_flags,
-       FCFLAGS  => $default_flags,
+       CFLAGS   => '',
+       CXXFLAGS => '',
+       OBJCFLAGS   => '',
+       OBJCXXFLAGS => '',
+       GCJFLAGS => '',
+       FFLAGS   => '',
+       FCFLAGS  => '',
        LDFLAGS  => '',
     };
     $self->{origin} = {
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 2e42a8b86..1e8f24397 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -150,6 +150,22 @@ sub _add_build_flags {
         ($abi, $os, $cpu) = ('', '', '');
     }
 
+    ## Global defaults
+
+    my $default_flags;
+    if ($opts_build->has('noopt')) {
+        $default_flags = '-g -O0';
+    } else {
+        $default_flags = '-g -O2';
+    }
+    $flags->append('CFLAGS', $default_flags);
+    $flags->append('CXXFLAGS', $default_flags);
+    $flags->append('OBJCFLAGS', $default_flags);
+    $flags->append('OBJCXXFLAGS', $default_flags);
+    $flags->append('FFLAGS', $default_flags);
+    $flags->append('FCFLAGS', $default_flags);
+    $flags->append('GCJFLAGS', $default_flags);
+
     ## Area: future
 
     if ($use_feature{future}{lfs}) {
@@ -305,7 +321,7 @@ sub _add_build_flags {
     }
 
     # Mask features that might be influenced by other flags.
-    if ($flags->{build_options}->has('noopt')) {
+    if ($opts_build->has('noopt')) {
       # glibc 2.16 and later warn when using -O0 and _FORTIFY_SOURCE.
       $use_feature{hardening}{fortify} = 0;
     }

-- 
Dpkg.Org's dpkg

Reply via email to