summaryrefslogtreecommitdiff
path: root/dh_illumos_make
blob: 2f36a5c4dfc8583b8439950c857b554442e3d45a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#!/usr/bin/perl -w

=head1 NAME

dh_illumos_make - build illumos sources

=cut

use strict;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_illumos_make> [S<I<debhelper options>>] [B<-m>I<make program>]
[B<-t>I<target>] [directories]

=head1 DESCRIPTION

C<dh_illumos_make> is responsible for building illumos sources.
If no directories specified, it will build entire illumos gate (not recommended,
and probably will fail). If directories are given, it will build within those directories
in order. Illumos sources should be previously unpacked with L<dh_illumos_gate(1)>.

=head1 EXAMPLES

    dh_illumos_gate -t install_h usr/src/uts is equivalent to

    cd illumos-gate
    ksh93 bldenv.sh -d illumos.sh -c "cd usr/src/uts && /usr/bin/sunmake install_h"


    dh_illumos_gate -m /opt/SUNWspro/bin/dmake usr/src/lib is equivalent to

    cd illumos-gate
    ksh93 bldenv.sh -d illumos.sh -c "cd usr/src/lib && /opt/SUNWspro/bin/dmake install"


=head1 OPTIONS

=over 4

=item B<-m>I<make program> B<--make=>I<make program>

Make program to use. Default is F</usr/bin/sunmake>.

=item B<-t>I<target> B<--target=>I<target>

Target for I<make program>. Default is C<install> which will build
sources and install into proto area.

=back

=head1 NOTES

If illumos sources were unpacked with L<dh_illumos_gate(1)>,
proto area is F<debian/tmp>.

=cut

$dh{'MAKE'} = '/usr/bin/sunmake';
$dh{'TARGET'} = 'install';

init(options => { 
    'make|m=s'   => \$dh{'MAKE'},
    'target|t=s' => \$dh{'TARGET'},
});

my @dirs = ('usr/src');
if (@ARGV) {
    @dirs = @ARGV;
}

# Check whether all dirs exist before doing anything:
foreach (@dirs) {
    s,.*illumos-gate/+,,;
    if (! -d "illumos-gate/$_") {
        error("`illumos-gate/$_' does not exist or not a directory");
    }
}

# Build in each dir:
chdir('illumos-gate');
# Sanity checks:
foreach (qw/bldenv.sh illumos.sh/) {
    if (! -r $_) {
        error("`$_' not found under illumos-gate. Maybe illumos sources were not properly unpacked.")
    }
}
foreach (@dirs) {
    doit('ksh93', 'bldenv.sh', '-d', 'illumos.sh', '-c', "cd $_ && $dh{'MAKE'} $dh{'TARGET'}");
}

=head1 SEE ALSO

L<debhelper(7)>, L<dh_illumos_gate(1)>.

=head1 AUTHOR

Igor Pashev <pashev.igor@gmail.com>

=cut