/
install-starlab
executable file
·199 lines (144 loc) · 5.64 KB
/
install-starlab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
#!/bin/csh -f
# Starlab installation script. Specify a non-default installation
# directory as the first command-line argument. Other arguments go
# directly to the configure script.
#
# The extra layers are necessary to ensure that the correct autotools
# are always available when needed.
# We will by default install with the current directory as STARLAB_PATH.
# If STARLAB_PATH is set on entry and is not PWD, warn the user and
# redefine STARLAB_PATH to PWD for installation purposes.
if ($?STARLAB_PATH == 0) then
echo Setting STARLAB_PATH = $PWD
setenv STARLAB_PATH $PWD
else if ("x$STARLAB_PATH" != "x$PWD") then
echo Warning: STARLAB_PATH on entry \($STARLAB_PATH\) is not PWD
echo Resetting STARLAB_PATH to $PWD
setenv STARLAB_PATH $PWD
else
echo Using environment STARLAB_PATH = $STARLAB_PATH
endif
# Note that we do *not* update the search path if STARLAB_PATH is changed.
set install_dir = $STARLAB_PATH/usr # this is now the configure default
if ($#argv > 0) set install_dir = $1
# Don't allow (accidental?) installation in ., PWD, or STARLAB_PATH.
# Attach /usr to install_dir in all those cases. Use readlink to
# expand all paths before comparing.
(chdir sbin; make -s readlink) >& /dev/null
set install_dir = `sbin/readlink -f $install_dir`
set dot = `sbin/readlink -f .`
set slp = `sbin/readlink -f $STARLAB_PATH`
set cur = `sbin/readlink -f $PWD`
if ("x$install_dir" == "x$dot" \
|| "x$install_dir" == "x$slp" \
|| "x$install_dir" == "x$cur") then
echo "Don't allow installation in $install_dir; appending /usr"
set install_dir = "$install_dir/usr"
endif
echo install_dir \ = $install_dir
set log = install.log
echo Writing detailed output to $log
# Install autotools (place in install_dir):
echo Installing local versions of autotools in install_dir
echo Installing local versions of autotools in install_dir >&! $log
(chdir src/packages; ./install-autotools $install_dir) >>& $log
# Make sure that install_dir precedes system directories in search path
set path = ($install_dir/bin $path)
rehash
# First time through we need to do autoreconf Also should do it if
# configure is older than autoconf -- delete configure in this case.
if (-e configure) then
set tmp = `find . -name configure.ac -cnewer configure`
if ($#tmp > 0) then
rm configure
echo Deleted configure because it is older than configure.ac
echo Deleted configure because it is older than configure.ac >>& $log
endif
endif
if (! -e configure) then
echo Running autoreconf to build configure
echo Running autoreconf to build configure >>& $log
autoreconf -i -f >>& $log
endif
set OK = 0
if (-e configure) then
# Work around temporary Qt glitch. Should no longer be necessary,
# as configure checks for this and takes appropriate action...
set Qt = ""
set qt = `sbin/qt_major_version`
if (x$qt == "x" || $qt < 3) then
set Qt = "--without-qt"
unsetenv QTDIR # just in case...
endif
# Perform the usual configuration process:
echo Running configure \(`date`\)
echo ./configure $Qt --prefix=$install_dir $argv[2*]
echo >>& $log
echo Running configure \(`date`\) >>& $log
echo ./configure $Qt --prefix=$install_dir >>& $log
./configure $Qt --prefix=$install_dir $argv[2*] >>& $log
if ($status != 0) then
echo Configure error...
exit
endif
# Build the package.
echo Running make \(`date`\; this may take a while...\)
echo >>& $log
echo Running make \(`date`\) >>& $log
make >>& $log
echo Running make install \(`date`\)
echo >>& $log
echo Running make install \(`date`\) >>& $log
make install >>& $log
# Then test whatever...
rehash
echo Looking for kira
set which_kira = (`which kira | grep -v 'Command not found.'`)
if ($#which_kira > 0) then
echo -n kira': '; kira --help |& grep created
# Really want to find kira in $install_dir/bin. Make sure
# we didn't just find an older version, and explicitly say
# so if we have.
if (! -x $install_dir/bin/kira) then
Found old kira, but no new version.
else
set OK = 1
endif
else
echo Couldn\'t find kira...
endif
# Note that testsuite uses STARLAB_PATH and the current search path,
# so it should find the correct kira and test in the proper place.
echo Running Testsuite \(`date`\; this may take a few minutes\)
echo >>& $log
echo Running Testsuite \(`date`\) >>& $log
./sbin/testsuite >>& $log
set n1 = `grep ^Working $log | grep OK | wc -l`
set n2 = `grep ^Working $log | grep Problems | wc -l`
echo Found $n1 OK and $n2 Problems.
echo Number of executables found: `ls $install_dir/bin | wc -l`
# Deuglify the log file (install.log --> install.log.2)
./sbin/beautify-install $OK $log
endif
# Congratulate the user and explain some details.
if (X$OK == "X1") then
cat <<EOF
Congratulations, you have successfully installed Starlab!
To use the Starlab tools, make sure that the directory
$install_dir/bin
is in your search path and *precedes* any system files.
If you prefer, source the script
$STARLAB_PATH/starlab_start.csh
(or its .sh equivalent) to set up the environment and your
search path automatically.
For programmers, the Starlab header files are installed in
$install_dir/include/starlab
and the libraries are in
$install_dir/lib/starlab
Developers should find that any changes made to the automake
"Makefile.am" files will cause the relevant Makefiles to be
automagically regenerated.
Enjoy!
The Starlab Team
EOF
endif