summaryrefslogtreecommitdiffstats
path: root/lib/Debian/Debhelper/Buildsystem/ninja.pm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:15:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:15:44 +0000
commit1a42a93b11c48e696446250f2a1f1ca71b350e9b (patch)
tree900e3702d59f6d7cae8f7def94ed5194602f6846 /lib/Debian/Debhelper/Buildsystem/ninja.pm
parentInitial commit. (diff)
downloaddebhelper-1a42a93b11c48e696446250f2a1f1ca71b350e9b.tar.xz
debhelper-1a42a93b11c48e696446250f2a1f1ca71b350e9b.zip
Adding upstream version 13.3.4.upstream/13.3.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/Debian/Debhelper/Buildsystem/ninja.pm')
-rw-r--r--lib/Debian/Debhelper/Buildsystem/ninja.pm90
1 files changed, 90 insertions, 0 deletions
diff --git a/lib/Debian/Debhelper/Buildsystem/ninja.pm b/lib/Debian/Debhelper/Buildsystem/ninja.pm
new file mode 100644
index 0000000..c08ff16
--- /dev/null
+++ b/lib/Debian/Debhelper/Buildsystem/ninja.pm
@@ -0,0 +1,90 @@
+# 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(%dh 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
+ # Ninja files are created (or live) in the build directory.
+ return 1;
+ }
+ return 0;
+}
+
+sub build {
+ my $this=shift;
+ my %options = (
+ update_env => {
+ 'LC_ALL' => 'C.UTF-8',
+ }
+ );
+ if (!$dh{QUIET}) {
+ unshift @_, "-v";
+ }
+ if ($this->get_parallel() > 0) {
+ unshift @_, "-j" . $this->get_parallel();
+ }
+ $this->doit_in_builddir(\%options, $this->{buildcmd}, @_);
+}
+
+sub test {
+ my $this=shift;
+ my %options = (
+ update_env => {
+ 'LC_ALL' => 'C.UTF-8',
+ }
+ );
+ if ($this->get_parallel() > 0) {
+ $options{update_env}{MESON_TESTTHREADS} = $this->get_parallel();
+ }
+ $this->doit_in_builddir(\%options, $this->{buildcmd}, "test", @_);
+}
+
+sub install {
+ my $this=shift;
+ my $destdir=shift;
+ my %options = (
+ update_env => {
+ 'LC_ALL' => 'C.UTF-8',
+ 'DESTDIR' => $destdir,
+ }
+ );
+ $this->doit_in_builddir(\%options, $this->{buildcmd}, "install", @_);
+}
+
+sub clean {
+ my $this=shift;
+ if (!$this->rmdir_builddir()) {
+ my %options = (
+ update_env => {
+ 'LC_ALL' => 'C.UTF-8',
+ }
+ );
+ $this->doit_in_builddir(\%options, $this->{buildcmd}, "clean", @_);
+ }
+}
+
+1