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