<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># 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-&gt;SUPER::new(@_);
	$this-&gt;{buildcmd} = "ninja";
	return $this;
}

sub check_auto_buildable {
	my $this=shift;
	my ($step) = @_;

	if (-e $this-&gt;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 =&gt; {
			'LC_ALL' =&gt; 'C.UTF-8',
		}
	);
	if (!$dh{QUIET}) {
		unshift @_, "-v";
	}
	if ($this-&gt;get_parallel() &gt; 0) {
		unshift @_, "-j" . $this-&gt;get_parallel();
	}
	$this-&gt;doit_in_builddir(\%options, $this-&gt;{buildcmd}, @_);
}

sub test {
	my $this=shift;
	my %options = (
		update_env =&gt; {
			'LC_ALL' =&gt; 'C.UTF-8',
		}
	);
	if ($this-&gt;get_parallel() &gt; 0) {
		$options{update_env}{MESON_TESTTHREADS} = $this-&gt;get_parallel();
	}
	$this-&gt;doit_in_builddir(\%options, $this-&gt;{buildcmd}, "test", @_);
}

sub install {
	my $this=shift;
	my $destdir=shift;
	my %options = (
		update_env =&gt; {
			'LC_ALL'  =&gt; 'C.UTF-8',
			'DESTDIR' =&gt; $destdir,
		}
	);
	$this-&gt;doit_in_builddir(\%options, $this-&gt;{buildcmd}, "install", @_);
}

sub clean {
	my $this=shift;
	if (!$this-&gt;rmdir_builddir()) {
		my %options = (
			update_env =&gt; {
				'LC_ALL'  =&gt; 'C.UTF-8',
			}
		);
		$this-&gt;doit_in_builddir(\%options, $this-&gt;{buildcmd}, "clean", @_);
	}
}

1
</pre></body></html>