#!/usr/bin/perl

use strict;
use warnings;

use Debian::Debhelper::Dh_Lib;

=head1 NAME

dh_raku_build -- automatically build Raku module packages

=head1 SYNOPSIS

B<dh_raku_build>

=head1 DESCRIPTION

This script will call C<prove6 -l -v> to self-build a Raku module package. It will
only do so if three conditions are met:

=over

=item *

A 't' directory exists

=item *

raku-tap-harness is installed, typically by adding it to the build-depencies
of the package being built

=item *

The debhelper build option 'nocheck' is not set

=back

=head1 SEE ALSO

L<debhelper>(7), L<dh>(1)

=cut

init();

foreach my $pkg (getpackages()) {
    nonquiet_print("Pre-compiling $pkg");

    $ENV{'RAKUDO_RERESOLVE_DEPENDENCIES'} = 0;
    my @cmd = qw!perl6 /usr/share/perl6/tools/install-dist.p6 --for=vendor
                 --from=. --to=debian/tmp/pre-compiled!;
    doit(@cmd);
}
