3160
|
1 #!/bin/sh |
|
2 # |
|
3 # install-octave -- install script for binary distributions. |
|
4 # |
|
5 # John W. Eaton |
|
6 # jwe@bevo.che.wisc.edu |
|
7 # University of Wisconsin-Madison |
|
8 # Department of Chemical Engineering |
|
9 |
3474
|
10 # Exit on any error. |
|
11 |
|
12 set -e |
|
13 |
4084
|
14 SED=@SED@ |
|
15 |
3160
|
16 # get version |
|
17 version=`cat VERSION 2> /dev/null` |
|
18 |
|
19 if test -z "$version" |
|
20 then |
3164
|
21 cat <<EOF |
|
22 install-octave: no version number! |
|
23 |
|
24 Are you sure you have a binary distribution of Octave? If you are |
|
25 trying to install Octave from its sources, please read and follow |
|
26 the directions given in the file INSTALL.OCTAVE. |
|
27 EOF |
3160
|
28 exit 1 |
|
29 fi |
|
30 |
|
31 # get host type |
|
32 canonical_host_type=`cat ARCH 2> /dev/null` |
|
33 |
|
34 if test -z "$canonical_host_type" |
|
35 then |
3164
|
36 cat <<EOF |
|
37 install-octave: host archetecture not found! |
|
38 |
|
39 Are you sure you have a binary distribution of Octave? If you are |
|
40 trying to install Octave from its sources, please read and follow |
|
41 the directions given in the file INSTALL.OCTAVE. |
|
42 EOF |
3160
|
43 exit 1 |
|
44 fi |
|
45 |
|
46 # Check whether to use -n or \c to keep echo from printing a newline |
|
47 # character. Stolen from autoconf, which borrowed the idea from dist 3.0. |
|
48 |
|
49 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then |
|
50 # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. |
4084
|
51 if (echo -n testing; echo 1,2,3) | $SED s/-n/xn/ | grep xn >/dev/null; then |
3160
|
52 echo_n= |
|
53 echo_c=' |
|
54 ' |
|
55 else |
|
56 echo_n=-n |
|
57 echo_c= |
|
58 fi |
|
59 else |
|
60 echo_n= |
|
61 echo_c='\c' |
|
62 fi |
|
63 |
3892
|
64 EXEEXT=@EXEEXT@ |
3206
|
65 SHLEXT=@SHLEXT@ |
|
66 SHLEXT_VER=$SHLEXT.$version |
3160
|
67 |
|
68 # ==================== Where To Install Things ==================== |
|
69 |
|
70 # The default location for installation. Everything is placed in |
|
71 # subdirectories of this directory. The default values for many of |
|
72 # the variables below are expressed in terms of this one, so you may |
|
73 # not need to change them. This defaults to /usr/local. |
|
74 prefix=@prefix@ |
|
75 |
|
76 alt_dir=false |
|
77 if test $# -eq 1 |
|
78 then |
|
79 alt_dir=true |
|
80 prefix=$1 |
|
81 else |
|
82 if test $# -gt 1 |
|
83 then |
|
84 echo "usage: install-octave [prefix-directory]" |
|
85 exit 1 |
|
86 fi |
|
87 fi |
|
88 |
|
89 # Like `prefix', but used for architecture-specific files. |
|
90 exec_prefix="$prefix" |
|
91 |
|
92 # Where to install Octave and other binaries that people will want to |
|
93 # run directly. |
|
94 bindir="$exec_prefix/bin" |
|
95 |
|
96 # Where to install architecture-independent data files. ${fcnfiledir} |
|
97 # and ${localfcnfiledir} are subdirectories of this. |
|
98 datadir="$prefix/share" |
|
99 |
|
100 libdir="$exec_prefix/lib" |
|
101 |
|
102 # Where to install and expect libraries like libcruft.a and liboctave.a. |
|
103 octlibdir="$libdir/octave-$version" |
|
104 |
|
105 # Where to install and expect executable programs to be run by Octave |
|
106 # rather than directly by users. |
|
107 libexecdir="$exec_prefix/libexec" |
|
108 |
|
109 includedir="$prefix/include" |
|
110 |
|
111 # Where to install Octave's include files. The default is |
|
112 # ${prefix}/include/octave-$version |
|
113 octincludedir=$includedir/octave-$version |
|
114 |
|
115 # Where to install Octave's man pages, and what extension they should |
|
116 # have. The default is ${prefix}/man/man1 |
|
117 mandir="$prefix/man/man1" |
|
118 manext="1" |
|
119 |
|
120 # Where to install and expect the info files describing Octave.. |
|
121 infodir="$prefix/info" |
|
122 |
|
123 # The fill path to the default info file. |
|
124 infofile="$infodir/octave.info" |
|
125 |
|
126 # ==================== Octave-specific directories ==================== |
|
127 |
|
128 # These variables hold the values Octave will actually use. They are |
|
129 # based on the values of the standard Make variables above. |
|
130 |
|
131 # Where to install the function file distributed with |
|
132 # Octave. This includes the Octave version, so that the |
|
133 # function files for different versions of Octave will install |
|
134 # themselves in separate directories. |
|
135 fcnfiledir="$datadir/octave/$version/m" |
|
136 |
|
137 # Directories Octave should search for function files specific |
|
138 # to this site (i.e. customizations), before consulting |
|
139 # ${fcnfiledir}. This should be a colon-separated list of |
|
140 # directories. |
|
141 localfcnfiledir="$datadir/octave/site/m" |
|
142 localfcnfilepath="$localfcnfiledir//" |
|
143 |
|
144 # Where to put executables to be run by Octave rather than |
|
145 # the user. This path usually includes the Octave version |
|
146 # and configuration name, so that multiple configurations |
|
147 # for multiple versions of Octave may be installed at once. |
|
148 archlibdir="$libexecdir/octave/$version/exec/$canonical_host_type" |
|
149 |
|
150 # Where to put executables to be run by Octave rather than by the |
|
151 # user that are specific to this site. |
|
152 localarchlibdir="$libexecdir/octave/site/exec/$canonical_host_type" |
|
153 |
|
154 # Where to put object files that will by dynamically loaded. |
|
155 # This path usually includes the Octave version and configuration |
|
156 # name, so that multiple configurations for multiple versions of |
|
157 # Octave may be installed at once. |
|
158 octfiledir="$libexecdir/octave/$version/oct/$canonical_host_type" |
|
159 |
|
160 # Directories Octave should search for object files that will be |
|
161 # dynamically loaded and that are specific to this site |
|
162 # (i.e. customizations), before consulting ${octfiledir}. This should |
|
163 # be a colon-separated list of directories. |
|
164 localoctfiledir="$libexecdir/octave/site/oct/$canonical_host_type" |
|
165 localoctfilepath="$localoctfiledir//" |
|
166 |
|
167 # Where Octave will search to find its function files. Before |
|
168 # changing this, check to see if your purpose wouldn't |
|
169 # better be served by changing localfcnfilepath. This |
|
170 # should be a colon-separated list of directories. |
|
171 fcnfilepath=".:$localoctfilepath:$localfcnfilepath:$octfiledir//:$fcnfiledir//" |
|
172 |
|
173 # Where Octave will search to find image files.es. |
|
174 imagedir="$datadir/octave/$version/imagelib" |
|
175 imagepath=".:$imagedir//" |
|
176 |
|
177 cat << EOF |
|
178 Installing octave in the following subdirectories of |
|
179 $prefix: |
|
180 |
4084
|
181 bindir: `echo $bindir | $SED "s,^$prefix/,,"` |
|
182 datadir: `echo $datadir | $SED "s,^$prefix/,,"` |
|
183 libdir: `echo $libdir | $SED "s,^$prefix/,,"` |
|
184 octlibdir: `echo $octlibdir | $SED "s,^$prefix/,,"` |
|
185 includedir: `echo $includedir | $SED "s,^$prefix/,,"` |
|
186 octincludedir: `echo $octincludedir | $SED "s,^$prefix/,,"` |
|
187 mandir: `echo $mandir | $SED "s,^$prefix/,,"` |
|
188 infodir: `echo $infodir | $SED "s,^$prefix/,,"` |
|
189 fcnfiledir: `echo $fcnfiledir | $SED "s,^$prefix/,,"` |
|
190 localfcnfiledir: `echo $localfcnfiledir | $SED "s,^$prefix/,,"` |
|
191 archlibdir: `echo $archlibdir | $SED "s,^$prefix/,,"` |
|
192 localarchlibdir: `echo $localarchlibdir | $SED "s,^$prefix/,,"` |
|
193 octfiledir: `echo $octfiledir | $SED "s,^$prefix/,,"` |
|
194 localoctfiledir: `echo $localoctfiledir | $SED "s,^$prefix/,,"` |
|
195 imagedir: `echo $imagedir | $SED "s,^$prefix/,,"` |
3160
|
196 |
|
197 EOF |
|
198 |
|
199 echo $echo_n "Is this correct [y/N]? " $echo_c |
|
200 |
|
201 read ans |
|
202 |
|
203 case "$ans" in |
|
204 y | Y | yes | YES) |
|
205 ;; |
|
206 *) |
|
207 exit 1 |
|
208 ;; |
|
209 esac |
|
210 |
|
211 DIRS_TO_MAKE="$bindir $datadir $libdir $octlibdir $libexecdir \ |
|
212 $includedir $octincludedir $mandir $infodir $fcnfiledir \ |
|
213 $localfcnfiledir $archlibdir $localarchlibdir \ |
|
214 $octfiledir $localoctfiledir $imagedir" |
|
215 |
|
216 ./mkinstalldirs $DIRS_TO_MAKE |
|
217 |
|
218 echo "installing octave-bug as $bindir/octave-bug" |
|
219 cp octave-bug $bindir/octave-bug |
|
220 chmod 755 $bindir/octave-bug |
|
221 |
3845
|
222 echo "installing octave-config as $bindir/octave-config" |
|
223 cp octave-config $bindir/octave-config |
|
224 chmod 755 $bindir/octave-config |
|
225 |
3160
|
226 if test -f LIBRARIES; then |
|
227 echo "installing shared libraries in $octlibdir" |
|
228 for f in `cat LIBRARIES` |
|
229 do |
|
230 file=`basename $f` |
3209
|
231 cp $f.$SHLEXT_VER $octlibdir/$file.$SHLEXT_VER |
3206
|
232 chmod 644 $octlibdir/$file.$SHLEXT_VER |
|
233 ( cd $octlibdir |
|
234 ln -s $file.$SHLEXT_VER $file.$SHLEXT ) |
3160
|
235 done |
|
236 fi |
|
237 |
3176
|
238 oct_files=`find . -name '*.oct' -print` |
|
239 if test -n "$oct_files"; then |
|
240 echo "installing .oct files in $octfiledir" |
|
241 for f in $oct_files |
|
242 do |
|
243 file=`basename $f` |
|
244 cp $f $octfiledir/$file |
|
245 chmod 755 $octfiledir/$file |
|
246 done |
3177
|
247 if test -f src/links-to-make; then |
|
248 cat src/links-to-make | while read src dest |
3160
|
249 do |
3176
|
250 if test -n "$src" && test -n "$dest"; then |
3206
|
251 ( cd $octfiledir |
|
252 ln $src $dest ) |
3176
|
253 fi |
3160
|
254 done |
|
255 fi |
|
256 fi |
|
257 |
|
258 echo "installing .m files in $fcnfiledir" |
3206
|
259 ( cd scripts |
|
260 tar cf - . | ( cd $fcnfiledir ; tar xf - ) |
|
261 find $fcnfiledir -type f -print | xargs chmod 0644 |
|
262 find $fcnfiledir -name '*.img' -print | xargs rm -f ) |
3160
|
263 |
|
264 echo "installing image files in $imagedir" |
3206
|
265 ( cd scripts/image |
|
266 cp *.img $imagedir |
|
267 chmod 644 $imagedir/*.img ) |
3160
|
268 |
|
269 echo "creating ls-R file in $datadir/octave" |
|
270 ls -LR $datadir/octave > $datadir/octave/ls-R |
3162
|
271 chmod 644 $datadir/octave/ls-R |
3160
|
272 |
|
273 echo "creating ls-R file in $libexecdir/octave" |
|
274 ls -LR $libexecdir/octave > $libexecdir/octave/ls-R |
3162
|
275 chmod 644 $libexecdir/octave/ls-R |
3160
|
276 |
|
277 echo "installing info files in $infodir" |
|
278 for f in doc/interpreter/octave.info* |
|
279 do |
|
280 file=`basename $f` |
|
281 cp $f $infodir/$file |
|
282 chmod 644 $infodir/$file |
|
283 done |
|
284 |
|
285 echo "installing man page in $mandir" |
|
286 cp doc/interpreter/octave.1 $mandir/octave.$manext |
|
287 chmod 644 $mandir/octave.$manext |
|
288 |
3474
|
289 # Do this last, so that it won't be available if some other error |
|
290 # happens earlier. Otherwise, people might try to run Octave with |
|
291 # an incomplete installation. |
|
292 |
|
293 if test "$prefix" = /usr/local |
|
294 then |
|
295 echo "installing src/octave as $bindir/octave" |
|
296 cp src/octave $bindir/octave |
|
297 chmod 755 $bindir/octave |
|
298 else |
|
299 echo "installing octave-sh as $bindir/octave" |
4084
|
300 $SED "s|@OCTAVE_HOME@|$prefix|; s|@LD_LIBRARY_PATH@|$octlibdir|" octave-sh \ |
3474
|
301 > $bindir/octave |
|
302 chmod 755 $bindir/octave |
|
303 |
|
304 echo "installing src/octave as $bindir/octave.bin" |
|
305 cp src/octave $bindir/octave.bin |
|
306 chmod 755 $bindir/octave.bin |
|
307 fi |
|
308 |
3160
|
309 case "$canonical_host_type" in |
3971
|
310 *-*-cygwin*) |
3160
|
311 if $alt_dir; then |
|
312 echo "*** You have specified an installation directory different" |
|
313 echo "*** from the default. For Octave to run properly, you must" |
|
314 echo "*** set the environment variable OCTAVE_HOME to" |
|
315 echo "***" |
|
316 echo "*** $prefix" |
|
317 echo "***" |
|
318 echo "*** before starting Octave." |
|
319 fi |
|
320 ;; |
|
321 esac |
|
322 |
|
323 exit 0 |