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