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=d01d1f49c9734a39fc278f4d5b75444c96491023

commit d01d1f49c9734a39fc278f4d5b75444c96491023
Author: Guillem Jover <[email protected]>
AuthorDate: Fri Nov 27 01:52:28 2020 +0100

    dpkg-buildflags: Add support for DFLAGS
    
    Add default value in Debian and derivatives for the flag.
    
    It will get either -fdebug or -frelease depending on noopt presence in
    DEB_BUILD_OPTIONS, but for now nothing else, as it seems common for D
    project to use CPPFLAGS and CFLAGS anyway.
    
    Closes: #975896
---
 man/dpkg-buildflags.pod       | 4 ++++
 scripts/Dpkg/Build/Info.pm    | 2 +-
 scripts/Dpkg/BuildFlags.pm    | 3 +++
 scripts/Dpkg/Vendor/Debian.pm | 4 ++++
 scripts/mk/buildflags.mk      | 3 ++-
 scripts/t/Dpkg_Build_Info.t   | 2 +-
 scripts/t/mk/buildflags.mk    | 1 +
 7 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/man/dpkg-buildflags.pod b/man/dpkg-buildflags.pod
index 3fe42078b..efb799745 100644
--- a/man/dpkg-buildflags.pod
+++ b/man/dpkg-buildflags.pod
@@ -267,6 +267,10 @@ Options for the Objective C++ compiler. Same as 
B<CXXFLAGS>.
 
 Options for the GNU Java compiler (gcj). A subset of B<CFLAGS>.
 
+=item B<DFLAGS>
+
+Options for the D compiler (ldc or gdc). Since dpkg 1.20.6.
+
 =item B<FFLAGS>
 
 Options for the Fortran 77 compiler. A subset of B<CFLAGS>.
diff --git a/scripts/Dpkg/Build/Info.pm b/scripts/Dpkg/Build/Info.pm
index 3d221e476..13d244366 100644
--- a/scripts/Dpkg/Build/Info.pm
+++ b/scripts/Dpkg/Build/Info.pm
@@ -52,7 +52,7 @@ my @env_allowed = (
     # Toolchain.
     qw(CC CPP CXX OBJC OBJCXX PC FC M2C AS LD AR RANLIB MAKE AWK LEX YACC),
     # Toolchain flags.
-    qw(CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS FFLAGS
+    qw(CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS GCJFLAGS DFLAGS FFLAGS
        LDFLAGS ARFLAGS MAKEFLAGS),
     # Dynamic linker, see ld(1).
     qw(LD_LIBRARY_PATH),
diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm
index 53b3cad00..1ac6757ae 100644
--- a/scripts/Dpkg/BuildFlags.pm
+++ b/scripts/Dpkg/BuildFlags.pm
@@ -76,6 +76,7 @@ sub load_vendor_defaults {
        OBJCFLAGS   => '',
        OBJCXXFLAGS => '',
        GCJFLAGS => '',
+       DFLAGS   => '',
        FFLAGS   => '',
        FCFLAGS  => '',
        LDFLAGS  => '',
@@ -87,6 +88,7 @@ sub load_vendor_defaults {
        OBJCFLAGS   => 'vendor',
        OBJCXXFLAGS => 'vendor',
        GCJFLAGS => 'vendor',
+       DFLAGS   => 'vendor',
        FFLAGS   => 'vendor',
        FCFLAGS  => 'vendor',
        LDFLAGS  => 'vendor',
@@ -98,6 +100,7 @@ sub load_vendor_defaults {
        OBJCFLAGS   => 0,
        OBJCXXFLAGS => 0,
        GCJFLAGS => 0,
+       DFLAGS   => 0,
        FFLAGS   => 0,
        FCFLAGS  => 0,
        LDFLAGS  => 0,
diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm
index 23237a906..76395c197 100644
--- a/scripts/Dpkg/Vendor/Debian.pm
+++ b/scripts/Dpkg/Vendor/Debian.pm
@@ -159,10 +159,13 @@ sub _add_build_flags {
     ## Global defaults
 
     my $default_flags;
+    my $default_d_flags;
     if ($opts_build->has('noopt')) {
         $default_flags = '-g -O0';
+        $default_d_flags = '-fdebug';
     } else {
         $default_flags = '-g -O2';
+        $default_d_flags = '-frelease';
     }
     $flags->append('CFLAGS', $default_flags);
     $flags->append('CXXFLAGS', $default_flags);
@@ -171,6 +174,7 @@ sub _add_build_flags {
     $flags->append('FFLAGS', $default_flags);
     $flags->append('FCFLAGS', $default_flags);
     $flags->append('GCJFLAGS', $default_flags);
+    $flags->append('DFLAGS', $default_d_flags);
 
     ## Area: future
 
diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk
index a39ee4760..cfeabda4f 100644
--- a/scripts/mk/buildflags.mk
+++ b/scripts/mk/buildflags.mk
@@ -6,6 +6,7 @@
 #   OBJCFLAGS: flags for the Objective C compiler.
 #   OBJCXXFLAGS: flags for the Objective C++ compiler.
 #   GCJFLAGS: flags for the GNU Java compiler.
+#   DFLAGS: flags for the D compiler.
 #   FFLAGS: flags for the Fortran 77 compiler.
 #   FCFLAGS: flags for the Fortran 9x compiler.
 #   LDFLAGS: flags for the linker.
@@ -19,7 +20,7 @@
 dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := 
$$(shell $(2)))$$(value DPKG_CACHE_$(1)))
 
 DPKG_BUILDFLAGS_LIST = CFLAGS CPPFLAGS CXXFLAGS OBJCFLAGS OBJCXXFLAGS \
-                       GCJFLAGS FFLAGS FCFLAGS LDFLAGS
+                       GCJFLAGS DFLAGS FFLAGS FCFLAGS LDFLAGS
 
 define dpkg_buildflags_export_envvar
 ifdef $(1)
diff --git a/scripts/t/Dpkg_Build_Info.t b/scripts/t/Dpkg_Build_Info.t
index c964e5556..958e00680 100644
--- a/scripts/t/Dpkg_Build_Info.t
+++ b/scripts/t/Dpkg_Build_Info.t
@@ -22,7 +22,7 @@ BEGIN {
     use_ok('Dpkg::Build::Info');
 }
 
-is(scalar Dpkg::Build::Info::get_build_env_allowed(), 50,
+is(scalar Dpkg::Build::Info::get_build_env_allowed(), 51,
    'allowed environment variables array');
 
 1;
diff --git a/scripts/t/mk/buildflags.mk b/scripts/t/mk/buildflags.mk
index feed5e31b..90274ef90 100644
--- a/scripts/t/mk/buildflags.mk
+++ b/scripts/t/mk/buildflags.mk
@@ -6,6 +6,7 @@ test:
        test "$(CFLAGS)" = "$(TEST_CFLAGS)"
        test "$(CPPFLAGS)" = "$(TEST_CPPFLAGS) -DTEST_MK=test"
        test "$(CXXFLAGS)" = "$(TEST_CXXFLAGS)"
+       test "$(DFLAGS)" = "$(TEST_DFLAGS)"
        test "$(FCFLAGS)" = "$(TEST_FCFLAGS)"
        test "$(FFLAGS)" = "$(TEST_FFLAGS)"
        test "$(GCJFLAGS)" = "$(TEST_GCJFLAGS)"

-- 
Dpkg.Org's dpkg

Reply via email to