blob: b2052cad9b03905c840e85d3c492e5f9b470b1a7 (
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
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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
|
#!/bin/ksh
#
# This file and its contents are supplied under the terms of the
# Common Development and Distribution License ("CDDL"), version 1.0.
# You may only use this file in accordance with the terms of version
# 1.0 of the CDDL.
#
# A full copy of the text of the CDDL should have accompanied this
# source. A copy of the CDDL is also available via the Internet at
# http://www.illumos.org/license/CDDL.
#
#
# Copyright 2018 Nexenta Systems, Inc. All rights reserved.
#
# Use distributed make (dmake) by default.
make=${MAKE:-dmake}
CLOSED_IS_PRESENT=no
export CLOSED_IS_PRESENT
[ -n "$SRC" ] || {
echo "SRC not set. Run 'ws' or 'bldenv' first."
exit 1
}
cpu=`uname -p`
case $cpu in
i386)
x=intel
kmdb_arch="amd64"
mdb_arch="ia32 amd64"
arch32=i86
arch64=amd64
;;
sparc)
x=sparc
kmdb_arch=v9
mdb_arch="v7 v9"
arch32=sparc
arch64=sparcv9
;;
*) echo "Huh?" ; exit 1;;
esac
################################################################
build_tools() {
test -f $SRC/tools/proto/root_i386-nd/opt/onbld/bin/genoffsets ||
(cd $SRC/tools && $make install)
(cd $SRC/common/mapfiles; $make install)
}
clobber_tools() {
(cd $SRC/tools && $make clobber)
(cd $SRC/common/mapfiles; $make clobber)
}
################################################################
do_hdrs() {
targ=$1
if [ "$targ" = clobber ]
then
(cd $SRC/uts && $make -k clobber_h)
(cd $SRC/head && $make clobber)
fi
if [ "$targ" = install ]
then
targ=install_h
# Just the parts of "make sgs" we need, and
# skip them if they appear to be done.
# ... stuff under $SRC
test -f $SRC/uts/common/sys/priv_names.h ||
(cd $SRC/uts && $make -k all_h)
test -f $SRC/head/rpcsvc/nispasswd.h ||
(cd $SRC/head && $make -k install_h)
# ... stuff under $ROOT (proto area)
test -d $ROOT/usr/include/sys ||
(cd $SRC && $make rootdirs)
test -f $ROOT/usr/include/sys/types.h ||
(cd $SRC/uts && $make -k install_h)
test -f $ROOT/usr/include/rpcsvc/daemon_utils.h ||
(cd $SRC/head && $make install_h)
# always update the sys headers to be safe
(cd $SRC/uts/common/sys && $make -k install_h)
fi
# Need some library headers too...
for lib in \
libbsm \
libcmdutils \
libcryptoutil \
libdevid \
libdiskmgt \
libidmap \
libpam \
libsec \
libscf \
libshare \
libuutil \
libzpool \
libzfs_core \
libzfs \
libzfs_jni
do
(cd $SRC/lib/$lib && $make $targ)
done
# Should fix the Makefile here so all_h or install_h works.
(cd $SRC/lib/libzpool/$cpu && $make ../common/zfs.h)
}
################################################################
do_kern() {
case $1 in
lint) targ=modlintlib ;;
*) targ=$1 ;;
esac
(cd $SRC/uts/$x/zfs && $make $targ)
}
################################################################
#
# Build all libraries used by the other targets in here.
#
# Run this once (at least) in each new workspace where you
# will run "make-zfs install", if you want to avoid linking
# against the libraries from your build host.
#
do_deplibs() {
# install all the lib headers
if [ "$1" = install ] ; then
(cd $SRC/lib && $make install_h)
fi
# Wow, building libc takes a while. Really want that?
for lib in \
libc \
libavl \
libnvpair \
libsec \
libcmdutils \
libdevinfo \
libuutil \
libbrand \
libzonecfg \
libinetutil \
libdladm \
libdlpi \
libdiskmgt \
libumem \
libdisasm \
libidmap \
libdevid \
libsaveargs
do
(cd $SRC/lib/$lib && $make $1)
done
}
################################################################
do_libs() {
for lib in \
libavl \
libcmdutils \
libuutil \
libzpool \
libzfs_core \
libzfs \
libzfs_jni \
pyzfs
do
(cd $SRC/lib/$lib && $make $1)
done
(cd $SRC/lib/libshare && $make $1 PLUGINS=)
}
################################################################
do_cmds() {
for cmd in \
availdevs \
isaexec \
fstyp \
zdb \
zfs \
zhack \
zinject \
zpool \
ztest \
zstreamdump
do
(cd $SRC/cmd/$cmd && $make $1)
done
case $1 in
install)
# mount programs need fslib.o
(cd $SRC/cmd/fs.d/zfs && $make $1)
# Build just the ZFS devfsadm module
(cd $SRC/cmd/devfsadm/$cpu && $make SUNW_zfs_link.so \
${ROOT}/usr/lib/devfsadm/linkmod \
${ROOT}/usr/lib/devfsadm/linkmod/SUNW_zfs_link.so )
;;
clean|clobber)
(cd $SRC/cmd/fs.d/zfs && $make clobber)
(cd $SRC/cmd/fs.d && $make ${1}_local)
(cd $SRC/cmd/devfsadm && $make $1)
;;
esac
(cd $SRC/cmd/syseventd/modules/zfs_mod && $make $1)
# Build the MDB modules, WITH the linktest
(cd $SRC/cmd/mdb/tools && $make $1)
# kmdb_arch is 64-bit only
for a in $kmdb_arch
do
case $1 in
install|lint)
(cd $SRC/cmd/mdb/$x/$a/kmdb &&
$make kmdb_modlinktest.o )
;;
clean|clobber)
(cd $SRC/cmd/mdb/$x/$a/kmdb &&
$make -k $1 )
;;
esac
(cd $SRC/cmd/mdb/$x/$a/zfs &&
$make $1 KMDB_LINKTEST_ENABLE= )
done
# mdb_arch is both 32-bit & 64-bit
for a in $mdb_arch
do
(cd $SRC/cmd/mdb/$x/$a/libzpool &&
$make $1 )
done
}
################################################################
do_mans() {
case "$1" in
install)
(cd $SRC/man/man8 && make \
$ROOT/usr/share/man/man8/zdb.8 \
$ROOT/usr/share/man/man8/zfs.8 \
$ROOT/usr/share/man/man8/zfs-program.8 \
$ROOT/usr/share/man/man8/zpool.8 \
$ROOT/usr/share/man/man8/ztest.8 )
(cd $SRC/man/man7 && make \
$ROOT/usr/share/man/man7/zpool-features.7 )
;;
lint)
(cd $SRC/man/man8 && make zdb.8.check zfs.8.check zfs-program.8.check \
zpool.8.check ztest.8.check)
(cd $SRC/man/man7 && make zpool-features.7.check)
;;
*)
(cd $SRC/man/man8 && make $1)
(cd $SRC/man/man7 && make $)
;;
esac
}
################################################################
# This builds $SRC/TAGS (and cscope.files) in a helpful order.
do_tags() {
(cd $SRC ;
find uts/common/sys -name '*.[ch]' -print |sort
find uts/common/fs/zfs -name '*.[ch]' -print |sort
find lib/libzpool -name '*.[ch]' -print |sort
find lib/libzfs -name '*.[ch]' -print |sort
find cmd/zpool -name '*.[ch]' -print |sort
find cmd/zfs -name '*.[ch]' -print |sort
find cmd/zdb -name '*.[ch]' -print |sort
find cmd/zhack -name '*.[ch]' -print |sort
find cmd/zinject -name '*.[ch]' -print |sort
find cmd/ztest -name '*.[ch]' -print |sort
find common/zfs -name '*.[ch]' -print |sort
echo cmd/mdb/common/modules/zfs/zfs.c
) > $SRC/cscope.files
(cd $SRC ;
exctags -e --langmap=c:+.ndl -h ndl -L - < cscope.files
cscope -b )
}
################################################################
# This creates a tarfile one can use to update a test machine.
do_tar() {
git_rev=`git rev-parse --short=8 HEAD`
files="
kernel/drv/$arch64/zfs
kernel/fs/$arch64/zfs
kernel/kmdb/$arch64/zfs
lib/$arch64/libzfs.so.1
lib/$arch64/libzfs_core.so.1
lib/libzfs.so.1
lib/libzfs_core.so.1
usr/bin/$arch32/ztest
usr/bin/$arch64/ztest
usr/lib/$arch64/libzfs_jni.so.1
usr/lib/$arch64/libzpool.so.1
usr/lib/devfsadm/linkmod/SUNW_zfs_link.so
usr/lib/fs/zfs/bootinstall
usr/lib/fs/zfs/fstyp.so.1
usr/lib/libzfs_jni.so.1
usr/lib/libzpool.so.1
usr/lib/mdb/kvm/$arch64/zfs.so
usr/lib/mdb/proc/$arch64/libzpool.so
usr/lib/mdb/proc/libzpool.so
sbin/zfs
sbin/zpool
usr/lib/sysevent/modules/zfs_mod.so
usr/lib/zfs/availdevs
usr/sbin/$arch32/zdb
usr/sbin/$arch64/zdb
usr/sbin/$arch32/zhack
usr/sbin/$arch64/zhack
usr/sbin/$arch32/zinject
usr/sbin/$arch64/zinject
usr/sbin/zstreamdump
usr/share/man/man8/zdb.8
usr/share/man/man8/zfs.8
usr/share/man/man8/zfs-program.8
usr/share/man/man8/zpool.8
usr/share/man/man8/ztest.8
usr/share/man/man7/zpool-features.7
"
(cd $ROOT && tar cfj ../../zfs-${git_rev}.tar.bz2 $files)
}
################################################################
if [ "$1" = "" ]; then
set '?' # force usage
fi
set -x
for arg
do
case "$arg" in
install)
build_tools
set -e
do_hdrs $arg
do_kern $arg
do_libs $arg
do_cmds $arg
do_mans $arg
;;
lint)
do_kern $arg
do_libs $arg
do_cmds $arg
do_mans $arg
;;
clean)
do_mans $arg
do_cmds $arg
do_libs $arg
do_kern $arg
;;
clobber)
do_mans $arg
do_cmds $arg
do_libs $arg
do_kern $arg
do_hdrs $arg
clobber_tools
;;
deplibs)
build_tools
set -e
do_hdrs install
do_deplibs install
;;
tags)
do_tags
;;
tar)
do_tar
;;
*)
echo "Usage: $0 {install|lint|clean|clobber|deplibs|tags|tar}";
exit 1;
;;
esac
done
|