Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 342 lines (301 sloc) 10.938 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
75a4100 @rmustacc OS-965 gcc44 should be pulled down automatically
rmustacc authored
85 echo "==> Checking for /opt/gcc/4.4.4/bin/gcc"
86 if [ ! -f "/opt/gcc/4.4.4/bin/gcc" ]; then
87 if [ ! -z "${GCC44_URL}" ]; then
88 cd /opt
2a4afda @wesolows OS-1123 libstdc++ and libgcc_s should move to /usr
wesolows authored
89 curl -k ${GCC44_URL} | bzcat | ${ROOTCMD} tar -xf -
75a4100 @rmustacc OS-965 gcc44 should be pulled down automatically
rmustacc authored
90 cd - >/dev/null
91 else
92 echo "FATAL: unable to download gcc 4.4.4, no URL is set. Please set GCC44_URL in configure."
93 exit 1
94 fi
95 fi
96
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
97 echo "==> Checking for /opt/SUNWspro/bin/cc..."
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
98
52adf86 @JohnSonnenschein remove dependency on no-longer-available Sun Studio
JohnSonnenschein authored
99 echo " +--> Ensuring SUNWspro installed in /opt/SUNWspro..."
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
100 if [ ! -f "/opt/SUNWspro/prod/bin/cc" ]; then
101 if [ ! -z "${SUNW_SPRO12_URL}" ]; then
52adf86 @JohnSonnenschein remove dependency on no-longer-available Sun Studio
JohnSonnenschein authored
102 (cd /opt/ \
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
103 && curl -k "${SUNW_SPRO12_URL}" \
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
104 | ${ROOTCMD} gtar -jxf -)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
105 else
106 echo "FATAL: unable to download sunstudio12, no URL is set. Please set SUNW_SPRO12_URL in configure.*"
107 exit 1
108 fi
109 fi
931730d @joshwilsdon OS-1329 fix /opt/SUNWspro/sunstudio12.1 link.
joshwilsdon authored
110 [[ -e /opt/SUNWspro/sunstudio12.1 ]] || (cd /opt/SUNWspro && ln -s . sunstudio12.1)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
111
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
112
113 if [[ ${GLOBAL_ZONE} -eq 1 ]]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
114 echo "==> Creating the missing symlinks..."
115 test -f /usr/bin/aclocal || ${ROOTCMD} ln -s /usr/bin/aclocal-1.10 /usr/bin/aclocal
116 test -f /usr/bin/automake || ${ROOTCMD} ln -s /usr/bin/automake-1.10 /usr/bin/automake
117 # so builds can use --mode and such
118 test -f /usr/bin/install || ${ROOTCMD} ln -s /usr/bin/ginstall /usr/bin/install
119 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
120 else
121 # nonglobal Zone
122 /bin/true
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
123 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
124
125 echo "==> Populating projects/ directories..."
de34315 @joshwilsdon Add readme and fix a couple more bugs.
joshwilsdon authored
126 [ ! -d "projects" ] && mkdir -p projects
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
127 if [ ! -d "projects" ] ; then
128 echo "FATAL: unable to create projects/ directory."
129 exit 1
3aeb937 @joshwilsdon Fixes for building in zone.
joshwilsdon authored
130 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
131
132 if [ ! -f "projects/illumos/usr/src/tools/env/illumos.sh" ]; then
133 echo " +--> Getting illumos source tree..."
134 if [ -z "${GET_ILLUMOS}" ]; then
135 echo "FATAL: No GET_ILLUMOS defined in configure.*, can't get illumos!"
136 exit 1
137 fi
138 /bin/bash -c "cd projects && ${GET_ILLUMOS} && cd -"
139 if [ ! -f "projects/illumos/usr/src/tools/env/illumos.sh" ]; then
140 echo "FATAL: GET_ILLUMOS command failed to get illumos!"
141 exit 1
142 fi
143 fi
144
fa1dcf1 @wesolows smartos-live#2 Fixed identation, spaces should be tabs
wesolows authored
145 #
146 # The adjunct tarball contains headers and libraries against which runtime
147 # dependencies will be encoded into our delivered objects. It should not
148 # exist but is essential until illumos becomes self-contained.
149 #
150 if [[ -z "${ILLUMOS_ADJUNCT_TARBALL_URL}" ]]; then
151 echo "FATAL: No ILLUMOS_ADJUNCT_TARBALL_URL defined in configure.*"
152 exit 1
153 fi
154 ADJUNCT_TARBALL="$(curl -k ${ILLUMOS_ADJUNCT_TARBALL_URL} | \
155 grep href | tail -n1 | cut -d '"' -f2)"
156 if [[ -z "${ADJUNCT_TARBALL}" ]]; then
157 echo "FATAL: Unable to list adjunct from ILLUMOS_ADJUNCT_TARBALL_URL"
158 exit 1
159 fi
160 curl -k -O ${ILLUMOS_ADJUNCT_TARBALL_URL}/${ADJUNCT_TARBALL}
161 if [[ $? != 0 ]]; then
162 echo "FATAL: Unable to get adjuncts from ILLUMOS_ADJUNCT_TARBALL_URL"
163 exit 1
0cc880d @JohnSonnenschein [OS-843] Add a way of automatically pulling down the extra tarball
JohnSonnenschein authored
164 fi
fa1dcf1 @wesolows smartos-live#2 Fixed identation, spaces should be tabs
wesolows authored
165
166 if [[ ! -f "projects/illumos-extra/Makefile" ]]; then
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
167 echo " +--> Getting illumos-extra source tree..."
168 if [ -z "${GET_ILLUMOS_EXTRA}" ]; then
169 echo "FATAL: No GET_ILLUMOS_EXTRA defined in configure.*, can't get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
170 exit 1
171 fi
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
172 /bin/bash -c "cd projects && ${GET_ILLUMOS_EXTRA} && cd -"
173 if [ ! -f "projects/illumos-extra/Makefile" ]; then
174 echo "FATAL: GET_ILLUMOS_EXTRA command failed to get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
175 exit 1
176 fi
177 fi
178
179 ROOT=`pwd`
e0efe7d @rmustacc OS-653 illumos-live configure should be able to specify which overlay…
rmustacc authored
180 echo "==> Setting up overlay"
181
182 if [ -z "${OVERLAYS}" ]; then
183 echo "FATAL: overlay order not specified"
184 exit 1
185 fi
186
187 rm -f ${ROOT}/overlay/order
188 touch ${ROOT}/overlay/order
189 for entry in ${OVERLAYS}; do
190 echo -n "${ROOT}/overlay/${entry} " >> ${ROOT}/overlay/order
191 done
192
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
193 echo "==> Setting up illumos-gate"
194
195 cd ${ROOT}/projects/illumos
196
197 if [ ! -f on-closed-bins.i386.tar.bz2 ]; then
198 if [ -z "${ON_CLOSED_BINS_URL}" ]; then
199 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins.i386.tar.bz2
200 else
201 curl -k -O "${ON_CLOSED_BINS_URL}"
202 fi
203 tar xvpf on-closed-bins.i386.tar.bz2
204 fi
205 if [ ! -f on-closed-bins-nd.i386.tar.bz2 ]; then
206 if [ -z "${ON_CLOSED_BINS_ND_URL}" ]; then
207 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins-nd.i386.tar.bz2
208 else
209 curl -k -O "${ON_CLOSED_BINS_ND_URL}"
210 fi
211 tar xvpf on-closed-bins-nd.i386.tar.bz2
212 fi
213
b1fc811 @rmustacc OS-613 illumos-live configure should optionally support lint, debug b…
rmustacc authored
214
215 #
216 # Use environment variables to determine if we should be building debug or not,
217 # etc.
218 #
219 # ILLUMOS_ENABLE_LINT
220 # ILLUMOS_ENABLE_DEBUG=yes|exclusive
221 #
222 # ENABLE_LINT implies ENABLE_DEBUG=yes
223 #
224
08ea41a @rmustacc OS-619 Fix regression in OS-613
rmustacc authored
225 NIGHTLY_OPTIONS_BASE="-CimNnt"
b1fc811 @rmustacc OS-613 illumos-live configure should optionally support lint, debug b…
rmustacc authored
226 NIGHTLY_EXTRA=""
227
228 NIGHTLY_DEBUG=0
229 ENABLE_LINT=0
230 if [[ "$ILLUMOS_ENABLE_LINT" != "" ]]; then
231 ENABLE_LINT=1
232 ENABLE_DEBUG=1
233 fi
234
235 if [[ "$ILLUMOS_ENABLE_DEBUG" == "yes" ]]; then
236 ENABLE_DEBUG=1
237 elif [[ "$ILLUMOS_ENABLE_DEBUG" == "exclusive" ]]; then
238 ENABLE_DEBUG=2
239 elif [[ "$ILLUMOS_ENABLE_DEBUG" != "" ]]; then
240 echo "Unknown value for ILLUMOS_ENABLE_DEBUG: $ILLUMOS_ENABLE_DEBUG"
241 echo "Aborting configure."
242 exit 1
243 fi
244
245 [[ $ENABLE_LINT -eq 1 ]] && NIGHTLY_EXTRA="l"
246 [[ $ENABLE_DEBUG -eq 1 ]] && NIGHTLY_EXTRA=$NIGHTLY_EXTRA"D"
247 [[ $ENABLE_DEBUG -eq 2 ]] && NIGHTLY_EXTRA=$NIGHTLY_EXTRA"DF"
248
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
249 cat <<EOF> illumos.sh
b1fc811 @rmustacc OS-613 illumos-live configure should optionally support lint, debug b…
rmustacc authored
250 NIGHTLY_OPTIONS="$NIGHTLY_OPTIONS_BASE$NIGHTLY_EXTRA"; export NIGHTLY_OPTIONS
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
251 GATE="${RELEASE_VER}"; export GATE
252 CODEMGR_WS="${ROOT}/projects/illumos"; export CODEMGR_WS
253 maxjobs() {
254 ncpu=\`kstat -p cpu_info:::state | grep -c on-line\`
255 expr \$ncpu + 2
256 }
257 DMAKE_MAX_JOBS=\`maxjobs\`; export DMAKE_MAX_JOBS
258
259 ONBLD_BIN="/opt/onbld/bin"
260 PARENT_WS=""; export PARENT_WS
261 CLONE_WS="http://hg.illumos.org/illumos-gate"
262 export CLONE_WS
263 STAFFER=nobody; export STAFFER
264 MAILTO=$STAFFER; export MAILTO
265 BUILD_PROJECT=; export BUILD_PROJECT
eb646e7 @JohnSonnenschein [RELENG-257] jenkins gets confused by nightly(1) lock files
JohnSonnenschein authored
266 if [[ -z "${HUDSON_SERVER_COOKIE}" ]]; then
1b28fe8 OS-512 Illumos nightly environment file creates same lock file for an…
Bill Pijewski authored
267 LOCKNAME="\`whoami\`_\`basename \$CODEMGR_WS\`_nightly.lock"; export LOCKNAME
eb646e7 @JohnSonnenschein [RELENG-257] jenkins gets confused by nightly(1) lock files
JohnSonnenschein authored
268 else
269 LOCKNAME="\`whoami\`_\`basename \$CODEMGR_WS\`_nightly-${HUDSON_SERVER_COOKIE}.lock"; export LOCKNAME
270 fi
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
271 ATLOG="\$CODEMGR_WS/log"; export ATLOG
272 LOGFILE="\$ATLOG/nightly.log"; export LOGFILE
273 MACH=\`uname -p\`; export MACH
274 ON_CLOSED_BINS="\$CODEMGR_WS/closed"; export ON_CLOSED_BINS
275 ON_CRYPTO_BINS="\$CODEMGR_WS/on-crypto.\$MACH.tar.bz2"; export ON_CRYPTO_BINS
276 REF_PROTO_LIST=\$PARENT_WS/usr/src/proto_list_\${MACH}; export REF_PROTO_LIST
277 ROOT="${ROOT}/proto"; export ROOT
fa1dcf1 @wesolows smartos-live#2 Fixed identation, spaces should be tabs
wesolows authored
278 ADJUNCT_PROTO="${ROOT}/proto.strap"; export ADJUNCT_PROTO
279 NATIVE_ADJUNCT="/opt/local"; export NATIVE_ADJUNCT
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
280 SRC="\$CODEMGR_WS/usr/src"; export SRC
281 VERSION="\$GATE"; export VERSION
282 PARENT_ROOT="${ROOT}/proto"; export PARENT_ROOT
283 PARENT_TOOLS_ROOT=\$PARENT_WS/usr/src/tools/proto/root_\$MACH-nd; export PARENT_TOOLS_ROOT
284 PKGARCHIVE="\${CODEMGR_WS}/packages/\${MACH}/nightly"; export PKGARCHIVE
285 PKGPUBLISHER_REDIST="${PUBLISHER}"; export PKGPUBLISHER_REDIST
286 MAKEFLAGS=k; export MAKEFLAGS
287 UT_NO_USAGE_TRACKING="1"; export UT_NO_USAGE_TRACKING
288 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
289 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
290 SPRO_ROOT=/opt/SUNWspro; export SPRO_ROOT
291 SPRO_VROOT=\$SPRO_ROOT; export SPRO_VROOT
74d9cb9 @JohnSonnenschein move location of GCC
JohnSonnenschein authored
292 export GCC_ROOT=/opt/gcc/4.4.4; # Where to find GCC4.x
af350f2 @JohnSonnenschein gcc4 updates to illumos-live configure (illumos.sh template)
JohnSonnenschein authored
293 export CW_GCC_DIR=\${GCC_ROOT}/bin; # A temporary hack to allow bootstrap of cw(1)
294 export __GNUC=""; # Use GCC as the primary compiler
295 export __GNUC4=""; # Use GCC4 specific flags
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
296
297 EOF
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
298
299 # For some reason this disappeared before
300 touch ${ROOT}/projects/illumos/usr/src/tools/findunref/exception_list.unknown
301
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
302 function update_branch
303 {
304 target_dir=$1
305 target=$2
306
307 oldwd=$(pwd)
308 cd ${target_dir}
309 current=$(git branch | grep "^*" | cut -d' ' -f2)
310 if [[ "${current}" != "${target}" ]]; then
6dfffae @JohnSonnenschein [HEAD-673] illumos-live configure is using old git syntax, breaking mg
JohnSonnenschein authored
311 git checkout ${target}
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
312 fi
313 cd ${oldwd}
314
315 return 0
316 }
317
318 # Setup branches
319 if [[ -f ${ROOT}/configure-branches ]]; then
320 branch=$(grep "^illumos-live: " ${ROOT}/configure-branches | cut -d' ' -f2)
321 [[ -z ${branch} ]] && update_branch "${ROOT}" ${branch}
322 branch=$(grep "^illumos-extra: " ${ROOT}/configure-branches | cut -d' ' -f2)
323 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/illumos-extra" ${branch}
324 branch=$(grep "^illumos-joyent: " ${ROOT}/configure-branches | cut -d' ' -f2)
325 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/illumos" ${branch}
47e0e80 @joshwilsdon [HVM-488] include kvm and kvm-cmd-14 in the platform.
joshwilsdon authored
326 branch=$(grep "^kvm: " ${ROOT}/configure-branches | cut -d' ' -f2)
327 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/kvm" ${branch}
328 branch=$(grep "^kvm-cmd: " ${ROOT}/configure-branches | cut -d' ' -f2)
329 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/kvm-cmd" ${branch}
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
330 else
331 echo ""
332 echo "WARNING! No configure-branches file!!! Using master branch for everything!"
333 echo ""
334 sleep 3
335 fi
336
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
337 echo ""
28e3caa @joshwilsdon [OS-250] add g to make
joshwilsdon authored
338 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
339 echo ""
340
341 exit 0
Something went wrong with that request. Please try again.