summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog3
-rw-r--r--man/dpkg-buildflags.121
-rw-r--r--scripts/Dpkg/BuildFlags.pm47
3 files changed, 58 insertions, 13 deletions
diff --git a/debian/changelog b/debian/changelog
index 37b32ba..af59f63 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -92,7 +92,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
Closes: #615899
* dpkg-buildflags now supports "--export=configure" to output compilation
flags on a single line with double quotes as delimiter of the various
- values.
+ values. It also uses DEB_<flag>_MAINT_<op> to let the maintainer
+ extend the build flags to use.
[ Guillem Jover ]
* Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520
diff --git a/man/dpkg-buildflags.1 b/man/dpkg-buildflags.1
index e1fef4b..b885974 100644
--- a/man/dpkg-buildflags.1
+++ b/man/dpkg-buildflags.1
@@ -18,7 +18,11 @@ system-wide with \fB/etc/dpkg/buildflags.conf\fP;
for the current user with \fB$XDG_CONFIG_HOME/dpkg/buildflags.conf\fP
where \fB$XDG_CONFIG_HOME\fP defaults to \fB$HOME/.config\fP;
.IP 3.
-temporarily by the user with environment variables (see section \fBENVIRONMENT\fP).
+temporarily by the user with environment variables (see section
+\fBENVIRONMENT\fP);
+.IP 4.
+dynamically by the package maintainer with environment variables set via
+\fBdebian/rules\fP (see section \fBENVIRONMENT\fP).
.P
The configuration files can contain two types of directives:
.TP
@@ -119,19 +123,28 @@ System wide configuration file.
.BR $XDG_CONFIG_HOME/dpkg/buildflags.conf " or " $HOME/.config/dpkg/buildflags.conf
User configuration file.
.SH ENVIRONMENT
-Those environment variables should not be set by official packages, they
-are meant for users who are recompiling a Debian package and would like to
-change the compilation flags.
+There are 2 sets of environment variables doing the same operations, the
+first one (DEB_\fIflag\fP_\fIop\fP) should never be used within
+\fBdebian/rules\fP. It's meant for any user that wants to rebuild the
+source package with different build flags. The second set
+(DEB_\fIflag\fP_MAINT_\fIop\fP) should only be used in \fBdebian/rules\fP
+by package maintainers to change the resulting build flags.
.TP
.BI DEB_ flag _SET
+.TQ
+.BI DEB_ flag _MAINT_SET
This variable can be used to force the value returned for the given
\fIflag\fP.
.TP
.BI DEB_ flag _APPEND
+.TQ
+.BI DEB_ flag _MAINT_APPEND
This variable can be used to append supplementary options to the value
returned for the given \fIflag\fP.
.TP
.BI DEB_ flag _PREPEND
+.TQ
+.BI DEB_ flag _MAINT_PREPEND
This variable can be used to prepend supplementary options to the value
returned for the given \fIflag\fP.
.
diff --git a/scripts/Dpkg/BuildFlags.pm b/scripts/Dpkg/BuildFlags.pm
index e23db4b..81062f5 100644
--- a/scripts/Dpkg/BuildFlags.pm
+++ b/scripts/Dpkg/BuildFlags.pm
@@ -115,7 +115,7 @@ sub load_user_config {
=item $bf->load_environment_config()
-Update flags based on directives stored in the environment. See
+Update flags based on user directives stored in the environment. See
dpkg-buildflags(1) for details.
=cut
@@ -138,11 +138,37 @@ sub load_environment_config {
}
}
+=item $bf->load_maintainer_config()
+
+Update flags based on maintainer directives stored in the environment. See
+dpkg-buildflags(1) for details.
+
+=cut
+
+sub load_maintainer_config {
+ my ($self) = @_;
+ foreach my $flag (keys %{$self->{flags}}) {
+ my $envvar = "DEB_" . $flag . "_MAINT_SET";
+ if (exists $ENV{$envvar}) {
+ $self->set($flag, $ENV{$envvar}, undef);
+ }
+ $envvar = "DEB_" . $flag . "_MAINT_APPEND";
+ if (exists $ENV{$envvar}) {
+ $self->append($flag, $ENV{$envvar}, undef);
+ }
+ $envvar = "DEB_" . $flag . "_MAINT_PREPEND";
+ if (exists $ENV{$envvar}) {
+ $self->prepend($flag, $ENV{$envvar}, undef);
+ }
+ }
+}
+
+
=item $bf->load_config()
-Call successively load_system_config(), load_user_config() and
-load_environment_config() to update the default build flags
-defined by the vendor.
+Call successively load_system_config(), load_user_config(),
+load_environment_config() and load_maintainer_config() to update the
+default build flags defined by the vendor.
=cut
@@ -151,24 +177,26 @@ sub load_config {
$self->load_system_config();
$self->load_user_config();
$self->load_environment_config();
+ $self->load_maintainer_config();
}
=item $bf->set($flag, $value, $source)
-Update the build flag $flag with value $value and record its origin as $source.
+Update the build flag $flag with value $value and record its origin as
+$source (if defined).
=cut
sub set {
my ($self, $flag, $value, $src) = @_;
$self->{flags}->{$flag} = $value;
- $self->{origin}->{$flag} = $src;
+ $self->{origin}->{$flag} = $src if defined $src;
}
=item $bf->append($flag, $value, $source)
Append the options listed in $value to the current value of the flag $flag.
-Record its origin as $source.
+Record its origin as $source (if defined).
=cut
@@ -179,7 +207,7 @@ sub append {
} else {
$self->{flags}->{$flag} = $value;
}
- $self->{origin}->{$flag} = $src;
+ $self->{origin}->{$flag} = $src if defined $src;
}
=item $bf->prepend($flag, $value, $source)
@@ -292,6 +320,9 @@ sub list {
New method: $bf->prepend() very similar to append(). Implement support of
the prepend operation everywhere.
+New method: $bf->load_maintainer_config() that update the build flags
+based on the package maintainer directives.
+
=head1 AUTHOR
Raphaƫl Hertzog <hertzog@debian.org>