Alien-Build-Plugin-Build-Premake5
view release on metacpan or search on metacpan
lib/Alien/Build/Plugin/Build/Premake5.pm view on Meta::CPAN
);
$meta->apply_plugin( 'Build::Make', make_type => 'gmake' );
$meta->interpolator->replace_helper(
premake5 => sub {
require Alien::premake5;
my @cmd = Alien::premake5->exe;
foreach my $key (qw( cc dc dotnet file os scripts systemscript )) {
my $val = $self->$key;
next unless defined $val;
next if $key eq 'os' and $val eq $self->os_string;
push @cmd, "--$key=$val" if $val;
}
foreach my $key (qw( fatal insecure verbose )) {
push @cmd, "--$key" if defined $self->$key;
}
return join ' ', @cmd;
},
);
$meta->interpolator->add_helper(
premake => $meta->interpolator->has_helper('premake5'),
);
$meta->default_hook(
build => [
'%{premake5} ' . $self->action,
'%{make}',
'%{make} install',
]
);
}
sub os_string {
my ($self) = shift;
my $os = '';
for ($^O) {
if (/aix/i) { $os = 'aix' }
elsif (/bsd/i) { $os = 'bsd' }
elsif (/darwin/i) { $os = 'macosx' }
elsif (/haiku/i) { $os = 'haiku' }
elsif (/hurd/i) { $os = 'hurd' }
elsif (/linux/i) { $os = 'linux' }
elsif (/mswin32/i) { $os = 'windows' }
elsif (/solaris/i) { $os = 'solaris' }
}
return $os;
}
1;
__END__
=encoding utf8
=head1 NAME
Alien::Build::Plugin::Build::Premake5 - Premake5 build plugin for Alien::Build
=head1 SYNOPSIS
use alienfile;
plugin 'Build::Premake5';
=head1 DESCRIPTION
This plugin provides tools to build projects that use premake5. In particular,
it adds the C<%{premake5}> helper, which can be used in L<alienfile> recipes,
and adds a default build stage with the following commands:
'%{premake} ' . $action,
'%{make}',
'%{make} install',
Since premake5 requires gmake, loading this plugin will also load the
L<Build::Make|https://metacpan.org/pod/Alien::Build::Plugin::Build::Make>
plugin with its C<make_type> option set to "gmake".
=head1 OPTIONS
With the exception of the B<action> property, this plugin's options follow
those of the C<premake5> client. For more information, consult the client's
documentation.
=over 4
=item B<action>
Specify the action for premake5. This defaults to "gmake", but is only really
used in the default build phase. If you are providing your own build phase,
then the value of this property will largely be ignored.
For a list of valid actions, check the premake5 client's documentation.
=back
=head2 Flags
These flags can only be set to true or false. They will be ignored if false.
=over 4
=item B<fatal>
Treat warnings from project scripts as errors.
=item B<insecure>
Forfeit SSH certification checks.
=item B<verbose>
Generate extra debug text output.
( run in 0.668 second using v1.01-cache-2.11-cpan-119454b85a5 )