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