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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
#!/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>] [B<--debug>] [B<--without-ctf>] [B<--without-mcs>]
[B<--no-onbld>] [B<--native>]
[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_make -t install_h usr/src/uts is equivalent to
cd illumos-gate
ksh93 bldenv.sh env.sh -c "cd usr/src/uts && /usr/bin/make --sun install_h"
dh_illumos_make -m /opt/SUNWspro/bin/dmake usr/src/lib is equivalent to
cd illumos-gate
ksh93 bldenv.sh env.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/make --sun>.
=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.
=item B<--debug>
Turn on debug build. This will execute
ksh93 bldenv.sh -d env.sh ...
instead of
ksh93 bldenv.sh env.sh ...
=item B<--without-ctf>
Do not use CTF (I<Compact C Type Format>) tools during build.
Every ELF object built from illumos sources should be processed
by these tools, even F<libctf> itself. This option is useful
for bootstrapping when CTF tools are not available. This is
implemented by setting corresponding environment variables to ":".
=item B<--without-mcs>
Do not manipulate the comment section of generated objects during build.
These operations require MCS tool, which may not be available when bootstrapping.
Likewise, variable C<MCS> will be defined as ":".
=item B<--no-onbld>
Do not use C<onbld> tools installed in system (F</opt/onbld>). Normally it only works
and useful for building C<onbld> itself. Otherwise F<illumos-gate/usr/src/tools>
must be unpacked and built before any other component.
If this option is given, F<bldenv.sh> is called with C<-t> option instead of C<+t>.
=item B<--native>
Some components have both 32- and 64-bit versions, others have no architecture
specific versions. Such components assumed to be 32-bit, and on 64-bit system
it is incorrect. With this option C<dh_illumos_make> will build those
components using system native compiler.
=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/make --sun';
$dh{'TARGET'} = 'install';
$dh{'WITHOUT_CTF'} = 0;
$dh{'WITHOUT_MCS'} = 0;
$dh{'NO_ONBLD'} = 0;
init(options => {
'make|m=s' => \$dh{'MAKE'},
'target|t=s' => \$dh{'TARGET'},
'debug' => \$dh{'DEBUG'},
'without-ctf' => \$dh{'WITHOUT_CTF'},
'without-mcs' => \$dh{'WITHOUT_MCS'},
'no-onbld' => \$dh{'NO_ONBLD'},
'native' => \$dh{'NATIVE'},
});
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:
# Sanity checks:
foreach (qw/bldenv.sh env.sh/) {
if (! -r "illumos-gate/$_") {
error("`$_' not found under illumos-gate. Maybe illumos sources were not properly unpacked.")
}
}
my $opts = '';
$opts .= '-d' if $dh{'DEBUG'};
my $onbld = $dh{'NO_ONBLD'} ? '-t' : '+t';
$opts .= $onbld;
my $env = '';
$env .= ' MCS=:' if $dh{'WITHOUT_MCS'};
$env .= ' CTFCONVERT=:' if $dh{'WITHOUT_CTF'};
$env .= ' CTFMERGE=:' if $dh{'WITHOUT_CTF'};
if ($dh{'NATIVE'}) {
$env .= ' i386_XARCH=';
}
foreach (@dirs) {
complex_doit(qq!cd illumos-gate && $env /usr/bin/ksh93 bldenv.sh $opts env.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
|