[debhelper-devel] [debhelper] 01/01: Intial attempt at Meson support
Michael Biebl
biebl at moszumanska.debian.org
Fri Mar 24 00:03:44 UTC 2017
This is an automated email from the git hooks/post-receive script.
biebl pushed a commit to branch biebl/meson
in repository debhelper.
commit 79548276d784bc7212a901bba3ff6fae59ace904
Author: Michael Biebl <biebl at debian.org>
Date: Fri Mar 24 00:37:16 2017 +0100
Intial attempt at Meson support
NOT READY YET
Closes: #795253
---
Debian/Debhelper/Buildsystem/meson.pm | 81 +++++++++++++++++++++++++++++++++++
Debian/Debhelper/Buildsystem/ninja.pm | 77 +++++++++++++++++++++++++++++++++
Debian/Debhelper/Dh_Buildsystems.pm | 1 +
3 files changed, 159 insertions(+)
diff --git a/Debian/Debhelper/Buildsystem/meson.pm b/Debian/Debhelper/Buildsystem/meson.pm
new file mode 100644
index 0000000..90c0fcd
--- /dev/null
+++ b/Debian/Debhelper/Buildsystem/meson.pm
@@ -0,0 +1,81 @@
+# A debhelper build system class for handling Meson based projects.
+#
+# Copyright: © 2017 Michael Biebl
+# License: GPL-2+
+
+package Debian::Debhelper::Buildsystem::meson;
+
+use strict;
+use warnings;
+use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value sourcepackage compat);
+use parent qw(Debian::Debhelper::Buildsystem::ninja);
+
+sub DESCRIPTION {
+ "Meson (meson.build)"
+}
+
+sub check_auto_buildable {
+ my $this=shift;
+ my ($step)=@_;
+
+ return 0 unless -e $this->get_sourcepath("meson.build");
+
+ # Handle configure explicitly; inherit the rest
+ return 1 if $step eq "configure";
+ return $this->SUPER::check_auto_buildable(@_);
+}
+
+sub new {
+ my $class=shift;
+ my $this=$class->SUPER::new(@_);
+ $this->prefer_out_of_source_building(@_);
+ return $this;
+}
+
+sub configure {
+ my $this=shift;
+
+ # Standard set of options for meson.
+ my @opts;
+ push @opts, "--buildtype=plain";
+ push @opts, "--prefix=/usr";
+ push @opts, "--sysconfdir=/etc";
+ push @opts, "--localstatedir=/var";
+ my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH");
+ if (! compat(8)) {
+ if (defined $multiarch) {
+ push @opts, "--libdir=lib/$multiarch";
+ push @opts, "--libexecdir=lib/$multiarch";
+ }
+ else {
+ push @opts, "--libexecdir=lib";
+ }
+ }
+ else {
+ push @opts, "--libexecdir=lib/" . sourcepackage();
+ }
+
+ $this->mkdir_builddir();
+ eval {
+ $this->doit_in_builddir("meson", $this->get_source_rel2builddir(), @opts, @_);
+ };
+ if ($@) {
+ if (-e $this->get_buildpath("meson-logs/meson-log.txt")) {
+ $this->doit_in_builddir("tail -v -n +0 meson-logs/meson-log.txt");
+ }
+ die $@;
+ }
+}
+
+sub test {
+ my $this=shift;
+ return $this->SUPER::test(@_);
+}
+
+1
+
+# Local Variables:
+# indent-tabs-mode: t
+# tab-width: 4
+# cperl-indent-level: 4
+# End:
diff --git a/Debian/Debhelper/Buildsystem/ninja.pm b/Debian/Debhelper/Buildsystem/ninja.pm
new file mode 100644
index 0000000..81bc58c
--- /dev/null
+++ b/Debian/Debhelper/Buildsystem/ninja.pm
@@ -0,0 +1,77 @@
+# A debhelper build system class for handling ninja based projects.
+#
+# Copyright: © 2017 Michael Biebl
+# License: GPL-2+
+
+package Debian::Debhelper::Buildsystem::ninja;
+
+use strict;
+use warnings;
+use Debian::Debhelper::Dh_Lib qw(dpkg_architecture_value);
+use parent qw(Debian::Debhelper::Buildsystem);
+
+sub DESCRIPTION {
+ "Ninja (build.ninja)"
+}
+
+sub new {
+ my $class=shift;
+ my $this=$class->SUPER::new(@_);
+ $this->{buildcmd} = "ninja";
+ return $this;
+}
+
+sub check_auto_buildable {
+ my $this=shift;
+ my ($step) = @_;
+
+ if (-e $this->get_buildpath("build.ninja"))
+ {
+ # This is always called in the source directory, but generally
+ # Makefiles are created (or live) in the build directory.
+ return 1;
+ } elsif ($step eq "clean" && defined $this->get_builddir() &&
+ $this->check_auto_buildable("configure"))
+ {
+ # Assume that the package can be cleaned (i.e. the build directory can
+ # be removed) as long as it is built out-of-source tree and can be
+ # configured. This is useful for derivative buildsystems which
+ # generate Makefiles.
+ return 1;
+ }
+ return 0;
+}
+
+sub build {
+ my $this=shift;
+ unshift @_,
+ $this->doit_in_builddir($this->{buildcmd}, "-v", @_);
+}
+
+sub test {
+ my $this=shift;
+ $this->doit_in_builddir($this->{buildcmd}, "test", @_);
+}
+
+sub install {
+ my $this=shift;
+ my $destdir=shift;
+
+ $ENV{DESTDIR}=$destdir;
+ $this->doit_in_builddir($this->{buildcmd}, "install", @_);
+}
+
+sub clean {
+ my $this=shift;
+ if (!$this->rmdir_builddir()) {
+ $this->doit_in_builddir($this->{buildcmd}, "clean", @_);
+ }
+}
+
+1
+
+# Local Variables:
+# indent-tabs-mode: t
+# tab-width: 4
+# cperl-indent-level: 4
+# End:
diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm
index a2424c7..8004dbd 100644
--- a/Debian/Debhelper/Dh_Buildsystems.pm
+++ b/Debian/Debhelper/Dh_Buildsystems.pm
@@ -29,6 +29,7 @@ our @BUILDSYSTEMS = (
"ant",
"qmake",
"qmake_qt4",
+ "meson",
);
our @THIRD_PARTY_BUILDSYSTEMS = (
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debhelper/debhelper.git
More information about the debhelper-devel
mailing list