Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 272 lines (242 sloc) 9.102 kB
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
1 #!/usr/bin/env bash
2 #
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-glob…
joshwilsdon authored
3 # Copyright (c) 2010,2011 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 \
c943eb9 @rmustacc OS-496 Add missing packages to configure for building in a zone
rmustacc authored
59 libxslt dbus-glib dbus sun-jre6 sun-jdk6; 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..."
86 echo " +--> Ensuring SUNWspro (12.1-patched) installed in /opt/SUNWspro/sunstudio12.1..."
87 if [ ! -f "/opt/SUNWspro/sunstudio12.1/prod/bin/cc" ]; then
88 if [ ! -z "${SUNW_SPRO12u1_URL}" ]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
89 (${ROOTCMD} mkdir -p /opt/SUNWspro \
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
90 && cd /opt/SUNWspro \
91 && curl -k ${SUNW_SPRO12u1_URL} \
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
92 | ${ROOTCMD} gtar -zxf -)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
93 else
94 echo "FATAL: unable to download sunstudio12u1, no URL is set. Please set SUNW_SPRO12u1_URL in configure.*"
95 exit 1
96 fi
97 fi
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
98
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
99 echo " +--> Ensuring SUNWspro (12-patched) installed in /opt/SUNWspro..."
100 if [ ! -f "/opt/SUNWspro/prod/bin/cc" ]; then
101 if [ ! -z "${SUNW_SPRO12_URL}" ]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
102 (${ROOTCMD} mkdir -p /opt/SUNWspro \
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
103 && cd /opt/SUNWspro \
104 && curl -k "${SUNW_SPRO12_URL}" \
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zon…
joshwilsdon authored
105 | ${ROOTCMD} gtar -jxf -)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
106 else
107 echo "FATAL: unable to download sunstudio12, no URL is set. Please set SUNW_SPRO12_URL in configure.*"
108 exit 1
109 fi
110 fi
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
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
145 if [ ! -f "projects/illumos-extra/Makefile" ]; then
146 echo " +--> Getting illumos-extra source tree..."
147 if [ -z "${GET_ILLUMOS_EXTRA}" ]; then
148 echo "FATAL: No GET_ILLUMOS_EXTRA defined in configure.*, can't get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
149 exit 1
150 fi
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
151 /bin/bash -c "cd projects && ${GET_ILLUMOS_EXTRA} && cd -"
152 if [ ! -f "projects/illumos-extra/Makefile" ]; then
153 echo "FATAL: GET_ILLUMOS_EXTRA command failed to get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
154 exit 1
155 fi
156 fi
157
158 ROOT=`pwd`
159 echo "==> Setting up illumos-gate"
160
161 cd ${ROOT}/projects/illumos
162
163 if [ ! -f on-closed-bins.i386.tar.bz2 ]; then
164 if [ -z "${ON_CLOSED_BINS_URL}" ]; then
165 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins.i386.tar.bz2
166 else
167 curl -k -O "${ON_CLOSED_BINS_URL}"
168 fi
169 tar xvpf on-closed-bins.i386.tar.bz2
170 fi
171 if [ ! -f on-closed-bins-nd.i386.tar.bz2 ]; then
172 if [ -z "${ON_CLOSED_BINS_ND_URL}" ]; then
173 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins-nd.i386.tar.bz2
174 else
175 curl -k -O "${ON_CLOSED_BINS_ND_URL}"
176 fi
177 tar xvpf on-closed-bins-nd.i386.tar.bz2
178 fi
179
8855875 @JohnSonnenschein OS-264 Merge from upstream (illumos)
JohnSonnenschein authored
180 cat <<EOF> illumos.sh
181 NIGHTLY_OPTIONS="-CimNnt"; export NIGHTLY_OPTIONS
182 GATE="${RELEASE_VER}"; export GATE
183 CODEMGR_WS="${ROOT}/projects/illumos"; export CODEMGR_WS
184 maxjobs() {
185 ncpu=\`kstat -p cpu_info:::state | grep -c on-line\`
186 expr \$ncpu + 2
187 }
188 DMAKE_MAX_JOBS=\`maxjobs\`; export DMAKE_MAX_JOBS
189
190 ONBLD_BIN="/opt/onbld/bin"
191 PARENT_WS=""; export PARENT_WS
192 CLONE_WS="http://hg.illumos.org/illumos-gate"
193 export CLONE_WS
194 STAFFER=nobody; export STAFFER
195 MAILTO=$STAFFER; export MAILTO
196 BUILD_PROJECT=; export BUILD_PROJECT
197 LOCKNAME="\`basename \$CODEMGR_WS\`_nightly.lock"; export LOCKNAME
198 ATLOG="\$CODEMGR_WS/log"; export ATLOG
199 LOGFILE="\$ATLOG/nightly.log"; export LOGFILE
200 MACH=\`uname -p\`; export MACH
201 ON_CLOSED_BINS="\$CODEMGR_WS/closed"; export ON_CLOSED_BINS
202 ON_CRYPTO_BINS="\$CODEMGR_WS/on-crypto.\$MACH.tar.bz2"; export ON_CRYPTO_BINS
203 REF_PROTO_LIST=\$PARENT_WS/usr/src/proto_list_\${MACH}; export REF_PROTO_LIST
204 ROOT="${ROOT}/proto"; export ROOT
205 SRC="\$CODEMGR_WS/usr/src"; export SRC
206 VERSION="\$GATE"; export VERSION
207 PARENT_ROOT="${ROOT}/proto"; export PARENT_ROOT
208 PARENT_TOOLS_ROOT=\$PARENT_WS/usr/src/tools/proto/root_\$MACH-nd; export PARENT_TOOLS_ROOT
209 PKGARCHIVE="\${CODEMGR_WS}/packages/\${MACH}/nightly"; export PKGARCHIVE
210 PKGPUBLISHER_REDIST="${PUBLISHER}"; export PKGPUBLISHER_REDIST
211 MAKEFLAGS=k; export MAKEFLAGS
212 UT_NO_USAGE_TRACKING="1"; export UT_NO_USAGE_TRACKING
213 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
214 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
215 SPRO_ROOT=/opt/SUNWspro; export SPRO_ROOT
216 SPRO_VROOT=\$SPRO_ROOT; export SPRO_VROOT
217
218 EOF
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
219
220 # For some reason this disappeared before
221 touch ${ROOT}/projects/illumos/usr/src/tools/findunref/exception_list.unknown
222
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
223 function update_branch
224 {
225 target_dir=$1
226 target=$2
227
228 oldwd=$(pwd)
229 cd ${target_dir}
230 current=$(git branch | grep "^*" | cut -d' ' -f2)
231 if [[ "${current}" != "${target}" ]]; then
232 if [[ -n $(git branch | grep " ${target}$") ]]; then
233 # have branch already, checkout
234 git checkout ${target}
235 else
236 # don't have, add to tracking and checkout
9db3c69 @joshwilsdon [OS-388] problem with git version assumption.
joshwilsdon authored
237 git branch --track ${target} origin/${target}
238 git checkout ${target}
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
239 fi
240 fi
241 cd ${oldwd}
242
243 return 0
244 }
245
246 # Setup branches
247 if [[ -f ${ROOT}/configure-branches ]]; then
248 branch=$(grep "^illumos-live: " ${ROOT}/configure-branches | cut -d' ' -f2)
249 [[ -z ${branch} ]] && update_branch "${ROOT}" ${branch}
250 branch=$(grep "^illumos-extra: " ${ROOT}/configure-branches | cut -d' ' -f2)
251 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/illumos-extra" ${branch}
252 branch=$(grep "^illumos-joyent: " ${ROOT}/configure-branches | cut -d' ' -f2)
253 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/illumos" ${branch}
254 branch=$(grep "^ur-agent: " ${ROOT}/configure-branches | cut -d' ' -f2)
255 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/ur-agent" ${branch}
47e0e80 @joshwilsdon [HVM-488] include kvm and kvm-cmd-14 in the platform.
joshwilsdon authored
256 branch=$(grep "^kvm: " ${ROOT}/configure-branches | cut -d' ' -f2)
257 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/kvm" ${branch}
258 branch=$(grep "^kvm-cmd: " ${ROOT}/configure-branches | cut -d' ' -f2)
259 [[ -z ${branch} ]] && update_branch "${ROOT}/projects/local/kvm-cmd" ${branch}
5c081b5 @joshwilsdon [HEAD-183] add support for configure-branches file.
joshwilsdon authored
260 else
261 echo ""
262 echo "WARNING! No configure-branches file!!! Using master branch for everything!"
263 echo ""
264 sleep 3
265 fi
266
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
267 echo ""
28e3caa @joshwilsdon [OS-250] add g to make
joshwilsdon authored
268 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
269 echo ""
270
271 exit 0
Something went wrong with that request. Please try again.