[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

dpkg-buildpackage vendor hook for environment variable changes?

I'd like to add a vendor hook to dpkg-buildpackage for changing default
environment variables. The Ubuntu diff I'm trying to eradicate is as

diff -Nru dpkg-1.14.24/scripts/dpkg-buildpackage.pl dpkg-1.14.24ubuntu1/scripts/dpkg-buildpackage.pl
--- dpkg-1.14.24/scripts/dpkg-buildpackage.pl	2008-12-26 04:49:01.000000000 +0000
+++ dpkg-1.14.24ubuntu1/scripts/dpkg-buildpackage.pl	2009-01-07 12:10:33.000000000 +0000
@@ -261,7 +261,7 @@
 	      CFLAGS   => $default_flags,
 	      CXXFLAGS => $default_flags,
 	      FFLAGS   => $default_flags,
-	      LDFLAGS  => '',
+	      LDFLAGS  => '-Wl,-Bsymbolic-functions',
 foreach my $flag (keys %flags) {

(There is another pile of stuff for hardening-wrapper, but I've just
read #489771 again and have no particular desire to get into that
massive can of worms right now. I very much do not approve of
deprecating the debian/rules interface, but I do think this sort of
thing is a fairly reasonable way for Ubuntu's buildds to set certain
kinds of defaults without having to modify every package in the archive,
and for users to be able to replicate this behaviour reasonably
straightforwardly, until and unless we invent some way for packages to
do this explicitly in debian/rules in a way that's as easy to customise
across the archive.)

How about something like this:

  =item default-build-flags ($flags)

  The first parameter is a reference to a hash of environment variable
  names to their default values. The hook is called by dpkg-buildpackage
  immediately before setting default values in the environment.

The hook implementation could then be something like:

    my $flags = shift @params;
    $flags->{LDFLAGS} = '-Wl,-Bsymbolic-functions';

If this makes sense to people, I can put together a patch.


Colin Watson                                       [cjwatson@ubuntu.com]

Reply to: