Package: debhelper
Version: 7.3.15
Severity: wishlist
Tags: patch

Hello,

This patch adds a generic -O/--buildsystem-option option to dh_auto_* which
allows to set arbitrary build system specific options/settings. It is up to
buildsystem how/whether to use them or not.

While none built-in build system needs this at the moment, it is a logical
addition to the framework. What is more, I have a use case for my own build
system.

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-rc6-amd64 (SMP w/1 CPU core)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages debhelper depends on:
ii  binutils              2.19.51.20090805-1 The GNU assembler, linker and bina
ii  dpkg-dev              1.15.3.1           Debian package development tools
ii  file                  5.03-1             Determines file type using "magic"
ii  html2text             1.3.2a-14          advanced HTML to text converter
ii  man-db                2.5.5-3            on-line manual pager
ii  perl                  5.10.0-25          Larry Wall's Practical Extraction 
ii  perl-base             5.10.0-25          minimal Perl system
ii  po-debconf            1.0.16             tool for managing templates file t

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make                       <none>     (no description available)

-- no debconf information
--- Begin Message ---
This patch adds a generic -O/--buildsystem-option option to dh_auto_* which
allows to set arbitrary build system specific options/settings. It is up to
buildsystem how/whether to use them or not.

Signed-off-by: Modestas Vainius <modes...@vainius.eu>

---
 Debian/Debhelper/Buildsystem.pm     |   16 ++++++++++++++++
 Debian/Debhelper/Dh_Buildsystems.pm |    7 +++++++
 debhelper.pod                       |   11 +++++++++++
 3 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm
index 62c45b5..bba4282 100644
--- a/Debian/Debhelper/Buildsystem.pm
+++ b/Debian/Debhelper/Buildsystem.pm
@@ -58,6 +58,7 @@ sub new {
 
        my $this = bless({ sourcedir => '.',
                           builddir => undef,
+                          options => {},
                           cwd => Cwd::getcwd() }, $class);
 
        if (exists $opts{sourcedir}) {
@@ -71,6 +72,9 @@ sub new {
        if (exists $opts{builddir}) {
                $this->_set_builddir($opts{builddir});
        }
+       if (exists $opts{options}) {
+               $this->{options} = $opts{options};
+       }
        return $this;
 }
 
@@ -261,6 +265,18 @@ sub get_build_rel2sourcedir {
        return $dir;
 }
 
+sub exists_option {
+       my $this=shift;
+       my $option=shift;
+       return exists $this->{options}{$option};
+}
+
+sub get_option_value {
+       my $this=shift;
+       my $option=shift;
+       return $this->{options}{$option};
+}
+
 # Creates a build directory.
 sub mkdir_builddir {
        my $this=shift;
diff --git a/Debian/Debhelper/Dh_Buildsystems.pm 
b/Debian/Debhelper/Dh_Buildsystems.pm
index 4986267..b64496c 100644
--- a/Debian/Debhelper/Dh_Buildsystems.pm
+++ b/Debian/Debhelper/Dh_Buildsystems.pm
@@ -30,6 +30,7 @@ my $opt_buildsys;
 my $opt_sourcedir;
 my $opt_builddir;
 my $opt_list;
+my %opt_buildsys_options;
 
 sub create_buildsystem_instance {
        my $system=shift;
@@ -47,6 +48,9 @@ sub create_buildsystem_instance {
        if (!exists $bsopts{sourcedir} && defined $opt_sourcedir) {
                $bsopts{sourcedir} = ($opt_sourcedir eq "") ? undef : 
$opt_sourcedir;
        }
+       if (!exists $bsopts{options}) {
+               $bsopts{options} = \%opt_buildsys_options;
+       }
        return $module->new(%bsopts);
 }
 
@@ -120,6 +124,9 @@ sub buildsystems_init {
            "S=s" => \$opt_buildsys,
            "buildsystem=s" => \$opt_buildsys,
 
+           "O:s" => \%opt_buildsys_options,
+           "buildsystem-option:s" => \%opt_buildsys_options,
+
            "l" => \$opt_list,
            "list" => \$opt_list,
        );
diff --git a/debhelper.pod b/debhelper.pod
index cea5283..298ef57 100644
--- a/debhelper.pod
+++ b/debhelper.pod
@@ -209,6 +209,17 @@ If the build system prefers out of source tree building 
but still
 allows in source building, the latter can be re-enabled by passing a build
 directory path that is the same as the source directory path.
 
+=item B<-O>I<option[=value]>, B<--buildsystem-option>=I<option[=value]>
+
+Set a build system specific I<option>. If I<value> is specified, it will be
+assigned to the I<option>. I<-O> can be used multiple times to set multiple
+build system options. If the same I<option> is specified more than once, the
+I<value> of the last specification will be used.
+
+It is completely up to the build system implementation how to interpret (or
+ignore) each option. For more information, consult documentation of the build
+system you intend to use.
+
 =item B<--list>, B<-l>
 
 List all build systems supported by debhelper on this system. The list
-- 
tg: (aaa7cd5..) patch/builsystem_options (depends on: master)

--- End Message ---

Reply via email to