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