5
|
1 #!/bin/sh |
|
2 # |
|
3 # doinstall.sh -- install script for binary distributions. |
|
4 # |
|
5 # John W. Eaton |
|
6 # jwe@che.utexas.edu |
|
7 # Department of Chemical Engineering |
|
8 # The University of Texas at Austin |
|
9 |
811
|
10 # ask octave to tell us the version number |
813
|
11 version=`./octave -v 2>/dev/null | awk '/version/ { print $NF }'` |
811
|
12 |
817
|
13 if test -z "$version" |
|
14 then |
|
15 echo "doinstall.sh: unable to extract version number from Octave!" |
|
16 exit 1 |
|
17 fi |
|
18 |
815
|
19 # ask octave to tell us the target host type |
|
20 target_host_type=`echo computer | ./octave -q` |
|
21 |
817
|
22 if test -z "$target_host_type" |
811
|
23 then |
817
|
24 echo "doinstall.sh: unable to extract host type from Octave!" |
811
|
25 exit 1 |
|
26 fi |
|
27 |
|
28 # ==================== Where To Install Things ==================== |
|
29 |
|
30 # The default location for installation. Everything is placed in |
|
31 # subdirectories of this directory. The default values for many of |
|
32 # the variables below are expressed in terms of this one, so you may |
|
33 # not need to change them. This defaults to /usr/local. |
5
|
34 prefix=/usr/local |
811
|
35 |
|
36 prefix="/usr/local" |
|
37 if test $# -eq 1 |
|
38 then |
5
|
39 prefix=$1 |
|
40 else |
811
|
41 if test $# -gt 1 |
|
42 then |
5
|
43 echo "usage: doinstall.sh [prefix-directory]" |
|
44 exit 1 |
|
45 fi |
|
46 fi |
|
47 |
811
|
48 # Like `prefix', but used for architecture-specific files. |
|
49 exec_prefix="$prefix" |
|
50 |
|
51 # Where to install Octave and other binaries that people will want to |
|
52 # run directly. |
|
53 bindir="$exec_prefix/bin" |
|
54 |
|
55 # Where to install architecture-independent data files. ${fcnfiledir} |
|
56 # and ${localfcnfiledir} are subdirectories of this. |
|
57 datadir="$prefix/lib" |
|
58 |
|
59 # Where to install and expect libraries like libcruft.a, liboctave.a, |
|
60 # and libreadline.a, executable files to be run by Octave rather than |
|
61 # directly by users, and other architecture-dependent data. |
|
62 # ${archlibdir} is a subdirectory of this. |
|
63 libdir="$exec_prefix/lib" |
5
|
64 |
811
|
65 # Where to install Octave's include files. The default is |
|
66 # ${prefix}/include/octave |
|
67 includedir="$prefix/include/octave" |
|
68 |
|
69 # Where to install Octave's man pages, and what extension they should |
|
70 # have. The default is ${prefix}/man/man1 |
|
71 mandir="$prefix/man/man1" |
|
72 manext="1" |
|
73 |
|
74 # Where to install and expect the info files describing Octave.. |
|
75 infodir="$prefix/info" |
|
76 |
|
77 # ==================== Octave-specific directories ==================== |
|
78 |
|
79 # These variables hold the values Octave will actually use. They are |
|
80 # based on the values of the standard Make variables above. |
5
|
81 |
811
|
82 # Where to install the function file distributed with |
|
83 # Octave. This includes the Octave version, so that the |
|
84 # function files for different versions of Octave will install |
|
85 # themselves in separate directories. |
|
86 fcnfiledir="$datadir/octave/$version/m" |
|
87 |
|
88 # Directories Octave should search for function files specific |
|
89 # to this site (i.e. customizations), before consulting |
|
90 # ${fcnfiledir}. This should be a colon-separated list of |
|
91 # directories. |
815
|
92 localfcnfiledir="$datadir/octave/site/m" |
|
93 localfcnfilepath="$localfcnfiledir//" |
811
|
94 |
|
95 # Where to put executables to be run by Octave rather than |
|
96 # the user. This path usually includes the Octave version |
|
97 # and configuration name, so that multiple configurations |
|
98 # for multiple versions of Octave may be installed at once. |
|
99 archlibdir="$libdir/octave/$version/exec/$target_host_type" |
5
|
100 |
811
|
101 # Where to put object files that will by dynamically loaded. |
|
102 # This path usually includes the Octave version and configuration |
|
103 # name, so that multiple configurations for multiple versions of |
|
104 # Octave may be installed at once. |
|
105 octfiledir="$libdir/octave/$version/oct/$target_host_type" |
5
|
106 |
811
|
107 # Directories Octave should search for object files that will be |
|
108 # dynamically loaded and that are specific to this site |
|
109 # (i.e. customizations), before consulting ${octfiledir}. This should |
|
110 # be a colon-separated list of directories. |
815
|
111 localoctfiledir="$datadir/octave/site/oct/$target_host_type" |
|
112 localoctfilepath="$localoctfiledir//" |
811
|
113 |
|
114 # Where Octave will search to find its function files. Before |
|
115 # changing this, check to see if your purpose wouldn't |
|
116 # better be served by changing localfcnfilepath. This |
|
117 # should be a colon-separated list of directories. |
|
118 fcnfilepath=".:$localoctfilepath:$localfcnfilepath:$octfiledir//:$fcnfiledir//" |
|
119 |
|
120 # Where Octave will search to find image files. |
818
|
121 imagedir="$datadir/octave/$version/imagelib" |
811
|
122 imagepath=".:$imagedir//" |
5
|
123 |
|
124 cat << EOF |
811
|
125 Installing octave in subdirectories of $prefix. |
5
|
126 |
811
|
127 Binaries: $bindir |
|
128 Function files: $fcnfiledir |
813
|
129 Demo images: $imagedir |
811
|
130 Info files: $infodir |
|
131 Man page: $mandir |
5
|
132 |
|
133 EOF |
|
134 |
811
|
135 DIRS_TO_MAKE="$bindir $datadir $libdir $includedir $mandir $infodir \ |
815
|
136 $fcnfiledir $archlibdir $octfiledir $imagedir \ |
|
137 $localfcnfiledir $localoctfiledir" |
5
|
138 |
811
|
139 ./mkinstalldirs $DIRS_TO_MAKE |
|
140 chmod 755 $DIRS_TO_MAKE |
|
141 |
|
142 if test "$prefix" = /usr/local |
|
143 then |
5
|
144 echo "installing ./octave as $bindir/octave" |
816
|
145 cp octave $bindir/octave |
5
|
146 chmod 755 $bindir/octave |
|
147 else |
|
148 echo "installing octave.sh as $bindir/octave" |
|
149 sed "s|@OCTAVE_HOME@|$prefix|" octave.sh > octave.tmp |
|
150 cp octave.tmp $bindir/octave |
|
151 chmod 755 $bindir/octave |
|
152 |
|
153 echo "installing ./octave as $bindir/octave.bin" |
816
|
154 cp octave $bindir/octave.bin |
5
|
155 chmod 755 $bindir/octave.bin |
|
156 fi |
|
157 |
819
|
158 echo "installing octtopnm as $archlibdir/octtopnm" |
|
159 cp octtopnm $archlibdir/octtopnm |
|
160 chmod 755 $archlibdir/octtopnm |
|
161 |
816
|
162 echo "installing octave-bug as $bindir/octave-bug" |
|
163 cp octave-bug $bindir/octave-bug |
|
164 chmod 755 $bindir/octave-bug |
|
165 |
811
|
166 echo "installing function files in $fcnfiledir" |
|
167 ( cd scripts |
1092
|
168 ../mkinstalldirs `find . -type d -print | sed -e 's,^\./,,' -e "s,^,$fcnfiledir/,"` |
|
169 for f in `find . \( -name '*.m' -o -name octaverc \) -print` |
811
|
170 do |
|
171 cp $f $fcnfiledir/$f |
|
172 chmod 644 $fcnfiledir/$f |
|
173 done ) |
5
|
174 |
813
|
175 echo "installing image files in $imagedir" |
|
176 ( cd scripts |
1092
|
177 for f in `find . -name '*.img' -print` |
813
|
178 do |
818
|
179 file=`basename $f` |
|
180 cp $f $imagedir/$file |
|
181 chmod 644 $imagedir/$file |
813
|
182 done ) |
|
183 |
1154
|
184 echo "creating ls-R file in $datadir/octave" |
|
185 ls -R $datadir/octave > $datadir/octave/ls-R |
|
186 |
5
|
187 echo "installing info files in $infodir" |
811
|
188 for f in doc/octave.info* |
|
189 do |
5
|
190 file=`basename $f` |
|
191 cp $f $infodir/$file |
|
192 chmod 644 $infodir/$file |
|
193 done |
|
194 |
811
|
195 echo "installing man page in $mandir" |
|
196 cp doc/octave.1 $mandir/octave.$manext |
|
197 chmod 644 $mandir/octave.$manext |
|
198 |
5
|
199 exit 0 |