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