Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 332 lines (292 sloc) 10.715 kB
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
1 #!/usr/bin/env bash
2 #
0cc880d @JohnSonnenschein [OS-843] Add a way of automatically pulling down the extra tarball
JohnSonnenschein authored
3 # Copyright (c) 2010-2012 Joyent Inc.
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
4 #
5
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
6 set -o errexit
7
8 GLOBAL_ZONE=1
9
10 if [[ $(uname -s) != "SunOS" ]]; then
11 echo "FATAL: This only works with SunOS/SmartOS"
12 exit 1
13 fi
14
15 if [[ $(zonename) != "global" ]]; then
16 echo "NOTICE: Building in a zone, workarounds enabled!"
17 GLOBAL_ZONE=0
18 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
19
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
20 INSTALL_BIN_LINK_DIR=/usr/bin
21 HAVE_PKG="true"
22 ROOTCMD=pfexec
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
23
0629235 @joshwilsdon [OS-16] some help for building with different gits.
joshwilsdon authored
24 # illumos-extra is now in github but git's ssl doesn't always work in our build machines.
25 export GIT_SSL_NO_VERIFY=true
26
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
27 # Load all site-specific configure files
3aeb937 @joshwilsdon Fixes for building in zone.
joshwilsdon authored
28 for file in `ls configure.*`; do
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
29 source ${file}
30 done
31
32 if [ "${HAVE_PKG}" == "true" ]; then
33 echo "==> Installing illumos build dependencies..."
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
34 if [[ ${GLOBAL_ZONE} -eq 1 ]]; then
35 ${ROOTCMD} pkg install \
36 text/groff \
37 system/zones/internal \
38 library/libxml2 \
39 developer/gnome/gettext \
40 library/python-2/setuptools-26 \
41 library/gnome/gnome-vfs \
42 runtime/perl-510 \
43 runtime/perl-510/extra \
44 developer/build/gnu-make \
45 developer/build/onbld \
46 developer/gcc-3 \
47 developer/astdev \
48 developer/lexer/flex \
49 library/nspr/header-nspr \
50 system/library/mozilla-nss/header-nss \
51 data/docbook \
52 text/gnu-gettext \
53 developer/java/jdk \
54 || /bin/true
55 else
56 # nonglobal Zone
d85a1cf @joshwilsdon [OS-16] pkgsrc version of gcc can't build 64-bit binaries, so is usel…
joshwilsdon authored
57 for pkg in gmake binutils autoconf automake \
c5b62d0 @joshwilsdon [OS-16] more cleanups to make stuff build cleanly in a joyent zone.
joshwilsdon authored
58 bison flex libtool-base python24 p5-XML-Parser \
e411bb1 @joshwilsdon RELENG-350 switch to /opt/local/bin/node for man build.
joshwilsdon authored
59 libxslt gcc-compiler sun-jre6 sun-jdk6 gmp mpfr nodejs; do
805b86a @jperkin Use pkg_info -qe rather than redirecting output.
jperkin authored
60 pkg_info -qe ${pkg} || pkgin -y install ${pkg}
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
61 done
62 fi
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
63 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
64
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
65 # TODO: move this to illumos-extra itself
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
66 if [ "${HAVE_PKG}" == "true" ]; then
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
67 echo "==> Installing illumos-extra dependencies..."
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
68 if [[ ${GLOBAL_ZONE} -eq 1 ]]; then
69 ${ROOTCMD} pkg install \
70 compatibility/ucb \
71 developer/build/autoconf \
72 developer/build/automake-19 \
73 developer/build/automake-110 \
74 developer/build/cmake \
75 developer/build/libtool \
76 developer/parser/bison \
77 library/libevent \
78 || /bin/true
79 else
80 # nonglobal Zone
81 /bin/true
82 fi
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
83 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
84
85 echo "==> Checking for /opt/SUNWspro/bin/cc..."
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
86
52adf86 @JohnSonnenschein remove dependency on no-longer-available Sun Studio
JohnSonnenschein authored
87 echo " +--> Ensuring SUNWspro installed in /opt/SUNWspro..."
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
88 if [ ! -f "/opt/SUNWspro/prod/bin/cc" ]; then
89 if [ ! -z "${SUNW_SPRO12_URL}" ]; then
52adf86 @JohnSonnenschein remove dependency on no-longer-available Sun Studio
JohnSonnenschein authored
90 (cd /opt/ \
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
91 && curl -k "${SUNW_SPRO12_URL}" \
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
92 | ${ROOTCMD} gtar -jxf -)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
93 else
94 echo "FATAL: unable to download sunstudio12, no URL is set. Please set SUNW_SPRO12_URL in configure.*"
95 exit 1
96 fi
97 fi
931730d @joshwilsdon OS-1329 fix /opt/SUNWspro/sunstudio12.1 link.
joshwilsdon authored
98 [[ -e /opt/SUNWspro/sunstudio12.1 ]] || (cd /opt/SUNWspro && ln -s . sunstudio12.1)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
99
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
100
101 if [[ ${GLOBAL_ZONE} -eq 1 ]]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
102 echo "==> Creating the missing symlinks..."
103 test -f /usr/bin/aclocal || ${ROOTCMD} ln -s /usr/bin/aclocal-1.10 /usr/bin/aclocal
104 test -f /usr/bin/automake || ${ROOTCMD} ln -s /usr/bin/automake-1.10 /usr/bin/automake
105 # so builds can use --mode and such
106 test -f /usr/bin/install || ${ROOTCMD} ln -s /usr/bin/ginstall /usr/bin/install
107 test -f /usr/bin/pod2man || ${ROOTCMD} ln -s /usr/perl5/5.10.0/bin/pod2man /usr/bin/pod2man
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
108 else
109 # nonglobal Zone
110 /bin/true
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
111 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
112
113 echo "==> Populating projects/ directories..."
de34315 @joshwilsdon Add readme and fix a couple more bugs.
joshwilsdon authored
114 [ ! -d "projects" ] && mkdir -p projects
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
115 if [ ! -d "projects" ] ; then
116 echo "FATAL: unable to create projects/ directory."
117 exit 1
3aeb937 @joshwilsdon Fixes for building in zone.
joshwilsdon authored
118 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
119
120 if [ ! -f "projects/illumos/usr/src/tools/env/illumos.sh" ]; then
121 echo " +--> Getting illumos source tree..."
122 if [ -z "${GET_ILLUMOS}" ]; then
123 echo "FATAL: No GET_ILLUMOS defined in configure.*, can't get illumos!"
124 exit 1
125 fi
126 /bin/bash -c "cd projects && ${GET_ILLUMOS} && cd -"
127 if [ ! -f "projects/illumos/usr/src/tools/env/illumos.sh" ]; then
128 echo "FATAL: GET_ILLUMOS command failed to get illumos!"
129 exit 1
130 fi
131 fi
132
fa1dcf1 @wesolows smartos-live#2 Fixed identation, spaces should be tabs
wesolows authored
133 #
134 # The adjunct tarball contains headers and libraries against which runtime
135 # dependencies will be encoded into our delivered objects. It should not
136 # exist but is essential until illumos becomes self-contained.
137 #
138 if [[ -z "${ILLUMOS_ADJUNCT_TARBALL_URL}" ]]; then
139 echo "FATAL: No ILLUMOS_ADJUNCT_TARBALL_URL defined in configure.*"
140 exit 1
141 fi
142 ADJUNCT_TARBALL="$(curl -k ${ILLUMOS_ADJUNCT_TARBALL_URL} | \
143 grep href | tail -n1 | cut -d '"' -f2)"
144 if [[ -z "${ADJUNCT_TARBALL}" ]]; then
145 echo "FATAL: Unable to list adjunct from ILLUMOS_ADJUNCT_TARBALL_URL"
146 exit 1
147 fi
148 curl -k -O ${ILLUMOS_ADJUNCT_TARBALL_URL}/${ADJUNCT_TARBALL}
149 if [[ $? != 0 ]]; then
150 echo "FATAL: Unable to get adjuncts from ILLUMOS_ADJUNCT_TARBALL_URL"
151 exit 1
0cc880d @JohnSonnenschein [OS-843] Add a way of automatically pulling down the extra tarball
JohnSonnenschein authored
152 fi
fa1dcf1 @wesolows smartos-live#2 Fixed identation, spaces should be tabs
wesolows authored
153
154 if [[ ! -f "projects/illumos-extra/Makefile" ]]; then
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
155 echo " +--> Getting illumos-extra source tree..."
156 if [ -z "${GET_ILLUMOS_EXTRA}" ]; then
157 echo "FATAL: No GET_ILLUMOS_EXTRA defined in configure.*, can't get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
158 exit 1
159 fi
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
160 /bin/bash -c "cd projects && ${GET_ILLUMOS_EXTRA} && cd -"
161 if [ ! -f "projects/illumos-extra/Makefile" ]; then
162 echo "FATAL: GET_ILLUMOS_EXTRA command failed to get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
163 exit 1
164 fi
165 fi
166
167 ROOT=`pwd`
e0efe7d @rmustacc OS-653 illumos-live configure should be able to specify which overlay…
rmustacc authored
168 echo "==> Setting up overlay"
169
170 if [ -z "${OVERLAYS}" ]; then
171 echo "FATAL: overlay order not specified"
172 exit 1
173 fi
174
175 rm -f ${ROOT}/overlay/order
176 touch ${ROOT}/overlay/order
177 for entry in ${OVERLAYS}; do
178 echo -n "${ROOT}/overlay/${entry} " >> ${ROOT}/overlay/order
179 done
180
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
181 echo "==> Setting up illumos-gate"
182
183 cd ${ROOT}/projects/illumos
184
185 if [ ! -f on-closed-bins.i386.tar.bz2 ]; then
186 if [ -z "${ON_CLOSED_BINS_URL}" ]; then
187 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins.i386.tar.bz2
188 else
189 curl -k -O "${ON_CLOSED_BINS_URL}"
190 fi
191 tar xvpf on-closed-bins.i386.tar.bz2
192 fi
193 if [ ! -f on-closed-bins-nd.i386.tar.bz2 ]; then
194 if [ -z "${ON_CLOSED_BINS_ND_URL}" ]; then
195 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins-nd.i386.tar.bz2
196 else
197 curl -k -O "${ON_CLOSED_BINS_ND_URL}"
198 fi
199 tar xvpf on-closed-bins-nd.i386.tar.bz2
200 fi
201
b1fc811 @rmustacc OS-613 illumos-live configure should optionally support lint, debug b…
rmustacc authored
202
203 #
204 # Use environment variables to determine if we should be building debug or not,
205 # etc.
206 #
207 # ILLUMOS_ENABLE_LINT
208 # ILLUMOS_ENABLE_DEBUG=yes|exclusive
209 #
210 # ENABLE_LINT implies ENABLE_DEBUG=yes
211 #
212
08ea41a @rmustacc OS-619 Fix regression in OS-613
rmustacc authored
213 NIGHTLY_OPTIONS_BASE="-CimNnt"
b1fc811 @rmustacc OS-613 illumos-live configure should optionally support lint, debug b…
rmustacc authored
214 NIGHTLY_EXTRA=""
215
216 NIGHTLY_DEBUG=0
217 ENABLE_LINT=0
218 if [[ "$ILLUMOS_ENABLE_LINT" != "" ]]; then
219 ENABLE_LINT=1
220 ENABLE_DEBUG=1
221 fi
222
223 if [[ "$ILLUMOS_ENABLE_DEBUG" == "yes" ]]; then
224 ENABLE_DEBUG=1
225 elif [[ "$ILLUMOS_ENABLE_DEBUG" == "exclusive" ]]; then
226 ENABLE_DEBUG=2
227 elif [[ "$ILLUMOS_ENABLE_DEBUG" != "" ]]; then
228 echo "Unknown value for ILLUMOS_ENABLE_DEBUG: $ILLUMOS_ENABLE_DEBUG"
229 echo "Aborting configure."
230 exit 1
231 fi
232
233 [[ $ENABLE_LINT -eq 1 ]] && NIGHTLY_EXTRA="l"
234 [[ $ENABLE_DEBUG -eq 1 ]] && NIGHTLY_EXTRA=$NIGHTLY_EXTRA"D"
235 [[ $ENABLE_DEBUG -eq 2 ]] && NIGHTLY_EXTRA=$NIGHTLY_EXTRA"DF"
236
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
237 cat <<EOF> illumos.sh
b1fc811 @rmustacc OS-613 illumos-live configure should optionally support lint, debug b…
rmustacc authored
238 NIGHTLY_OPTIONS="$NIGHTLY_OPTIONS_BASE$NIGHTLY_EXTRA"; export NIGHTLY_OPTIONS
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
239 GATE="${RELEASE_VER}"; export GATE
240 CODEMGR_WS="${ROOT}/projects/illumos"; export CODEMGR_WS
241 maxjobs() {
242 ncpu=\`kstat -p cpu_info:::state | grep -c on-line\`
243 expr \$ncpu + 2
244 }
245 DMAKE_MAX_JOBS=\`maxjobs\`; export DMAKE_MAX_JOBS
246
247 ONBLD_BIN="/opt/onbld/bin"
248 PARENT_WS=""; export PARENT_WS
249 CLONE_WS="http://hg.illumos.org/illumos-gate"
250 export CLONE_WS
251 STAFFER=nobody; export STAFFER
252 MAILTO=$STAFFER; export MAILTO
253 BUILD_PROJECT=; export BUILD_PROJECT
eb646e7 @JohnSonnenschein [RELENG-257] jenkins gets confused by nightly(1) lock files
JohnSonnenschein authored
254 if [[ -z "${HUDSON_SERVER_COOKIE}" ]]; then
1b28fe8 OS-512 Illumos nightly environment file creates same lock file for an…
Bill Pijewski authored
255 LOCKNAME="\`whoami\`_\`basename \$CODEMGR_WS\`_nightly.lock"; export LOCKNAME
eb646e7 @JohnSonnenschein [RELENG-257] jenkins gets confused by nightly(1) lock files
JohnSonnenschein authored
256 else
257 LOCKNAME="\`whoami\`_\`basename \$CODEMGR_WS\`_nightly-${HUDSON_SERVER_COOKIE}.lock"; export LOCKNAME
258 fi
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
259 ATLOG="\$CODEMGR_WS/log"; export ATLOG
260 LOGFILE="\$ATLOG/nightly.log"; export LOGFILE
261 MACH=\`uname -p\`; export MACH
262 ON_CLOSED_BINS="\$CODEMGR_WS/closed"; export ON_CLOSED_BINS
263 ON_CRYPTO_BINS="\$CODEMGR_WS/on-crypto.\$MACH.tar.bz2"; export ON_CRYPTO_BINS
264 REF_PROTO_LIST=\$PARENT_WS/usr/src/proto_list_\${MACH}; export REF_PROTO_LIST
265 ROOT="${ROOT}/proto"; export ROOT
fa1dcf1 @wesolows smartos-live#2 Fixed identation, spaces should be tabs
wesolows authored
266 ADJUNCT_PROTO="${ROOT}/proto.strap"; export ADJUNCT_PROTO
267 NATIVE_ADJUNCT="/opt/local"; export NATIVE_ADJUNCT
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
268 SRC="\$CODEMGR_WS/usr/src"; export SRC
269 VERSION="\$GATE"; export VERSION
270 PARENT_ROOT="${ROOT}/proto"; export PARENT_ROOT
271 PARENT_TOOLS_ROOT=\$PARENT_WS/usr/src/tools/proto/root_\$MACH-nd; export PARENT_TOOLS_ROOT
272 PKGARCHIVE="\${CODEMGR_WS}/packages/\${MACH}/nightly"; export PKGARCHIVE
273 PKGPUBLISHER_REDIST="${PUBLISHER}"; export PKGPUBLISHER_REDIST
274 MAKEFLAGS=k; export MAKEFLAGS
275 UT_NO_USAGE_TRACKING="1"; export UT_NO_USAGE_TRACKING
276 CW_NO_SHADOW="1"; export CW_NO_SHADOW
98af72c @jjelinek OS-470 Build should always use local tools, cw compiler check is curr…
jjelinek authored
277 BUILD_TOOLS="\${CODEMGR_WS}/usr/src/tools/proto/root_\${MACH}-nd/opt"; export BUILD_TOOLS
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
278 SPRO_ROOT=/opt/SUNWspro; export SPRO_ROOT
8827441 @rmustacc OS-1324 illumos should be built with the illumos-extra gcc 4.4.4
rmustacc authored
279 SPRO_VROOT=\$SPRO_ROOT; export SPRO_VROOT
016194f @rmustacc OS-1577 configure should set JAVA_HOME
rmustacc authored
280 GNU_ROOT="${ROOT}/proto.strap/usr/gnu" export GNU_ROOT
8827441 @rmustacc OS-1324 illumos should be built with the illumos-extra gcc 4.4.4
rmustacc authored
281 export GCC_ROOT=${ROOT}/proto.strap/usr; # Where to find GCC4.x
af350f2 @JohnSonnenschein gcc4 updates to illumos-live configure (illumos.sh template)
JohnSonnenschein authored
282 export CW_GCC_DIR=\${GCC_ROOT}/bin; # A temporary hack to allow bootstrap of cw(1)
283 export __GNUC=""; # Use GCC as the primary compiler
284 export __GNUC4=""; # Use GCC4 specific flags
016194f @rmustacc OS-1577 configure should set JAVA_HOME
rmustacc authored
285 JAVA_ROOT=/opt/local/java/sun6; export JAVA_ROOT
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
286
287 EOF
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
288
289 # For some reason this disappeared before
290 touch ${ROOT}/projects/illumos/usr/src/tools/findunref/exception_list.unknown
291
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
292 function update_branch
293 {
294 target_dir=$1
295 target=$2
296
297 oldwd=$(pwd)
298 cd ${target_dir}
299 current=$(git branch | grep "^*" | cut -d' ' -f2)
300 if [[ "${current}" != "${target}" ]]; then
6dfffae @JohnSonnenschein [HEAD-673] illumos-live configure is using old git syntax, breaking mg
JohnSonnenschein authored
301 git checkout ${target}
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
302 fi
303 cd ${oldwd}
304
305 return 0
306 }
307
308 # Setup branches
309 if [[ -f ${ROOT}/configure-branches ]]; then
310 branch=$(grep "^illumos-live: " ${ROOT}/configure-branches | cut -d' ' -f2)
311 [[ -z ${branch} ]] && update_branch "${ROOT}" ${branch}
312 branch=$(grep "^illumos-extra: " ${ROOT}/configure-branches | cut -d' ' -f2)
313 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/illumos-extra" ${branch}
314 branch=$(grep "^illumos-joyent: " ${ROOT}/configure-branches | cut -d' ' -f2)
315 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/illumos" ${branch}
47e0e80 @joshwilsdon [HVM-488] include kvm and kvm-cmd-14 in the platform.
joshwilsdon authored
316 branch=$(grep "^kvm: " ${ROOT}/configure-branches | cut -d' ' -f2)
317 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/kvm" ${branch}
318 branch=$(grep "^kvm-cmd: " ${ROOT}/configure-branches | cut -d' ' -f2)
319 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/kvm-cmd" ${branch}
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
320 else
321 echo ""
322 echo "WARNING! No configure-branches file!!! Using master branch for everything!"
323 echo ""
324 sleep 3
325 fi
326
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
327 echo ""
28e3caa @joshwilsdon [OS-250] add g to make
joshwilsdon authored
328 echo "Configuration complete. You should now be able to build a live image using 'gmake world && gmake live'"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
329 echo ""
330
331 exit 0
Something went wrong with that request. Please try again.