1 #!/bin/bash
2 #
3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
6 # 1.0 of the CDDL.
7 #
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
11 #
12 # Copyright (c) 2014 by Delphix. All rights reserved.
13 # Copyright 2014 OmniTI Computer Consulting, Inc. All rights reserved.
14 #
15
16 function die
17 {
18 echo "failed: $1" >&2
19 exit 1
20 }
21
22 # Set CODEMGR_WS.
23 if [[ -z "$1" ]]; then
24 export CODEMGR_WS=`git rev-parse --show-toplevel`
25 if [[ -z "$CODEMGR_WS" ]]; then
26 die "Can't determine source repository without help. Try using an argument."
27 fi
28 else
29 cd $1
30 export CODEMGR_WS=`pwd`
31 fi
32
33 # Set up your environment ala bldenv or ws. Eventually this hack
34 # should go away.
35 export SRC=$CODEMGR_WS/usr/src
36 export MACH=`uname -p`
37 export ROOT=$CODEMGR_WS/proto/root_$MACH
38 export ENVCPPFLAGS1=-I$ROOT/usr/include
39 export ENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib"
40 export BUILD_TOOLS=/opt
41 export MAKEFLAGS=-e
42 #NOTE use gcc-only build
43 export CW_NO_SHADOW=1
44 export __GNUC=
45
46 #######
47 # THESE will vary depending on which illumos distro you run.
48 # You can also specify them in your environment, overriding what we calculate.
49 # OmniOS examples
50 export GCC_ROOT=${GCC_ROOT:-/opt/gcc-4.4.4}
51 export SPRO_ROOT=${SPRO_ROOT:-/opt/sunstudio12.1}
52
53 # OpenIndiana examples.
54 # Stock GCC_ROOT works on OI...
55 # export SPRO_ROOT=/opt/SUNWspro
56 ########
57
58 # Make sure dmake is in your path, and TOOLS are first.
59 export PATH=$BUILD_TOOLS/onbld/bin:$BUILD_TOOLS/onbld/bin/$MACH:$SPRO_ROOT/bin:$PATH
60
61 export NO_GENUNIX_UNIQUIFY=
62 export CW_NO_SHADOW=1
63
64 (cd $SRC; dmake rootdirs) || exit 1
65 (cd $SRC/head; dmake) || exit 1
66 (cd $SRC/uts; dmake install_h) || exit 1
67
68 (cd $SRC; dmake libheaders) || exit 1
69 (cd $SRC/lib/libzfs; dmake install_h) || exit 1
70 (cd $SRC/uts/common/sys; dmake install_h) || exit 1
71
72 directories=(
73 $SRC/uts/intel/kmdb
74 $SRC/uts/intel/zfs
75 $SRC/uts/intel/dev
76 $SRC/man/man1m
77 $SRC/man/man5
78 $SRC/grub
79 $SRC/lib/libc
80 $SRC/lib/libavl
81 $SRC/lib/libnvpair
82 $SRC/lib/libsec
83 $SRC/lib/libcmdutils
84 $SRC/lib/libdevinfo
85 $SRC/lib/libuutil
86 $SRC/lib/libbrand
87 $SRC/lib/libzonecfg
88 $SRC/lib/libinetutil
89 $SRC/lib/libdladm
90 $SRC/lib/libdlpi
91 $SRC/lib/libdiskmgt
92 $SRC/lib/libumem
93 $SRC/lib/libdisasm
94 $SRC/lib/libidmap
95 $SRC/lib/libdevid
96 $SRC/lib/libzfs_core
97 $SRC/lib/libzpool
98 $SRC/lib/libzfs
99 $SRC/lib/pyzfs
100 $SRC/lib/libzfs_jni
101 $SRC/lib/libsaveargs
102 $SRC/cmd/isaexec
103 $SRC/cmd/platexec
104 $SRC/cmd/devfsadm
105 $SRC/cmd/syseventd
106 $SRC/cmd/fstyp
107 $SRC/cmd/availdevs
108 $SRC/cmd/fs.d/zfs
109 $SRC/cmd/zdb
110 $SRC/cmd/zhack
111 $SRC/cmd/zfs
112 $SRC/cmd/pyzfs
113 $SRC/cmd/zinject
114 $SRC/cmd/zpool
115 $SRC/cmd/zstreamdump
116 $SRC/cmd/ztest
117 $SRC/cmd/terminfo
118 $SRC/cmd/mdb
119 )
120
121 for i in "${directories[@]}"; do
122 (cd $i; dmake install) || exit 1
123 done