File: install-octave.in

package info (click to toggle)
octave 2.0.16-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 26,276 kB
  • ctags: 16,450
  • sloc: cpp: 67,548; fortran: 41,514; ansic: 26,682; sh: 7,361; makefile: 4,077; lex: 2,008; yacc: 1,849; lisp: 1,702; perl: 1,676; exp: 123
file content (310 lines) | stat: -rw-r--r-- 9,078 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
#!/bin/sh
#
# install-octave -- install script for binary distributions.
#
# John W. Eaton
# jwe@bevo.che.wisc.edu
# University of Wisconsin-Madison
# Department of Chemical Engineering

# get version
version=`cat VERSION 2> /dev/null`

if test -z "$version"
then
  cat <<EOF 
install-octave: no version number!

Are you sure you have a binary distribution of Octave?  If you are
trying to install Octave from its sources, please read and follow
the directions given in the file INSTALL.OCTAVE.
EOF
  exit 1
fi

# get host type
canonical_host_type=`cat ARCH 2> /dev/null`

if test -z "$canonical_host_type"
then
  cat <<EOF 
install-octave: host archetecture not found!

Are you sure you have a binary distribution of Octave?  If you are
trying to install Octave from its sources, please read and follow
the directions given in the file INSTALL.OCTAVE.
EOF
  exit 1
fi

distdir=`pwd`

# Check whether to use -n or \c to keep echo from printing a newline
# character.  Stolen from autoconf, which borrowed the idea from dist 3.0.

if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
    echo_n=
    echo_c='
'
  else
    echo_n=-n
    echo_c=
  fi
else
  echo_n=
  echo_c='\c'
fi

EXE=@EXE@

# ==================== Where To Install Things ====================

# The default location for installation.  Everything is placed in
# subdirectories of this directory.  The default values for many of
# the variables below are expressed in terms of this one, so you may
# not need to change them.  This defaults to /usr/local.
prefix=@prefix@

alt_dir=false
if test $# -eq 1
then
  alt_dir=true
  prefix=$1
else
  if test $# -gt 1
  then
    echo "usage: install-octave [prefix-directory]"
    exit 1
  fi
fi

# Like `prefix', but used for architecture-specific files.
exec_prefix="$prefix"

# Where to install Octave and other binaries that people will want to
# run directly.
bindir="$exec_prefix/bin"

# Where to install architecture-independent data files.  ${fcnfiledir}
# and ${localfcnfiledir} are subdirectories of this.
datadir="$prefix/share"

libdir="$exec_prefix/lib"

# Where to install and expect libraries like libcruft.a and liboctave.a.
octlibdir="$libdir/octave-$version"

# Where to install and expect executable programs to be run by Octave
# rather than directly by users.
libexecdir="$exec_prefix/libexec"

includedir="$prefix/include"

# Where to install Octave's include files.  The default is
# ${prefix}/include/octave-$version
octincludedir=$includedir/octave-$version

# Where to install Octave's man pages, and what extension they should
# have.  The default is ${prefix}/man/man1
mandir="$prefix/man/man1"
manext="1"

# Where to install and expect the info files describing Octave..
infodir="$prefix/info"

# The fill path to the default info file.
infofile="$infodir/octave.info"

# ==================== Octave-specific directories ====================

# These variables hold the values Octave will actually use.  They are
# based on the values of the standard Make variables above.

# Where to install the function file distributed with
# Octave.  This includes the Octave version, so that the
# function files for different versions of Octave will install
# themselves in separate directories.
fcnfiledir="$datadir/octave/$version/m"

# Directories Octave should search for function files specific
# to this site (i.e. customizations), before consulting
# ${fcnfiledir}.  This should be a colon-separated list of
# directories.
localfcnfiledir="$datadir/octave/site/m"
localfcnfilepath="$localfcnfiledir//"

# Where to put executables to be run by Octave rather than
# the user.  This path usually includes the Octave version
# and configuration name, so that multiple configurations
# for multiple versions of Octave may be installed at once.
archlibdir="$libexecdir/octave/$version/exec/$canonical_host_type"

# Where to put executables to be run by Octave rather than by the
# user that are specific to this site.
localarchlibdir="$libexecdir/octave/site/exec/$canonical_host_type"

# Where to put object files that will by dynamically loaded.
# This path usually includes the Octave version and configuration
# name, so that multiple configurations for multiple versions of
# Octave may be installed at once. 
octfiledir="$libexecdir/octave/$version/oct/$canonical_host_type"

# Directories Octave should search for object files that will be
# dynamically loaded and that are specific to this site
# (i.e. customizations), before consulting ${octfiledir}.  This should
# be a colon-separated list of directories.
localoctfiledir="$libexecdir/octave/site/oct/$canonical_host_type"
localoctfilepath="$localoctfiledir//"

# Where Octave will search to find its function files.  Before
# changing this, check to see if your purpose wouldn't
# better be served by changing localfcnfilepath.  This
# should be a colon-separated list of directories.
fcnfilepath=".:$localoctfilepath:$localfcnfilepath:$octfiledir//:$fcnfiledir//"

# Where Octave will search to find image files.es.
imagedir="$datadir/octave/$version/imagelib"
imagepath=".:$imagedir//"

cat << EOF
Installing octave in the following subdirectories of
$prefix:

            bindir: `echo $bindir | sed "s,^$prefix/,,"`
           datadir: `echo $datadir | sed "s,^$prefix/,,"`
            libdir: `echo $libdir | sed "s,^$prefix/,,"`
         octlibdir: `echo $octlibdir | sed "s,^$prefix/,,"`
        includedir: `echo $includedir | sed "s,^$prefix/,,"`
     octincludedir: `echo $octincludedir | sed "s,^$prefix/,,"`
            mandir: `echo $mandir | sed "s,^$prefix/,,"`
           infodir: `echo $infodir | sed "s,^$prefix/,,"`
        fcnfiledir: `echo $fcnfiledir | sed "s,^$prefix/,,"`
   localfcnfiledir: `echo $localfcnfiledir | sed "s,^$prefix/,,"`
        archlibdir: `echo $archlibdir | sed "s,^$prefix/,,"`
   localarchlibdir: `echo $localarchlibdir | sed "s,^$prefix/,,"`
        octfiledir: `echo $octfiledir | sed "s,^$prefix/,,"`
   localoctfiledir: `echo $localoctfiledir | sed "s,^$prefix/,,"`
          imagedir: `echo $imagedir | sed "s,^$prefix/,,"`

EOF

echo $echo_n "Is this correct [y/N]? " $echo_c

read ans

case "$ans" in
  y | Y | yes | YES)
  ;;
  *)
    exit 1
  ;;
esac

DIRS_TO_MAKE="$bindir $datadir $libdir $octlibdir $libexecdir \
  $includedir $octincludedir $mandir $infodir $fcnfiledir \
  $localfcnfiledir $archlibdir $localarchlibdir \
  $octfiledir $localoctfiledir $imagedir"

./mkinstalldirs $DIRS_TO_MAKE

if test "$prefix" = /usr/local
then
  echo "installing src/octave as $bindir/octave"
  cp src/octave $bindir/octave
  chmod 755 $bindir/octave
else
  echo "installing octave-sh as $bindir/octave"
  sed "s|@OCTAVE_HOME@|$prefix|; s|@LD_LIBRARY_PATH@|$octlibdir|" octave-sh \
    > $bindir/octave
  chmod 755 $bindir/octave

  echo "installing src/octave as $bindir/octave.bin"
  cp src/octave $bindir/octave.bin
  chmod 755 $bindir/octave.bin
fi

echo "installing octave-bug as $bindir/octave-bug"
cp octave-bug $bindir/octave-bug
chmod 755 $bindir/octave-bug

if test -f LIBRARIES; then
  echo "installing shared libraries in $octlibdir"
  for f in `cat LIBRARIES`
  do
    file=`basename $f`
    cp $f $octlibdir/$file
    chmod 644 $octlibdir/$file
  done
fi

oct_files=`find . -name '*.oct' -print`
if test -n "$oct_files"; then
  echo "installing .oct files in $octfiledir"
  for f in $oct_files
  do
    file=`basename $f`
    cp $f $octfiledir/$file
    chmod 755 $octfiledir/$file
  done
  if test -f src/links-to-make; then
    cat src/links-to-make | while read src dest
    do
      if test -n "$src" && test -n "$dest"; then
	cd $octfiledir
	ln $src $dest
      fi
    done
  fi
  cd $distdir
fi

echo "installing .m files in $fcnfiledir"
cd scripts
tar cf - . | ( cd $fcnfiledir ; tar xf - )
find $fcnfiledir -type f -print | xargs chmod 0644
find $fcnfiledir -name '*.img' -print | xargs rm -f
cd $distdir

echo "installing image files in $imagedir"
cd scripts/image
cp *.img $imagedir
chmod 644 $imagedir/*.img
cd $distdir

echo "creating ls-R file in $datadir/octave"
ls -LR $datadir/octave > $datadir/octave/ls-R
chmod 644 $datadir/octave/ls-R

echo "creating ls-R file in $libexecdir/octave"
ls -LR $libexecdir/octave > $libexecdir/octave/ls-R
chmod 644 $libexecdir/octave/ls-R

echo "installing info files in $infodir"
for f in doc/interpreter/octave.info*
do
  file=`basename $f`
  cp $f $infodir/$file
  chmod 644 $infodir/$file
done

echo "installing man page in $mandir"
cp doc/interpreter/octave.1 $mandir/octave.$manext
chmod 644 $mandir/octave.$manext

case "$canonical_host_type" in
  *-*-cygwin32)
    if $alt_dir; then
      echo "*** You have specified an installation directory different"
      echo "*** from the default.  For Octave to run properly, you must"
      echo "*** set the environment variable OCTAVE_HOME to"
      echo "***"
      echo "***   $prefix"
      echo "***"
      echo "*** before starting Octave."
    fi
  ;;
esac

exit 0