Added two variants with system wide waf and package supplied one. The waf scripts as distributed in projects are DFSG-free. So that's not an issue. Preferring system-wide one in case of security updates. Providing package supplied one in case project depends on that version of waf, or it has modified waf script itself instead of extending it using waffles (local python modules).
>From b8d6ffdf0790065f5d72de636f48eebf8cbe73dc Mon Sep 17 00:00:00 2001 From: Ryan Niebur <ryanrya...@gmail.com> Date: Sun, 20 Dec 2009 00:56:56 +0000 Subject: [PATCH] Waf build system support. Added waf.pm by Ryan Niebur <ryanrya...@gmail.com> Updated checks in autodetection. Enabled parallel builds. Added second waf variant. Increased amount of expected buildsystem tests. --- Debian/Debhelper/Buildsystem/waf.pm | 70 +++++++++++++++++++++++++++++++ Debian/Debhelper/Buildsystem/waf_src.pm | 26 +++++++++++ Debian/Debhelper/Dh_Buildsystems.pm | 2 + t/buildsystems/buildsystem_tests | 2 +- 4 files changed, 99 insertions(+), 1 deletions(-) create mode 100644 Debian/Debhelper/Buildsystem/waf.pm create mode 100644 Debian/Debhelper/Buildsystem/waf_src.pm diff --git a/Debian/Debhelper/Buildsystem/waf.pm b/Debian/Debhelper/Buildsystem/waf.pm new file mode 100644 index 0000000..98d1008 --- /dev/null +++ b/Debian/Debhelper/Buildsystem/waf.pm @@ -0,0 +1,70 @@ +# A debhelper build system class for handling Waf based projects. +# Copyright: © 2009 Ryan Niebur +# © 2009 Dmitrijs Ledkovs +# License: GPL-2+ + +package Debian::Debhelper::Buildsystem::waf; + +use strict; +use base 'Debian::Debhelper::Buildsystem'; + +sub DESCRIPTION { + "waf using system-installed script"; +} + +sub DEFAULT_BUILD_DIRECTORY { + my $this=shift; + return $this->canonpath($this->get_sourcepath("build")); +} + +sub check_auto_buildable { + my ( $this, $step ) = @_; + return -e $this->get_sourcepath("wscript") ? 1 : 0; +} + +sub new { + my $class = shift; + my $this = $class->SUPER::new(@_); + # Out of source tree building is prefered. + $this->prefer_out_of_source_building(@_); + return $this; +} + +sub _do_waf { + my $this = shift; + unshift @_, "-j" . ($this->get_parallel() > 0 ? $this->get_parallel() : ""); + return $this->doit_in_sourcedir( "/usr/bin/waf", "--nocache", @_ ); +} + +sub configure { + my $this = shift; + $this->_do_waf( "configure", + "--prefix=/usr", + "-b", $this->get_build_rel2sourcedir(), + @_ ); +} + +sub test { + my $this = shift; + #waf documentation suggestes to perform tests in the shutdown procedure + #which is run unconditionally on sucessful builds. + $this->_do_waf( @_ ); +} + +sub install { + my $this = shift; + my $destdir = shift; + $this->_do_waf( "install", "--destdir", $destdir, @_ ); +} + +sub build { + my $this = shift; + $this->_do_waf( "build", @_ ); +} + +sub clean { + my $this = shift; + $this->_do_waf( "distclean", @_ ); +} + +1; diff --git a/Debian/Debhelper/Buildsystem/waf_src.pm b/Debian/Debhelper/Buildsystem/waf_src.pm new file mode 100644 index 0000000..00632af --- /dev/null +++ b/Debian/Debhelper/Buildsystem/waf_src.pm @@ -0,0 +1,26 @@ +# A debhelper build system class for handling Waf based projects. +# Copyright: © 2009 Dmitrijs Ledkovs +# License: GPL-2+ + +package Debian::Debhelper::Buildsystem::waf_src; + +use strict; +use base 'Debian::Debhelper::Buildsystem::waf'; + +sub DESCRIPTION { + "waf using source directory script"; +} + +sub check_auto_buildable { + my ( $this, $step ) = @_; + #TODO check that waf is executable or run as "python waf"? + return -e $this->get_sourcepath("waf") && -e $this->get_sourcepath("wscript") ? 1 : 0; +} + +sub _do_waf { + my $this = shift; + unshift @_, "-j" . ($this->get_parallel() > 0 ? $this->get_parallel() : ""); + return $this->doit_in_sourcedir( "./waf", "--nocache", @_ ); +} + +1 diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index 0f34a2e..07c8af0 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -26,6 +26,8 @@ our @BUILDSYSTEMS = ( "perl_build", "cmake", "ant", + "waf", + "waf_src", ); my $opt_buildsys; diff --git a/t/buildsystems/buildsystem_tests b/t/buildsystems/buildsystem_tests index 84741a4..820773d 100755 --- a/t/buildsystems/buildsystem_tests +++ b/t/buildsystems/buildsystem_tests @@ -1,6 +1,6 @@ #!/usr/bin/perl -use Test::More tests => 295; +use Test::More tests => 305; use strict; use warnings; -- 1.6.3.3 -- With best regards Dmitrijs Ledkovs (for short Dima), Ледков Дмитрий Юрьевич () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org