1
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# Script for setting up the common build environment for JDS on Solaris
|
|
4 |
#
|
|
5 |
# CDDL HEADER START
|
|
6 |
#
|
|
7 |
# The contents of this file are subject to the terms of the
|
|
8 |
# Common Development and Distribution License, Version 1.0 only
|
|
9 |
# (the "License"). You may not use this file except in compliance
|
|
10 |
# with the License.
|
|
11 |
#
|
|
12 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
13 |
# or http://www.opensolaris.org/os/licensing.
|
|
14 |
# See the License for the specific language governing permissions
|
|
15 |
# and limitations under the License.
|
|
16 |
#
|
|
17 |
# When distributing Covered Code, include this CDDL HEADER in each
|
|
18 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
19 |
# If applicable, add the following below this CDDL HEADER, with the
|
|
20 |
# fields enclosed by brackets "[]" replaced with your own identifying
|
|
21 |
# information: Portions Copyright [yyyy] [name of copyright owner]
|
|
22 |
#
|
|
23 |
# CDDL HEADER END
|
|
24 |
#
|
|
25 |
#
|
|
26 |
# Copyright 2004-2005 Sun Microsystems, Inc. All rights reserved.
|
|
27 |
# Use is subject to license terms.
|
|
28 |
#
|
|
29 |
|
|
30 |
IFS='
|
|
31 |
'
|
|
32 |
PKGBUILD_VERSION=1.2.0
|
|
33 |
|
|
34 |
# Set to "internal" for sun internal users, "external" for opensolaris
|
|
35 |
# No big differences really, just slightly different defaults
|
|
36 |
INT_EXT=@INT_EXT@
|
|
37 |
if [ "x$INT_EXT" != xinternal -a "x$INT_EXT" != xexternal ]; then
|
|
38 |
INT_EXT=internal
|
|
39 |
fi
|
|
40 |
|
|
41 |
# all tarballs need a FOO_TARBALL variable here to be included in the
|
|
42 |
# CBE dist tarball
|
|
43 |
M4_TARBALL=m4-1.4.5.tar.gz
|
|
44 |
AUTOMAKE_1_9_TARBALL=automake-1.9.6.tar.bz2
|
|
45 |
AUTOMAKE_1_10_TARBALL=automake-1.10.tar.bz2
|
|
46 |
AUTOCONF_TARBALL=autoconf-2.61.tar.bz2
|
|
47 |
LIBTOOL_TARBALL=libtool-1.5.22.tar.gz
|
|
48 |
GETTEXT_TARBALL=gettext-0.14.1.tar.gz
|
|
49 |
FILEUTILS_TARBALL=fileutils-4.1.tar.gz
|
|
50 |
MAKE_TARBALL=make-3.80.tar.bz2
|
|
51 |
FLEX_TARBALL=flex-2.5.33.tar.bz2
|
|
52 |
CVS_TARBALL=cvs-1.12.5.tar.bz2
|
|
53 |
BISON_TARBALL=bison-2.3.tar.bz2
|
|
54 |
DIFF_TARBALL=diffutils-2.8.1.tar.gz
|
|
55 |
ANT_TARBALL=apache-ant-1.6.5-bin.tar.bz2
|
|
56 |
SVN_TARBALL=subversion-1.3.2.tar.bz2
|
|
57 |
|
|
58 |
# Extra packages:
|
|
59 |
RSYNC_TARBALL=rsync-2.6.8.tar.gz
|
|
60 |
|
|
61 |
# Obsolete packages to be pkgrm'd. Mostly renamed packages.
|
|
62 |
OLD_PKGS="JDSautomake JDSautoconf JDSlibtool JDSm4 JDSgettext JDSfileutils
|
|
63 |
JDSmake JDSpatch CBEpatch JDSflex JDScvs SUNWpkgbuild"
|
|
64 |
|
|
65 |
# default log file. Changed to /tmp/jds-cbe.install.log.$$ if the user
|
|
66 |
# installing is not root
|
|
67 |
LOGFILE=/var/sadm/install/logs/jds-cbe.install.log.$$
|
|
68 |
|
|
69 |
# packages that the JDS build requires. cbe-install will check if they
|
|
70 |
# are installed and install them if not.
|
|
71 |
JDS_DEPENDENCIES="SUNWgpch SUNWi2cs SUNWi1cs SUNWi15cs SUNWceuos
|
|
72 |
SUNWcleu SUNWeuluf SUNWdeiso1 SUNWi5cs SUNWi13cs
|
|
73 |
SUNWi9cs SUNWeeuos SUNWi7cs SUNWesiso1 SUNWcleu2
|
|
74 |
SUNWeu8os SUNWfriso1 SUNWale SUNWhkleu SUNWhleu
|
|
75 |
SUNWinleu SUNWitiso1 SUNWjfpu SUNWkleu SUNWmeaos
|
|
76 |
SUNWsmbaS SUNWnafos SUNWnamos SUNWneuos SUNWsamos
|
|
77 |
SUNWseuos SUNWsviso1 SUNWtleu SUNWweuos SUNWgtar
|
|
78 |
SUNWwgetr SUNWwgetu SUNWhea SUNWsfwhea
|
|
79 |
SUNWsprot SUNWxcu4"
|
|
80 |
|
|
81 |
# all non-optional CBE packages
|
|
82 |
CBE_PKGS="SFpkgbuild CBEmake CBEcvs CBEm4 CBEautoconf CBEautomake
|
|
83 |
CBElibtool CBEgettext CBEfileutils CBEflex CBEbison CBEdiff
|
|
84 |
CBEant CBEsvn"
|
|
85 |
|
|
86 |
# default cbe install location
|
|
87 |
cbe_prefix=/opt/jdsbld
|
|
88 |
# this should be set to a reasonable value in install_pkgbuild()
|
|
89 |
pkgbuild_topdir=/fix/me
|
|
90 |
|
|
91 |
# default value for the "who is the build user" question
|
|
92 |
logname=${LOGNAME:-`logname`}
|
|
93 |
if [ -x /usr/xpg4/bin/id ]; then
|
|
94 |
uid=`/usr/xpg4/bin/id -u`
|
|
95 |
username=`/usr/xpg4/bin/id -un`
|
|
96 |
else
|
|
97 |
uid=`/bin/id | cut -f2 -d= | cut -f1 -d'('`
|
|
98 |
username=`/bin/id |cut -f2 -d'(' | cut -f1 -d')'`
|
|
99 |
fi
|
|
100 |
export HOME="$(eval cd ~$username; pwd)"
|
|
101 |
|
|
102 |
# compiler to use for Solaris9 builds (cc -V)
|
|
103 |
fd7_name='Forte Developer 7'
|
|
104 |
fd7_sgnome_dir='FD7'
|
|
105 |
fd7_sparc_version_string='cc: Forte Developer 7 C 5.4 2002/03/09'
|
|
106 |
fd7_i386_version_string='cc: Forte Developer 7 C 5.4 2002/03/09'
|
|
107 |
|
|
108 |
# compiler to use for Solaris10 builds (cc -V)
|
|
109 |
k2_name='Sun ONE Studio 8 (K2)'
|
|
110 |
k2_sgnome_dir='SOS8'
|
|
111 |
k2_sparc_version_string='cc: Sun C 5.5 Patch 112760-08 2004/02/20'
|
|
112 |
k2_i386_version_string='cc: Sun C 5.5 Patch 112761-06 2004/01/13'
|
|
113 |
|
|
114 |
vulcan_name='Sun Studio 10 (Vulcan)'
|
|
115 |
vulcan_sgnome_dir='vulcan-0107/opt'
|
|
116 |
if [ $INT_EXT = internal ]; then
|
|
117 |
# compiler to use for amd64 builds + TJDS + SNV + GNOME 2.10 (S10/x86)
|
|
118 |
# version string of the compiler in /sgnome
|
|
119 |
vulcan_i386_version_string='cc: Sun C 5.7 Patch 117837-04 2005/05/11'
|
|
120 |
vulcan_sparc_version_string='cc: Sun C 5.7 2005/01/07'
|
|
121 |
else
|
|
122 |
# the current (as of 26/Sept/2005) version on opensolaris.org
|
|
123 |
# version string of the compiler available from opensolaris.org
|
|
124 |
vulcan_i386_version_string='cc: Sun C 5.7 Patch 117837-04 2005/05/11'
|
|
125 |
vulcan_sparc_version_string='cc: Sun C 5.7 Patch 117836-03 2005/05/11'
|
|
126 |
fi
|
|
127 |
|
|
128 |
# Sun Studio 11 (aka venus) version strings:
|
|
129 |
venus_name='Sun Studio 11 (Venus)'
|
|
130 |
venus_sgnome_dir="ONNV-TOOLS"
|
|
131 |
venus_alt_dirs="/sgnome/onnv-tools/`uname -p`/SS11/bin /ws/onnv-tools/SUNWspro/SS11/bin"
|
|
132 |
venus_sparc_version_string="cc: Sun C 5.8 Patch 121015-02 2006/03/29"
|
|
133 |
venus_i386_version_string="cc: Sun C 5.8 Patch 121016-02 2006/03/31"
|
|
134 |
|
|
135 |
# Sun Studio 11 (aka venus) with the new patches in /ws/onnv-tools
|
|
136 |
venus_p05_name='Sun Studio 11 (Venus) + patches'
|
|
137 |
venus_p05_sgnome_dir="ONNV-TOOLS"
|
|
138 |
venus_p05_alt_dirs="/sgnome/onnv-tools/`uname -p`/SS11-new/bin /ws/onnv-tools/SUNWspro/SS11-new/bin /sgnome/onnv-tools/`uname -p`/SS11/bin /ws/onnv-tools/SUNWspro/SS11/bin"
|
|
139 |
venus_p05_sparc_version_string="cc: Sun C 5.8 Patch 121015-04 2007/01/10"
|
|
140 |
venus_p05_i386_version_string="cc: Sun C 5.8 Patch 121016-05 2007/01/10"
|
|
141 |
|
|
142 |
always_uninstall_existing=
|
|
143 |
always_skip_existing=
|
|
144 |
|
|
145 |
# write a message to the log file
|
|
146 |
# not visible to the user
|
|
147 |
log () {
|
|
148 |
for msg in "${@}"; do
|
|
149 |
echo "`date`: $msg" >> $LOGFILE
|
|
150 |
done
|
|
151 |
}
|
|
152 |
|
|
153 |
# print a message to the user and also write it to the log file
|
|
154 |
msg () {
|
|
155 |
for msg in "${@}"; do
|
|
156 |
echo $msg
|
|
157 |
echo "`date`: $msg" >> $LOGFILE
|
|
158 |
done
|
|
159 |
}
|
|
160 |
|
|
161 |
# alternate root directory
|
|
162 |
rootdir=/
|
|
163 |
|
|
164 |
process_cl () {
|
|
165 |
while [ $# != 0 ]; do
|
|
166 |
case "$1" in
|
|
167 |
-R )
|
|
168 |
shift
|
|
169 |
if [ $# == 0 ]; then
|
|
170 |
echo "Option -R requires an argument."
|
|
171 |
exit 1
|
|
172 |
fi
|
|
173 |
rootdir=$1
|
|
174 |
case "$rootdir" in
|
|
175 |
/* )
|
|
176 |
;;
|
|
177 |
* )
|
|
178 |
echo "The argument to -R must be an absolute path name"
|
|
179 |
exit 1
|
|
180 |
esac
|
|
181 |
;;
|
|
182 |
-h|--help)
|
|
183 |
echo "Usage: $0 [options]"
|
|
184 |
echo "options:"
|
|
185 |
echo " -h, --help print this usage info"
|
|
186 |
echo " -R rootdir install CBE packages in alternate root directory rootdir"
|
|
187 |
exit 0
|
|
188 |
;;
|
|
189 |
*)
|
|
190 |
echo "Unknown option: $1"
|
|
191 |
exit 1
|
|
192 |
;;
|
|
193 |
esac
|
|
194 |
shift
|
|
195 |
done
|
|
196 |
}
|
|
197 |
|
|
198 |
# clean up if installation is aborted
|
|
199 |
tempdirs=
|
|
200 |
remove_tempdirs () {
|
|
201 |
IFS=:
|
|
202 |
for tdir in $tempdirs; do
|
|
203 |
case "$tdir" in
|
|
204 |
/tmp/* )
|
|
205 |
cd /tmp
|
|
206 |
rm -rf "$tdir"
|
|
207 |
;;
|
|
208 |
esac
|
|
209 |
done
|
|
210 |
}
|
|
211 |
|
|
212 |
init () {
|
|
213 |
myos=`uname -s`
|
|
214 |
if [ "x$myos" != xSunOS ]; then
|
|
215 |
echo "Run this script on a Solaris system."
|
|
216 |
exit 1
|
|
217 |
fi
|
|
218 |
|
|
219 |
umask 0022
|
|
220 |
|
|
221 |
myos_rel=`uname -r`
|
|
222 |
if [ "x$myos_rel" = "x5.10" -o "x$myos_rel" = "x5.10.1" -o "x$myos_rel" = "x5.11" ]; then
|
|
223 |
if [ $INT_EXT = external ]; then
|
|
224 |
cc32_versions='venus_p05 venus vulcan'
|
|
225 |
cc64_versions='venus_p05 venus vulcan'
|
|
226 |
else
|
|
227 |
cc32_versions='venus venus_p05'
|
|
228 |
cc64_versions='venus venus_p05'
|
|
229 |
fi
|
|
230 |
else
|
|
231 |
echo "Solaris 10 or Solaris 11 required."
|
|
232 |
exit 1
|
|
233 |
fi
|
|
234 |
|
|
235 |
mydir=$(cd $(dirname $0); pwd);
|
|
236 |
tardir=$mydir/tarballs
|
|
237 |
|
|
238 |
CBE_VERSION=`cat $mydir/CBE_VERSION`
|
|
239 |
|
|
240 |
my_id=`/usr/xpg4/bin/id -u`
|
|
241 |
if [ "x$my_id" != x0 ]; then
|
|
242 |
profiles | grep 'Software Installation' > /dev/null
|
|
243 |
if [ $? != 0 ]; then
|
|
244 |
echo 'Run this script as root or a user with the "Software Installation" profile'
|
|
245 |
echo 'See the user_attr(4) and profiles(1) manual pages for details'
|
|
246 |
exit 1
|
|
247 |
fi
|
|
248 |
LOGFILE=/tmp/jds-cbe-${CBE_VERSION}.install.log.$$
|
|
249 |
else
|
|
250 |
LOGFILE=/var/sadm/install/logs/jds-cbe-${CBE_VERSION}.install.log.$$
|
|
251 |
fi
|
|
252 |
|
|
253 |
msg "Checking for required packages..."
|
|
254 |
check_jds_dependencies
|
|
255 |
|
|
256 |
if ! pkginfo -R $rootdir -q 'SUNWgpch.*'; then
|
|
257 |
echo "ERROR: pkgbuild requires the GNU patch utility (/usr/bin/gpatch)."
|
|
258 |
echo "ERROR: please install SUNWgpch from your Solaris installation media"
|
|
259 |
echo "ERROR: before installing the JDS CBE."
|
|
260 |
exit 1
|
|
261 |
fi
|
|
262 |
|
|
263 |
if ! pkginfo -R $rootdir -q 'SUNWgtar.*'; then
|
|
264 |
echo "ERROR: pkgbuild requires the GNU tar utility (/usr/sfw/bin/gtar)."
|
|
265 |
echo "ERROR: please install SUNWgtar from your Solaris installation media"
|
|
266 |
echo "ERROR: before installing the JDS CBE."
|
|
267 |
exit 1
|
|
268 |
fi
|
|
269 |
|
|
270 |
if [ -f /usr/sfw/include/glib.h ]; then
|
|
271 |
echo "WARNING: /usr/sfw/include/glib.h is in conflict with the JDS headers."
|
|
272 |
echo "WARNING: Please remove this file or SUNWGlib to avoid build problems."
|
|
273 |
echo
|
|
274 |
echo "Press Enter to continue"
|
|
275 |
read dummy
|
|
276 |
fi
|
|
277 |
|
|
278 |
if ! pkginfo -R $rootdir -q 'SUNWwgetu.*'; then
|
|
279 |
echo "WARNING: pkgbuild requires wget for full functionality."
|
|
280 |
echo "WARNING: please install SUNWwgetr and SUNWwgetu from your"
|
|
281 |
echo "WARNING: Solaris installation media"
|
|
282 |
echo
|
|
283 |
echo "Press Enter to continue"
|
|
284 |
read dummy
|
|
285 |
fi
|
|
286 |
|
|
287 |
log "Running on `uname -a`"
|
|
288 |
log "My directory is $mydir"
|
|
289 |
|
|
290 |
ENV_SET=`env | cut -f1 -d=`
|
|
291 |
for var in $ENV_SET; do
|
|
292 |
case $var in
|
|
293 |
PS1|PS2|HZ|TERM|SHELL|OLDPWD|PATH|MAIL|PWD|TZ|SHLVL|HOME|LOGNAME|PRINTER|HOSTNAME|_|CC|CXX|EDITOR|SSH_*|DISPLAY|LESS*|LS_COLORS|LS_OPTIONS|TERMINFO|PAGER|MANPATH|VISUAL)
|
|
294 |
;;
|
|
295 |
*)
|
|
296 |
val=`eval echo "\\\$$var"`
|
|
297 |
log "Unsetting $var (=\"$val\")"
|
|
298 |
unset $var
|
|
299 |
;;
|
|
300 |
esac
|
|
301 |
done
|
|
302 |
|
|
303 |
tempdir=/tmp/cbe-install.$$
|
|
304 |
tempdirs="$tempdirs:$tempdir"
|
|
305 |
trap remove_tempdirs QUIT EXIT
|
|
306 |
logrun mkdir -p $tempdir
|
|
307 |
|
|
308 |
if [ -f $mydir/pkgs/CBElibtool/pkginfo ]; then
|
|
309 |
binary_install=yes
|
|
310 |
pkg_arch=`grep '^ARCH=' $mydir/pkgs/CBElibtool/pkginfo | cut -f2 -d=`
|
|
311 |
arch=`uname -p`
|
|
312 |
if [ "x$arch" != "x$pkg_arch" ]; then
|
|
313 |
echo "ERROR: wrong architecture"
|
|
314 |
echo "ERROR: these JDS CBE packages must be installed on a $pkg_arch system"
|
|
315 |
exit 1
|
|
316 |
fi
|
|
317 |
cbe_prefix=/opt/jdsbld
|
|
318 |
else
|
|
319 |
binary_install=no
|
|
320 |
fi
|
|
321 |
}
|
|
322 |
|
|
323 |
# ask "question" variable_name "default answer"
|
|
324 |
#
|
|
325 |
# answer is stored in variable variable_name
|
|
326 |
ask () {
|
|
327 |
echo -n "$1"
|
|
328 |
if [ ! -z $3 ]; then
|
|
329 |
echo -n " [$3]: "
|
|
330 |
else
|
|
331 |
echo -n ": "
|
|
332 |
fi
|
|
333 |
|
|
334 |
read -e val
|
|
335 |
if [ "x$val" = x ]; then
|
|
336 |
eval "$2=\"$3\""
|
|
337 |
else
|
|
338 |
eval "$2=\"$val\""
|
|
339 |
fi
|
|
340 |
}
|
|
341 |
|
|
342 |
# ask_yes_no "question" variable_name "default answer"
|
|
343 |
#
|
|
344 |
# Answer ("yes" or "no") is stored in variable variable_name.
|
|
345 |
# Keep asking the user until the answer is yes or no.
|
|
346 |
ask_yes_no () {
|
|
347 |
yes_no_repeat=yes
|
|
348 |
while [ $yes_no_repeat = yes ]; do
|
|
349 |
yes_no_repeat=no
|
|
350 |
ask "${@}"
|
|
351 |
eval "the_ans=\"\$$2\""
|
|
352 |
case "$the_ans" in
|
|
353 |
[yY]|[yY][eE][sS] )
|
|
354 |
eval "$2=yes"
|
|
355 |
;;
|
|
356 |
[nN]|[nN][oO] )
|
|
357 |
eval "$2=no"
|
|
358 |
;;
|
|
359 |
* )
|
|
360 |
echo "Please answer yes or no"
|
|
361 |
yes_no_repeat=yes
|
|
362 |
esac
|
|
363 |
done
|
|
364 |
}
|
|
365 |
|
|
366 |
# get_dir "question" "answer_var" "default answer" "owner"
|
|
367 |
#
|
|
368 |
# Ask for a directory name and make sure it exists or create it
|
|
369 |
# for the user
|
|
370 |
get_dir () {
|
|
371 |
repeat=yes
|
|
372 |
while [ $repeat = yes ]; do
|
|
373 |
repeat=no
|
|
374 |
ask "$1" new_dir "$3"
|
|
375 |
case "$new_dir" in
|
|
376 |
/* )
|
|
377 |
# absolute path name, nothing to do
|
|
378 |
;;
|
|
379 |
~* )
|
|
380 |
if [ "x$rootdir" != x/ ]; then
|
|
381 |
msg "The JDS CBE is being installed to an alternate root directory."
|
|
382 |
msg "You need to specify the full path to directories within the alternate root."
|
|
383 |
repeat=yes
|
|
384 |
continue
|
|
385 |
fi
|
|
386 |
d1=`echo "$new_dir" | cut -f1 -d/`
|
|
387 |
d2=`echo "$new_dir/" | cut -f2- -d/`
|
|
388 |
d1n=$(eval echo "$d1")
|
|
389 |
test -d "$d1n" || {
|
|
390 |
repeat=yes
|
|
391 |
msg "Directory not found: $d1"
|
|
392 |
continue
|
|
393 |
}
|
|
394 |
d1n=$(cd "$d1n" 2>/dev/null && pwd) || {
|
|
395 |
repeat=yes
|
|
396 |
msg "Failed to access directory: $d1"
|
|
397 |
continue
|
|
398 |
}
|
|
399 |
msg "Directory $new_dir expanded to $d1n/$d2"
|
|
400 |
new_dir="$d1n/$d2"
|
|
401 |
;;
|
|
402 |
* )
|
|
403 |
if [ "x$rootdir" != x/ ]; then
|
|
404 |
msg "The JDS CBE is being installed to an alternate root directory."
|
|
405 |
msg "You need to specify the full path to directories within the alternate root."
|
|
406 |
repeat=yes
|
|
407 |
continue
|
|
408 |
fi
|
|
409 |
d1=`echo "$new_dir" | cut -f1 -d/`
|
|
410 |
d2=`echo "$new_dir/" | cut -f2- -d/`
|
|
411 |
d1n=$(eval echo "$d1")
|
|
412 |
test -d "$d1n" || {
|
|
413 |
repeat=yes
|
|
414 |
msg "Directory not found: $d1"
|
|
415 |
continue
|
|
416 |
}
|
|
417 |
d1n=$(cd "$d1n" 2>/dev/null && pwd) || {
|
|
418 |
repeat=yes
|
|
419 |
msg "Failed to access directory: $d1"
|
|
420 |
continue
|
|
421 |
}
|
|
422 |
msg "Directory $new_dir expanded to $d1n/$d2"
|
|
423 |
new_dir="$d1n/$d2"
|
|
424 |
;;
|
|
425 |
esac
|
|
426 |
done
|
|
427 |
if [ "x$new_dir" != "x/" ]; then
|
|
428 |
new_dir=`echo "$new_dir" | sed -e 's%/*$%%'`
|
|
429 |
fi
|
|
430 |
eval "$2=\"$new_dir\""
|
|
431 |
}
|
|
432 |
|
|
433 |
#
|
|
434 |
# ask_ccdir
|
|
435 |
#
|
|
436 |
# result in new_ccdir and cc_name and cxx_name
|
|
437 |
|
|
438 |
# The args are:
|
|
439 |
# <cc_version>: expected compiler version to be displayed to the user,
|
|
440 |
# e.g. "Sun Studio 10"
|
|
441 |
# <cc_version_string>: expected output of cc -V
|
|
442 |
# <sgnome_cc_version>: compiler subdir in /sgnome (for .ireland users)
|
|
443 |
# <ccn>: default answer (full path to cc)
|
|
444 |
ask_ccdir () {
|
|
445 |
if [ $INT_EXT = internal ]; then
|
|
446 |
REC="required"
|
|
447 |
else
|
|
448 |
REC="recommended"
|
|
449 |
fi
|
|
450 |
echo "The $REC C compiler(s) for this version of the JDS CBE is/are:"
|
|
451 |
for compiler in $cc32_versions; do
|
|
452 |
echo " `eval echo \\\$${compiler}_name` (`eval echo \\\$${compiler}_$(uname -p)_version_string`)"
|
|
453 |
done
|
|
454 |
|
|
455 |
sgnome_cc32dirs=
|
|
456 |
for compiler in $cc32_versions; do
|
|
457 |
sgnome_cc32dirs="$sgnome_cc32dirs /sgnome/tools/${the_cpu}-solaris/forte/`eval echo \\\$${compiler}_sgnome_dir`/SUNWspro/bin"
|
|
458 |
sgnome_cc32dirs="$sgnome_cc32dirs `eval echo \\\$${compiler}_alt_dirs`"
|
|
459 |
done
|
|
460 |
for cc32dir in $sgnome_cc32dirs; do
|
|
461 |
cc32name="$cc32dir/cc"
|
|
462 |
test -x $cc32name && break
|
|
463 |
done
|
|
464 |
if [ ! -d "$cc32dir" ]; then
|
|
465 |
CC=${CC:-`which cc`}
|
|
466 |
if [ -x "$CC" ]; then
|
|
467 |
cc32dir=$(dirname $CC)
|
|
468 |
cc32name=$cc32dir/cc
|
|
469 |
else
|
|
470 |
cc32dir=
|
|
471 |
cc32name=
|
|
472 |
fi
|
|
473 |
fi
|
|
474 |
|
|
475 |
repeat=yes
|
|
476 |
while [ $repeat = yes ]; do
|
|
477 |
repeat=no
|
|
478 |
ask "Enter the path to the C compiler" "new_ccn" "$cc32name"
|
|
479 |
new_ccdir=$(dirname $new_ccn)
|
|
480 |
if [ ! -e "$new_ccn" ]; then
|
|
481 |
echo $new_ccn not found
|
|
482 |
repeat=yes
|
|
483 |
elif [ ! -f "$new_ccn" ]; then
|
|
484 |
echo $new_ccn is not a file
|
|
485 |
repeat=yes
|
|
486 |
elif [ ! -x "$new_ccn" ]; then
|
|
487 |
echo $new_ccn is not executable
|
|
488 |
repeat=yes
|
|
489 |
else
|
|
490 |
cc_name=`basename "$new_ccn"`
|
|
491 |
if [ "x$cc_name" = xgcc ]; then
|
|
492 |
echo
|
|
493 |
echo "You chose gcc as your C compiler. Note that building JDS using gcc may be"
|
|
494 |
echo "possible but is not tested or supported."
|
|
495 |
echo
|
|
496 |
echo "Press Enter to continue"
|
|
497 |
read dummy
|
|
498 |
cxx_name=g++
|
|
499 |
else
|
|
500 |
cxx_name=CC
|
|
501 |
version_ok=no
|
|
502 |
for compiler in $cc32_versions; do
|
|
503 |
"$new_ccn" -V 2>&1 | egrep -s "`eval echo \\\$${compiler}_$(uname -p)_version_string`" && {
|
|
504 |
version_ok=yes
|
|
505 |
break
|
|
506 |
}
|
|
507 |
done
|
|
508 |
if [ $version_ok = no ]; then
|
|
509 |
echo "$new_ccn is not the $REC compiler"
|
|
510 |
echo "\"cc -V\" should print one of the following:"
|
|
511 |
for compiler in $cc32_versions; do
|
|
512 |
echo " `eval echo \\\$${compiler}_$(uname -p)_version_string`"
|
|
513 |
done
|
|
514 |
|
|
515 |
ask_yes_no "Would you like to use this compiler anyway?" \
|
|
516 |
use_different_cc no
|
|
517 |
if [ $use_different_cc = yes ]; then
|
|
518 |
log "User chose to use a non-standard C compiler:"
|
|
519 |
log "`$new_ccn -V 1>&1`"
|
|
520 |
repeat=no
|
|
521 |
else
|
|
522 |
repeat=yes
|
|
523 |
fi
|
|
524 |
else
|
|
525 |
ccls=$( cd $new_ccdir; ls -l cc )
|
|
526 |
case "$ccls" in
|
|
527 |
*"cc -> ../prod/bin/cc" )
|
|
528 |
;;
|
|
529 |
* )
|
|
530 |
echo "cc is expected to be a symlink to ../prod/bin/cc"
|
|
531 |
if [ $INT_EXT = internal ]; then
|
|
532 |
echo "See the README file for information about installing the C compiler"
|
|
533 |
echo "or using it via NFS on SWAN"
|
|
534 |
fi
|
|
535 |
repeat=yes
|
|
536 |
;;
|
|
537 |
esac
|
|
538 |
fi
|
|
539 |
fi
|
|
540 |
fi
|
|
541 |
done
|
|
542 |
}
|
|
543 |
|
|
544 |
# gather info for the installation from the user
|
|
545 |
ask_defaults () {
|
|
546 |
if [ $binary_install != yes ]; then
|
|
547 |
repeat=yes
|
|
548 |
while [ $repeat = yes ]; do
|
|
549 |
repeat=no
|
|
550 |
get_dir "Enter the base directory (prefix) of the cbe" \
|
|
551 |
cbe_prefix $cbe_prefix root
|
|
552 |
if [ "$cbe_prefix" = "/" -o "$cbe_prefix" = "/tmp" ]; then
|
|
553 |
echo "This directory is not allowed."
|
|
554 |
echo "Please choose a different one as the cbe prefix"
|
|
555 |
repeat=yes
|
|
556 |
fi
|
|
557 |
done
|
|
558 |
fi
|
|
559 |
|
|
560 |
if [ ! -f "$HOME/.pkgbuildmacros" -a ! -d "$HOME/packages" ]; then
|
|
561 |
# the user probably hasn't used pkgbuild >= 1.1.0 yet
|
|
562 |
# so let's ask if they want to use a specific topdir
|
|
563 |
# instead of $HOME/packages
|
|
564 |
echo "Starting from pkgbuild 1.1.0 (JDS CBE 1.5) there is no system-wide"
|
|
565 |
echo "build directory (%_topdir), instead, each user has their own."
|
|
566 |
echo "The default directory is \$HOME/packages."
|
|
567 |
echo "If you wish to use a different build directory, you can define it"
|
|
568 |
echo "in \$HOME/.pkgbuildmacros as follows:"
|
|
569 |
echo
|
|
570 |
echo " %_topdir /path/to/my/build/area"
|
|
571 |
echo
|
|
572 |
if [ "$uid" = 0 ]; then
|
|
573 |
echo
|
|
574 |
echo Press Enter to continue
|
|
575 |
read dummy
|
|
576 |
else
|
|
577 |
ask_yes_no "Would you like to do this now?" \
|
|
578 |
set_topdir no
|
|
579 |
if [ $set_topdir = no ]; then
|
|
580 |
log "the user chose not to change the default topdir"
|
|
581 |
echo "The default topdir ($HOME/packages) will be used"
|
|
582 |
else
|
|
583 |
get_dir "Enter your build directory" default_topdir \
|
|
584 |
"$cbe_prefix/packages" $logname
|
|
585 |
log "the user selected $default_topdir for topdir"
|
|
586 |
echo "%_topdir $default_topdir" > $HOME/.pkgbuildmacros
|
|
587 |
log "created $HOME/.pkgbuildmacros"
|
|
588 |
fi
|
|
589 |
fi
|
|
590 |
else
|
|
591 |
log "the user already has a .pkgbuildmacros file or ~/packages dir"
|
|
592 |
fi
|
|
593 |
|
|
594 |
the_cpu=`uname -p`
|
|
595 |
if [ "x$the_cpu" != xsparc ]; then
|
|
596 |
the_cpu=x86
|
|
597 |
fi
|
|
598 |
|
|
599 |
ask_ccdir
|
|
600 |
|
|
601 |
cc32dir="$new_ccdir"
|
|
602 |
log "32-bit C compiler: $cc32dir/$cc_name"
|
|
603 |
log "32-bit C++ compiler: $cc32dir/$cxx_name"
|
|
604 |
|
|
605 |
cc64dir="$cc32dir"
|
|
606 |
log "64-bit C compiler: $cc64dir/$cc_name"
|
|
607 |
log "64-bit C++ compiler: $cc64dir/$cxx_name"
|
|
608 |
|
|
609 |
msg "This version of the CBE comes with some optional utilities."
|
|
610 |
msg "These are not required for building the JDS code, nevertheless"
|
|
611 |
msg "they are useful to have on your system."
|
|
612 |
msg "Please see the README file for the list of optional utilities."
|
|
613 |
|
|
614 |
ask_yes_no "Would you like to install the optional packages?" \
|
|
615 |
cbe_opt yes
|
|
616 |
if [ $cbe_opt = yes ]; then
|
|
617 |
log "User chose to install optional packages"
|
|
618 |
else
|
|
619 |
log "User chose not to install optional pkgs"
|
|
620 |
fi
|
|
621 |
}
|
|
622 |
|
|
623 |
# create an admin file for pkgadd/pkgrm
|
|
624 |
make_admin_file () {
|
|
625 |
echo "mail=" > $1
|
|
626 |
echo "instance=unique" >> $1
|
|
627 |
echo "conflict=nocheck" >> $1
|
|
628 |
echo "conflict=quit" >> $1
|
|
629 |
echo "setuid=nocheck" >> $1
|
|
630 |
echo "action=nocheck" >> $1
|
|
631 |
echo "partial=quit" >> $1
|
|
632 |
echo "space=quit" >> $1
|
|
633 |
if [ "$2" = "pkgrm" ]; then
|
|
634 |
echo "idepend=nocheck" >> $1
|
|
635 |
echo "rdepend=nocheck" >> $1
|
|
636 |
else
|
|
637 |
echo "idepend=quit" >> $1
|
|
638 |
echo "rdepend=quit" >> $1
|
|
639 |
fi
|
|
640 |
}
|
|
641 |
|
|
642 |
# run a command, redirect the output to a log file and also print it
|
|
643 |
# on stdout
|
|
644 |
logrun () {
|
|
645 |
status_file=/tmp/.command_status.$$
|
|
646 |
/usr/bin/rm -f $status_file
|
|
647 |
log "running $*"
|
|
648 |
log "*** command output follows ***"
|
|
649 |
( "${@}" 2>&1 ; echo $? > $status_file ) | tee -a $LOGFILE
|
|
650 |
log "*** command output ends ***"
|
|
651 |
status=`cat $status_file`
|
|
652 |
/usr/bin/rm -f $status_file
|
|
653 |
return $status
|
|
654 |
}
|
|
655 |
|
|
656 |
# check if a package is installed and if so, offer to uninstall it
|
|
657 |
check_if_installed () {
|
|
658 |
skip_package=no
|
|
659 |
|
|
660 |
pkginfo -R $rootdir -q "$1"'.*' || return 0
|
|
661 |
|
|
662 |
if [ x$always_uninstall_existing != xyes -a x$always_skip_existing != xyes ]; then
|
|
663 |
msg "Package $1 is already installed."
|
|
664 |
ask_yes_no "Would you like uninstall it?" do_uninstall yes
|
|
665 |
if [ $do_uninstall = yes ]; then
|
|
666 |
if [ x$always_uninstall_existing != xno ]; then
|
|
667 |
ask_yes_no "Always uninstall previously installed packages?" \
|
|
668 |
always_uninstall_existing yes
|
|
669 |
log "always_uninstall_existing = $always_uninstall_existing"
|
|
670 |
fi
|
|
671 |
fi
|
|
672 |
else
|
|
673 |
if [ x$always_skip_existing = xyes ]; then
|
|
674 |
msg "Skipping package $1 -- already installed"
|
|
675 |
skip_package=yes
|
|
676 |
return 0
|
|
677 |
else
|
|
678 |
do_uninstall=yes
|
|
679 |
fi
|
|
680 |
fi
|
|
681 |
if [ $do_uninstall = yes ]; then
|
|
682 |
log "User chose to uninstall $1"
|
|
683 |
make_admin_file /tmp/pkgrm.admin.$$ pkgrm || return 1
|
|
684 |
pkgrm_failed=no
|
|
685 |
logrun pfexec /usr/sbin/pkgrm -R $rootdir -n -a /tmp/pkgrm.admin.$$ "$1.*" || pkgrm_failed=yes
|
|
686 |
if [ $pkgrm_failed = yes ]; then
|
|
687 |
ask_yes_no "pkgrm failed. would you like to continue anyway?" pkgrm_cont no
|
|
688 |
if [ $pkgrm_cont = yes ]; then
|
|
689 |
log "User chose to continue anyway"
|
|
690 |
return 0
|
|
691 |
fi
|
|
692 |
return 1
|
|
693 |
fi
|
|
694 |
return 0
|
|
695 |
else
|
|
696 |
log "User chose not to uninstall $1"
|
|
697 |
if [ x$always_skip_existing != xyes ]; then
|
|
698 |
ask_yes_no "Would you like skip to the next package?" skip_package yes
|
|
699 |
if [ $skip_package = yes ]; then
|
|
700 |
log "User chose to skip package $1"
|
|
701 |
if [ x$always_skip_existing != xno ]; then
|
|
702 |
ask_yes_no "Always skip packages that are already installed?" always_skip_existing yes
|
|
703 |
log "always_skip_existing = $always_skip_existing"
|
|
704 |
fi
|
|
705 |
return 0
|
|
706 |
fi
|
|
707 |
else
|
|
708 |
skip_package=yes
|
|
709 |
return 0
|
|
710 |
fi
|
|
711 |
msg "Not uninstalling $1."
|
|
712 |
msg "NOTE that this may cause problems later"
|
|
713 |
ask "Press Enter to continue" dummy ""
|
|
714 |
return 0
|
|
715 |
fi
|
|
716 |
|
|
717 |
return 0
|
|
718 |
}
|
|
719 |
|
|
720 |
# install a list of svr4 packages given its directory, altroot and the
|
|
721 |
# names of the packages
|
|
722 |
install_pkgs () {
|
|
723 |
pdir=$1; shift
|
|
724 |
rdir=$1; shift
|
|
725 |
make_admin_file $tempdir/pkgadd.admin.$$ pkgadd
|
|
726 |
|
|
727 |
for pkg in $*; do
|
|
728 |
msg "Installing package $pkg"
|
|
729 |
logrun pfexec /usr/sbin/pkgadd -R "$rdir" -n -a $tempdir/pkgadd.admin.$$ -d "$pdir" $pkg || \
|
|
730 |
return 1
|
|
731 |
done
|
|
732 |
/usr/bin/rm -f $tempdir/pkgadd.admin.$$
|
|
733 |
return 0
|
|
734 |
}
|
|
735 |
|
|
736 |
install_all_dependencies=
|
|
737 |
solaris_pkg_dir=/cdrom/cdrom0/Solaris_11/Product
|
|
738 |
# check if the pkgs JDS requires are installed; if not install them
|
|
739 |
check_jds_dependencies () {
|
|
740 |
retval=0
|
|
741 |
# we're going to cp solaris pkgs from the media to this dir
|
|
742 |
tmp_pkg_dir=`mktemp -d /tmp/cbe-pkgs-XXXX`
|
|
743 |
# schedule this dir for removal if the installation is aborted
|
|
744 |
tempdirs="$tempdirs:$tmp_pkg_dir"
|
|
745 |
for pkg in $JDS_DEPENDENCIES; do
|
|
746 |
pkginfo -R $rootdir -q "$pkg."'*' && continue
|
|
747 |
if [ "x$install_all_dependencies" != xyes ]; then
|
|
748 |
msg "Package $pkg is required for building JDS"
|
|
749 |
ask_yes_no "Would you like to install it now?" do_inst "yes"
|
|
750 |
if [ $do_inst = yes ]; then
|
|
751 |
if [ "x$install_all_dependencies" != xno ]; then
|
|
752 |
ask_yes_no \
|
|
753 |
"Install all required packages?" \
|
|
754 |
install_all_dependencies "yes"
|
|
755 |
fi
|
|
756 |
while /bin/true; do
|
|
757 |
ask "Enter the path to the Solaris packages" \
|
|
758 |
solaris_pkg_dir "$solaris_pkg_dir"
|
|
759 |
# Copy all packages found in $solaris_pkg_dir to a temporary
|
|
760 |
# dir so that people installing from CDs don't need to
|
|
761 |
# swap CDs all the time...
|
|
762 |
for p0 in $JDS_DEPENDENCIES; do
|
|
763 |
pkginfo -q $p0 && continue
|
|
764 |
test -d $tmp_pkg_dir/$p0 && continue
|
|
765 |
test -d "$solaris_pkg_dir/$p0" && \
|
|
766 |
/bin/cp -r "$solaris_pkg_dir/$p0" $tmp_pkg_dir && \
|
|
767 |
/bin/chmod -R u+w $tmp_pkg_dir/$p0
|
|
768 |
done
|
|
769 |
test -d "$solaris_pkg_dir/$pkg" && break
|
|
770 |
msg "$solaris_pkg_dir/$pkg not found"
|
|
771 |
done
|
|
772 |
else
|
|
773 |
log "user chose not to install required package $pkg"
|
|
774 |
continue
|
|
775 |
fi
|
|
776 |
fi
|
|
777 |
while /bin/true; do
|
|
778 |
msg "Installing package $pkg"
|
|
779 |
make_admin_file /tmp/pkgadd.admin.$$ pkgadd
|
|
780 |
if [ -d $tmp_pkg_dir/$pkg ]; then
|
|
781 |
logrun pfexec /usr/sbin/pkgadd -R $rootdir -n -a /tmp/pkgadd.admin.$$ -d "$tmp_pkg_dir" $pkg
|
|
782 |
if [ $? != 0 ]; then
|
|
783 |
msg "WARNING: failed to install required package $pkg"
|
|
784 |
ask_yes_no "Would you like to retry?" "do_retry" "yes"
|
|
785 |
else
|
|
786 |
do_retry=no_need_to
|
|
787 |
fi
|
|
788 |
else
|
|
789 |
msg "Package $pkg was not found in $solaris_pkg_dir"
|
|
790 |
do_retry=yes
|
|
791 |
/bin/true
|
|
792 |
fi
|
|
793 |
if [ $do_retry = yes ]; then
|
|
794 |
while /bin/true; do
|
|
795 |
ask "Enter the path to the Solaris packages" \
|
|
796 |
solaris_pkg_dir "$solaris_pkg_dir"
|
|
797 |
test -d "$solaris_pkg_dir/$pkg" && break
|
|
798 |
msg "$solaris_pkg_dir/$pkg not found"
|
|
799 |
done
|
|
800 |
# Copy all packages found in $solaris_pkg_dir to a temporary
|
|
801 |
# dir so that people installing from CDs don't need to
|
|
802 |
# swap CDs all the time...
|
|
803 |
for p0 in $JDS_DEPENDENCIES; do
|
|
804 |
test -d "$solaris_pkg_dir/$p0" && \
|
|
805 |
/bin/cp -r "$solaris_pkg_dir/$p0" $tmp_pkg_dir && \
|
|
806 |
/bin/chmod -R u+w $tmp_pkg_dir/$p0
|
|
807 |
done
|
|
808 |
elif [ $do_retry = no ]; then
|
|
809 |
ask_yes_no "Continue installation anyway?" \
|
|
810 |
do_continue no
|
|
811 |
if [ $do_continue = no ]; then
|
|
812 |
/bin/rm -f /tmp/pkgadd.admin.$$
|
|
813 |
/bin/rm -rf $tmp_pkg_dir
|
|
814 |
msg "Installation aborted."
|
|
815 |
exit 1
|
|
816 |
else
|
|
817 |
break
|
|
818 |
fi
|
|
819 |
break
|
|
820 |
else
|
|
821 |
/bin/rm -rf $tmp_pkg_dir/$pkg
|
|
822 |
/bin/rm -f /tmp/pkgadd.admin.$$
|
|
823 |
break
|
|
824 |
fi
|
|
825 |
done
|
|
826 |
done
|
|
827 |
/bin/rm -rf $tmp_pkg_dir
|
|
828 |
}
|
|
829 |
|
|
830 |
# install pkgbuild from tarball to a temp location and then build a
|
|
831 |
# pkgbuild pkg using itself
|
|
832 |
install_pkgbuild () {
|
|
833 |
check_if_installed SFpkgbuild || {
|
|
834 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
835 |
return 1
|
|
836 |
}
|
|
837 |
if [ $skip_package = yes ]; then
|
|
838 |
return 0
|
|
839 |
fi
|
|
840 |
export PATH=/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/usr/sfw/bin
|
|
841 |
cd $tempdir || return 1
|
|
842 |
logrun mkdir -p pkgbuild.tmp.$$/src || return 1
|
|
843 |
cd pkgbuild.tmp.$$/src || return 1
|
|
844 |
logrun bash -c "bzcat $tardir/pkgbuild-$PKGBUILD_VERSION.tar.bz2 | tar xvf -" || return 1
|
|
845 |
cd pkgbuild-$PKGBUILD_VERSION || return 1
|
|
846 |
logrun ./configure --prefix="$tempdir/pkgbuild.tmp.$$" || return 1
|
|
847 |
logrun make install || return 1
|
|
848 |
msg "Now rebuilding pkgbuild using itself"
|
|
849 |
logrun mkdir -p $tempdir/pkgbuild.tmp.$$/packages/SOURCES || return 1
|
|
850 |
logrun cp $tardir/pkgbuild-$PKGBUILD_VERSION.tar.bz2 $tempdir/pkgbuild.tmp.$$/packages/SOURCES/ || return 1
|
|
851 |
logrun bash -c "$tempdir/pkgbuild.tmp.$$/bin/pkgbuild --define \"pkgbuild_prefix $cbe_prefix\" --define \"_topdir $tempdir/pkgbuild.tmp.$$/packages\" -ba $tempdir/pkgbuild.tmp.$$/src/pkgbuild-$PKGBUILD_VERSION/pkgbuild.spec" || return 1
|
|
852 |
make_admin_file $tempdir/pkgadd.admin.$$ pkgadd
|
|
853 |
logrun pfexec /usr/sbin/pkgadd -R $rootdir -n -a $tempdir/pkgadd.admin.$$ -d "$tempdir/pkgbuild.tmp.$$/packages/PKGS" SFpkgbuild || return 1
|
|
854 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
855 |
logrun mkdir -p "$rootdir/$pkgbuild_topdir/PKGS"
|
|
856 |
logrun mkdir -p "$rootdir/$pkgbuild_topdir/SPKGS"
|
|
857 |
logrun cp -rf "$tempdir/pkgbuild.tmp.$$/packages/SPKGS/SFpkgbuild-src" "$rootdir/$pkgbuild_topdir/SPKGS"
|
|
858 |
logrun cp -rf "$tempdir/pkgbuild.tmp.$$/packages/PKGS/SFpkgbuild" "$rootdir/$pkgbuild_topdir/PKGS"
|
|
859 |
cd /tmp || return 1
|
|
860 |
logrun /usr/bin/rm -rf $tempdir/pkgbuild.tmp.$$ $tempdir/pkgbuild-$PKGBUILD_VERSION || return 1
|
|
861 |
|
|
862 |
return 0
|
|
863 |
}
|
|
864 |
|
|
865 |
# build and install a package
|
|
866 |
build_pkg () {
|
|
867 |
check_if_installed $3 || return 1
|
|
868 |
if [ $skip_package = yes ]; then
|
|
869 |
return 0
|
|
870 |
fi
|
|
871 |
logrun mkdir -p "$rootdir/$pkgbuild_topdir/SOURCES"
|
|
872 |
if [ "x$2" != x ]; then
|
|
873 |
log "copying tarball $2 to $rootdir$pkgbuild_topdir/SOURCES"
|
|
874 |
fname=`basename $2`
|
|
875 |
logrun rm -f "$rootdir$pkgbuild_topdir/SOURCES/$fname"
|
|
876 |
logrun cp $2 "$rootdir$pkgbuild_topdir/SOURCES" 2>&1 || return 1
|
|
877 |
fi
|
|
878 |
export "PATH=$rootdir$cbe_prefix/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/usr/sfw/bin"
|
|
879 |
export CC="$cc32dir/$cc_name"
|
|
880 |
export CXX="$cc32dir/$cxx_name"
|
|
881 |
if [ "x$rootdir" != x/ ]; then
|
|
882 |
export AC_MACRODIR="$rootdir$cbe_prefix/share/autoconf"
|
|
883 |
sed -e "s%--prepend-include %--prepend-include $rootdir%" "$rootdir$cbe_prefix/share/autoconf/autom4te.cfg" > $tempdir/autom4te.cfg
|
|
884 |
export AUTOM4TE_CFG="$tempdir/autom4te.cfg"
|
|
885 |
export autom4te_perllibdir="$rootdir$cbe_prefix/share/autoconf"
|
|
886 |
export AUTOM4TE="$rootdir$cbe_prefix/bin/autom4te"
|
|
887 |
fi
|
|
888 |
msg "Building package $3"
|
|
889 |
logrun pkgbuild --define "_topdir $rootdir$pkgbuild_topdir" --define "cbe_prefix $cbe_prefix" -ba $1 || \
|
|
890 |
return 1
|
|
891 |
install_pkgs "$rootdir$pkgbuild_topdir/PKGS" "$rootdir" "$3" || return 1
|
|
892 |
}
|
|
893 |
|
|
894 |
uninstall_old_cbe () {
|
|
895 |
pkg_info=
|
|
896 |
for pkg in $OLD_PKGS; do
|
|
897 |
pkginfo -R $rootdir -q "$pkg."'*' && pkg_info="$pkg_info
|
|
898 |
`pkginfo -R $rootdir $pkg.'*'`"
|
|
899 |
done
|
|
900 |
if [ ! -z "$pkg_info" ]; then
|
|
901 |
echo "The following packages belong to an obsolete version of the JDS CBE."
|
|
902 |
echo "$pkg_info"
|
|
903 |
echo
|
|
904 |
ask_yes_no "Would you like to uninstall them?" do_uninst yes
|
|
905 |
if [ $do_uninst = yes ]; then
|
|
906 |
log "User chose to uninstall obsolete CBE pkgs"
|
|
907 |
make_admin_file $tempdir/pkgrm.admin.$$ pkgrm
|
|
908 |
pkgrm_failed=no
|
|
909 |
for pkg in $OLD_PKGS; do
|
|
910 |
if pkginfo -R $rootdir -q "$pkg."'*'; then
|
|
911 |
logrun pfexec /usr/sbin/pkgrm -R $rootdir -n -a $tempdir/pkgrm.admin.$$ "$pkg."'*' || \
|
|
912 |
pkgrm_failed=yes
|
|
913 |
fi
|
|
914 |
done
|
|
915 |
rm -f $tempdir/pkgrm.admin.$$
|
|
916 |
if [ $pkgrm_failed = yes ]; then
|
|
917 |
msg "Failed to remove one or more packages"
|
|
918 |
ask_yes_no "Would you like to continue anyway?" do_cont no
|
|
919 |
if [ $do_cont = no ]; then
|
|
920 |
return 1
|
|
921 |
else
|
|
922 |
log "User chose to continue anyway"
|
|
923 |
return 0
|
|
924 |
fi
|
|
925 |
fi
|
|
926 |
fi
|
|
927 |
fi
|
|
928 |
return 0
|
|
929 |
}
|
|
930 |
|
|
931 |
main () {
|
|
932 |
init
|
|
933 |
uninstall_old_cbe || return 1
|
|
934 |
msg "Installing the JDS Common Build Environment (CBE) version $CBE_VERSION"
|
|
935 |
ask_defaults
|
|
936 |
if [ $binary_install = no ]; then
|
|
937 |
install_pkgbuild || return 1
|
|
938 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
939 |
build_pkg $mydir/make.spec "$tardir/$MAKE_TARBALL" CBEmake || return 1
|
|
940 |
build_pkg $mydir/cvs.spec "$tardir/$CVS_TARBALL" CBEcvs || return 1
|
|
941 |
if [ $cbe_opt = yes ]; then
|
|
942 |
build_pkg $mydir/rsync.spec "$tardir/$RSYNC_TARBALL" CBErsync || msg "WARNING: Failed to install rsync. Note: this is an optional CBE component."
|
|
943 |
fi
|
|
944 |
build_pkg $mydir/m4.spec "$tardir/$M4_TARBALL" CBEm4 || return 1
|
|
945 |
build_pkg $mydir/autoconf.spec "$tardir/$AUTOCONF_TARBALL" CBEautoconf || \
|
|
946 |
return 1
|
|
947 |
logrun rm -f "$rootdir$pkgbuild_topdir/SOURCES/$AUTOMAKE_1_9_TARBALL"
|
|
948 |
logrun cp "$tardir/$AUTOMAKE_1_9_TARBALL" $rootdir$pkgbuild_topdir/SOURCES/ || \
|
|
949 |
return 1
|
|
950 |
build_pkg $mydir/automake.spec "$tardir/$AUTOMAKE_1_10_TARBALL" CBEautomake || \
|
|
951 |
return 1
|
|
952 |
logrun cp $mydir/libtool-allextract.diff $rootdir$pkgbuild_topdir/SOURCES/ || \
|
|
953 |
return 1
|
|
954 |
build_pkg $mydir/libtool.spec "$tardir/$LIBTOOL_TARBALL" CBElibtool || \
|
|
955 |
return 1
|
|
956 |
logrun cp $mydir/gettext.diff $rootdir$pkgbuild_topdir/SOURCES/ || \
|
|
957 |
return 1
|
|
958 |
build_pkg $mydir/gettext.spec "$tardir/$GETTEXT_TARBALL" CBEgettext || \
|
|
959 |
return 1
|
|
960 |
build_pkg $mydir/fileutils.spec "$tardir/$FILEUTILS_TARBALL" CBEfileutils||\
|
|
961 |
return 1
|
|
962 |
build_pkg $mydir/flex.spec "$tardir/$FLEX_TARBALL" CBEflex || return 1
|
|
963 |
build_pkg $mydir/bison.spec "$tardir/$BISON_TARBALL" CBEbison || return 1
|
|
964 |
logrun cp $mydir/gendiff $rootdir$pkgbuild_topdir/SOURCES/ || \
|
|
965 |
return 1
|
|
966 |
build_pkg $mydir/diff.spec "$tardir/$DIFF_TARBALL" CBEdiff || return 1
|
|
967 |
build_pkg $mydir/ant.spec "$tardir/$ANT_TARBALL" CBEant || return 1
|
|
968 |
build_pkg $mydir/subversion.spec "$tardir/$SVN_TARBALL" CBEsvn || \
|
|
969 |
return 1
|
|
970 |
else
|
|
971 |
INSTALL_CBE_PKGS=
|
|
972 |
for pkg in $CBE_PKGS; do
|
|
973 |
check_if_installed $pkg || return 1
|
|
974 |
if [ $skip_package = no ]; then
|
|
975 |
INSTALL_CBE_PKGS="$INSTALL_CBE_PKGS $pkg"
|
|
976 |
fi
|
|
977 |
done
|
|
978 |
install_pkgs "$mydir/pkgs" "$rootdir" $INSTALL_CBE_PKGS || return 1
|
|
979 |
if [ $cbe_opt = yes ]; then
|
|
980 |
check_if_installed CBErsync || return 1
|
|
981 |
if [ $skip_package = no ]; then
|
|
982 |
install_pkgs "$mydir/pkgs" "$rootdir" CBErsync || return 1
|
|
983 |
fi
|
|
984 |
fi
|
|
985 |
pkgbuild_topdir=`$cbe_prefix/bin/pkgbuild -bp $cbe_prefix/lib/pkgbuild-$PKGBUILD_VERSION/get_rpm_topdir 2>&1 | grep '^TOPDIR=' | cut -f2- -d=`
|
|
986 |
fi
|
|
987 |
log "Creating env.sh"
|
|
988 |
logrun mkdir -p $rootdir$pkgbuild_topdir/SOURCES || return 1
|
|
989 |
build_info="built on `date +%Y-%m-%d` by ${logname}@`hostname`"
|
|
990 |
logrun bash -c "sed -e \"s%@CBE_PREFIX@%$cbe_prefix%\" \
|
|
991 |
-e \"s%@JDS_PREFIX@%$JDS_PREFIX%\" \
|
|
992 |
-e \"s%@CC32@%$cc32dir/$cc_name%\" \
|
|
993 |
-e \"s%@CXX32@%$cc32dir/$cxx_name%\" \
|
|
994 |
-e \"s%@CC64@%$cc64dir/$cc_name%\" \
|
|
995 |
-e \"s%@CXX64@%$cc64dir/$cxx_name%\" \
|
|
996 |
-e \"s%@CBE_VERSION@%$CBE_VERSION%\" \
|
|
997 |
-e \"s%@BUILD_INFO@%$build_info%\" \
|
|
998 |
$mydir/env.sh > $rootdir$pkgbuild_topdir/SOURCES/env.sh" || \
|
|
999 |
return 1
|
|
1000 |
log "Creating env.csh"
|
|
1001 |
logrun bash -c "sed -e \"s%@CBE_PREFIX@%$cbe_prefix%\" \
|
|
1002 |
-e \"s%@JDS_PREFIX@%$JDS_PREFIX%\" \
|
|
1003 |
-e \"s%@CC32@%$cc32dir/$cc_name%\" \
|
|
1004 |
-e \"s%@CXX32@%$cc32dir/$cxx_name%\" \
|
|
1005 |
-e \"s%@CC64@%$cc64dir/$cc_name%\" \
|
|
1006 |
-e \"s%@CXX64@%$cc64dir/$cxx_name%\" \
|
|
1007 |
-e \"s%@CBE_VERSION@%$CBE_VERSION%\" \
|
|
1008 |
-e \"s%@BUILD_INFO@%$build_info%\" \
|
|
1009 |
$mydir/env.csh > $rootdir$pkgbuild_topdir/SOURCES/env.csh" || \
|
|
1010 |
return 1
|
|
1011 |
log "Copying ld-wrapper"
|
|
1012 |
logrun bash -c "cp $mydir/ld-wrapper $rootdir$pkgbuild_topdir/SOURCES" || \
|
|
1013 |
return 1
|
|
1014 |
build_pkg $mydir/CBEenv.spec "" CBEenv || return 1
|
|
1015 |
msg "CBE setup complete"
|
|
1016 |
echo "Run"
|
|
1017 |
echo " . $cbe_prefix/bin/env.sh"
|
|
1018 |
echo "or"
|
|
1019 |
echo " source $cbe_prefix/bin/env.csh"
|
|
1020 |
echo "depending on your shell, to use this build environment."
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
process_cl "${@}"
|
|
1024 |
main || msg "CBE setup FAILED"
|
|
1025 |
echo "Installation log saved in $LOGFILE"
|