Attaching a newer version of the patch that does a better search for the options. The search should be put probably on a subroutine, but I'm not really sure where, and there is only one build option for now, so it's not a major problem.
-- Felipe Sateler
From ab2945d9147938ef83a7e05922d995d66afc4a61 Mon Sep 17 00:00:00 2001
From: Felipe Sateler <[EMAIL PROTECTED]>
Date: Thu, 14 Feb 2008 01:11:11 -0300
Subject: [PATCH] Add support for Build-Options.
Add Build-Options as a legal keyword in the source control file.
Also implement build-arch as the first build option. This option
causes dpkg-buildpackage to call debian/rules with the build-arch
target if called with the -B option.
---
scripts/Dpkg/Fields.pm | 2 +-
scripts/dpkg-buildpackage.pl | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/scripts/Dpkg/Fields.pm b/scripts/Dpkg/Fields.pm
index a41fab7..64ad047 100644
--- a/scripts/Dpkg/Fields.pm
+++ b/scripts/Dpkg/Fields.pm
@@ -15,7 +15,7 @@ our %EXPORT_TAGS = ('list' => [qw(%control_src_fields %control_pkg_fields
# Some variables (list of fields)
our %control_src_fields;
our %control_pkg_fields;
-$control_src_fields{$_} = 1 foreach (qw(Bugs Dm-Upload-Allowed
+$control_src_fields{$_} = 1 foreach (qw(Bugs Build-Options Dm-Upload-Allowed
Homepage Origin Maintainer Priority Section Source Standards-Version
Uploaders Vcs-Browser Vcs-Arch Vcs-Bzr Vcs-Cvs Vcs-Darcs Vcs-Git Vcs-Hg
Vcs-Mtn Vcs-Svn));
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 6e1dc0e..cc1e28d 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -14,6 +14,7 @@ use Dpkg::BuildOptions;
use Dpkg::Compression;
use Dpkg::Version qw(check_version);
use Dpkg::Changelog qw(parse_changelog);
+use Dpkg::Control;
textdomain("dpkg-dev");
@@ -99,6 +100,7 @@ my $checkbuilddep = 1;
my $signsource = 1;
my $signchanges = 1;
my $diffignore = '';
+my $buildtarget = 'build';
my $binarytarget = 'binary';
my $targetarch = my $targetgnusystem = '';
@@ -320,6 +322,15 @@ unless ($sourceonly) {
my $pv = "${pkg}_$sversion";
my $pva = "${pkg}_${sversion}_$arch";
+my $source = Dpkg::Control->new()->get_source();
+if (defined($source->{"Build-Options"}) ) {
+ # The build options are comma-separated, with optional spaces
+ my @build_options = split( / *, */, $source->{"Build-Options"} );
+ if( grep(/\bbuild-arch\b/, @build_options) && $binaryonly eq "-B") {
+ $buildtarget = "build-arch";
+ }
+}
+
if ($checkbuilddep) {
if ($admindir) {
push @checkbuilddep_args, "--admindir=$admindir";
@@ -350,7 +361,7 @@ unless ($binaryonly) {
chdir($dir) or failure("chdir $dir");
}
unless ($sourceonly) {
- withecho(@debian_rules, 'build');
+ withecho(@debian_rules, $buildtarget);
withecho(@rootcommand, @debian_rules, $binarytarget);
}
if ($usepause &&
--
1.5.4.4
signature.asc
Description: This is a digitally signed message part.

