Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 210 lines (185 sloc) 6.748 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-global ...
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-global ...
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 zone a...
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 zone a...
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 zone a...
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-global ...
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
57 for pkg in gmake gcc34 binutils autoconf automake bison libtool; do
58 pkg_info ${pkg} >/dev/null 2>&1 || pkgin -y install ${pkg}
59 done
60 fi
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
61 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
62
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
63 # TODO: move this to illumos-extra itself
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
64 if [ "${HAVE_PKG}" == "true" ]; then
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
65 echo "==> Installing illumos-extra dependencies..."
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-global ...
joshwilsdon authored
66 if [[ ${GLOBAL_ZONE} -eq 1 ]]; then
67 ${ROOTCMD} pkg install \
68 compatibility/ucb \
69 developer/build/autoconf \
70 developer/build/automake-19 \
71 developer/build/automake-110 \
72 developer/build/cmake \
73 developer/build/libtool \
74 developer/parser/bison \
75 library/libevent \
76 || /bin/true
77 else
78 # nonglobal Zone
79 /bin/true
80 fi
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
81 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
82
83 echo "==> Checking for /opt/SUNWspro/bin/cc..."
84 echo " +--> Ensuring SUNWspro (12.1-patched) installed in /opt/SUNWspro/sunstudio12.1..."
85 if [ ! -f "/opt/SUNWspro/sunstudio12.1/prod/bin/cc" ]; then
86 if [ ! -z "${SUNW_SPRO12u1_URL}" ]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
87 (${ROOTCMD} mkdir -p /opt/SUNWspro \
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
88 && cd /opt/SUNWspro \
89 && curl -k ${SUNW_SPRO12u1_URL} \
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
90 | ${ROOTCMD} gtar -zxf -)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
91 else
92 echo "FATAL: unable to download sunstudio12u1, no URL is set. Please set SUNW_SPRO12u1_URL in configure.*"
93 exit 1
94 fi
95 fi
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
96
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
97 echo " +--> Ensuring SUNWspro (12-patched) installed in /opt/SUNWspro..."
98 if [ ! -f "/opt/SUNWspro/prod/bin/cc" ]; then
99 if [ ! -z "${SUNW_SPRO12_URL}" ]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
100 (${ROOTCMD} mkdir -p /opt/SUNWspro \
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
101 && cd /opt/SUNWspro \
102 && curl -k "${SUNW_SPRO12_URL}" \
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
103 | ${ROOTCMD} gtar -jxf -)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
104 else
105 echo "FATAL: unable to download sunstudio12, no URL is set. Please set SUNW_SPRO12_URL in configure.*"
106 exit 1
107 fi
108 fi
109
762a356 @joshwilsdon [OS-16] update illumos-live/configure to be more friendly to non-global ...
joshwilsdon authored
110
111 if [[ ${GLOBAL_ZONE} -eq 1 ]]; then
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
112 echo "==> Creating the missing symlinks..."
113 test -f /usr/bin/aclocal || ${ROOTCMD} ln -s /usr/bin/aclocal-1.10 /usr/bin/aclocal
114 test -f /usr/bin/automake || ${ROOTCMD} ln -s /usr/bin/automake-1.10 /usr/bin/automake
115 # so builds can use --mode and such
116 test -f /usr/bin/install || ${ROOTCMD} ln -s /usr/bin/ginstall /usr/bin/install
117 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-global ...
joshwilsdon authored
118 else
119 # nonglobal Zone
120 /bin/true
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
121 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
122
123 echo "==> Populating projects/ directories..."
de34315 @joshwilsdon Add readme and fix a couple more bugs.
joshwilsdon authored
124 [ ! -d "projects" ] && mkdir -p projects
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
125 if [ ! -d "projects" ] ; then
126 echo "FATAL: unable to create projects/ directory."
127 exit 1
3aeb937 @joshwilsdon Fixes for building in zone.
joshwilsdon authored
128 fi
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
129
130 if [ ! -f "projects/illumos/usr/src/tools/env/illumos.sh" ]; then
131 echo " +--> Getting illumos source tree..."
132 if [ -z "${GET_ILLUMOS}" ]; then
133 echo "FATAL: No GET_ILLUMOS defined in configure.*, can't get illumos!"
134 exit 1
135 fi
136 /bin/bash -c "cd projects && ${GET_ILLUMOS} && cd -"
137 if [ ! -f "projects/illumos/usr/src/tools/env/illumos.sh" ]; then
138 echo "FATAL: GET_ILLUMOS command failed to get illumos!"
139 exit 1
140 fi
141 fi
142
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
143 if [ ! -f "projects/illumos-extra/Makefile" ]; then
144 echo " +--> Getting illumos-extra source tree..."
145 if [ -z "${GET_ILLUMOS_EXTRA}" ]; then
146 echo "FATAL: No GET_ILLUMOS_EXTRA defined in configure.*, can't get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
147 exit 1
148 fi
73352c8 @JohnSonnenschein pointed extra at github
JohnSonnenschein authored
149 /bin/bash -c "cd projects && ${GET_ILLUMOS_EXTRA} && cd -"
150 if [ ! -f "projects/illumos-extra/Makefile" ]; then
151 echo "FATAL: GET_ILLUMOS_EXTRA command failed to get illumos-extra!"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
152 exit 1
153 fi
154 fi
155
156 if [ ! -f "projects/opensolaris-man/README" ]; then
157 echo " +--> Getting opensolaris-man source tree..."
158 if [ -z "${GET_OPENSOLARIS_MAN}" ]; then
159 echo "FATAL: No GET_OPENSOLARIS_MAN defined in configure.*, can't get opensolaris-man!"
160 exit 1
161 fi
162 /bin/bash -c "cd projects && ${GET_OPENSOLARIS_MAN} && cd -"
163 if [ ! -f "projects/opensolaris-man/README" ]; then
164 echo "FATAL: GET_OPENSOLARIS_MAN command failed to get opensolaris-man!"
165 exit 1
166 fi
167 fi
cc41ffa @joshwilsdon [OS-109] added some more manpages, also fixed so manpages come from open...
joshwilsdon authored
168 (cd projects/opensolaris-man && [[ -L usr ]] || ln -s . usr)
169 (cd projects/opensolaris-man && [[ -L share ]] || ln -s . share)
170 (cd projects/opensolaris-man && [[ -L man ]] || ln -s . man)
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
171
172 ROOT=`pwd`
173 echo "==> Setting up illumos-gate"
174
175 cd ${ROOT}/projects/illumos
176
177 if [ ! -f on-closed-bins.i386.tar.bz2 ]; then
178 if [ -z "${ON_CLOSED_BINS_URL}" ]; then
179 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins.i386.tar.bz2
180 else
181 curl -k -O "${ON_CLOSED_BINS_URL}"
182 fi
183 tar xvpf on-closed-bins.i386.tar.bz2
184 fi
185 if [ ! -f on-closed-bins-nd.i386.tar.bz2 ]; then
186 if [ -z "${ON_CLOSED_BINS_ND_URL}" ]; then
187 curl -O http://dlc.sun.com/osol/on/downloads/20100817/on-closed-bins-nd.i386.tar.bz2
188 else
189 curl -k -O "${ON_CLOSED_BINS_ND_URL}"
190 fi
191 tar xvpf on-closed-bins-nd.i386.tar.bz2
192 fi
193
194 cp usr/src/tools/env/illumos.sh .
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
195 [ ! -z "${RELEASE_VER}" ] && gsed -i -e "s|^GATE=.*$|GATE=\"${RELEASE_VER}\"; export GATE|" illumos.sh
196 [ ! -z "${PUBLISHER}" ] && gsed -i -e "s|^# PKGPUBLISHER_REDIST=.*$|PKGPUBLISHER_REDIST=\"${PUBLISHER}\"; export PKGPUBLISHER_REDIST|" illumos.sh
197 gsed -i -e "s|^CODEMGR_WS=.*$|CODEMGR_WS=\"${ROOT}/projects/illumos\"; export CODEMGR_WS|" illumos.sh
468946d @joshwilsdon More tweaks, now just includes md5's in image output manifest and do inc...
joshwilsdon authored
198 gsed -i -e "s|^NIGHTLY_OPTIONS=.*$|NIGHTLY_OPTIONS=\"-inCmprt\"; export NIGHTLY_OPTIONS|" illumos.sh
bbef23b @joshwilsdon Make possible to override stuff we need to override with a sparse zone a...
joshwilsdon authored
199 gsed -i -e "s|^ROOT=.*$|ROOT="${ROOT}/proto"; export ROOT|" illumos.sh
200 gsed -i -e "s|^PARENT_ROOT=.*$|PARENT_ROOT="${ROOT}/proto"; export PARENT_ROOT|" illumos.sh
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
201
202 # For some reason this disappeared before
203 touch ${ROOT}/projects/illumos/usr/src/tools/findunref/exception_list.unknown
204
205 echo ""
1784d58 @joshwilsdon Fix message that referred to running build_live directly.
joshwilsdon authored
206 echo "Configuration complete. You should now be able to build a live image using 'make world && make live'"
43be32e @joshwilsdon Massive update to build process including:
joshwilsdon authored
207 echo ""
208
209 exit 0
Something went wrong with that request. Please try again.