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