Skip to content

HTTPS clone URL

Subversion checkout URL

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