On Mon, Feb 11, 2008 at 05:39:10PM +0100, Matthias Klose wrote:
Content-Description: message body text
> Package: dpkg-dev
> Severity: wishlist
> 
> Please find attached a patch which implements setting a set of
> compiler flags for a build; this was first announced in
> http://lists.debian.org/debian-devel/2007/12/msg00090.html
> Now simpliefied to just use the CFLAGS/CFLAGS_APPEND naming by Colin
> Watson.

Maybe more like this (still missing l10n, but a lot less code
duplication):

diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 72854dd..a550f4c 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -242,9 +242,8 @@ if ($signcommand) {
     }
 }
 
+my $build_opts = Dpkg::BuildOptions::parse();
 if ($parallel) {
-    my $build_opts = Dpkg::BuildOptions::parse();
-
     $parallel = $build_opts->{parallel} if (defined $build_opts->{parallel});
     $ENV{MAKEFLAGS} ||= '';
     if ($parallel eq '-1') {
@@ -256,6 +255,26 @@ if ($parallel) {
     Dpkg::BuildOptions::set($build_opts);
 }
 
+my $default_flags = defined $build_opts->{noopt} ? "-g -O0" : "-g -O2";
+my %flags = ( CPPFLAGS => '',
+             CFLAGS   => $default_flags,
+             CXXFLAGS => $default_flags,
+             FFLAGS   => $default_flags,
+             LDFLAGS  => "-Wl,-Bsymbolic-functions",
+    );
+
+foreach my $flag (keys %flags) {
+    if ($ENV{${flag}}) {
+       print "$progname: use ${flag} from environment: $ENV{${flag}}\n";
+    } else {
+       $ENV{${flag}} = $flags{$flag};
+       print "$progname: set ${flag} to default value: $ENV{${flag}}\n";
+    }
+    if ($ENV{"${flag}_APPEND"}) {
+       $ENV{${flag}} .= " ".$ENV{"${flag}_APPEND"};
+    }
+}
+
 my $cwd = cwd();
 my $dir = basename($cwd);
 
Gruesse,
-- 
Frank Lichtenheld <[EMAIL PROTECTED]>
www: http://www.djpig.de/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to