home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / octave-1.1.1p1-base.tgz / octave-1.1.1p1-base.tar / fsf / octave / doinstall.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1995-02-02  |  6KB  |  197 lines

  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.  
  10. # ask octave to tell us the version number
  11. version=`./octave -v 2>/dev/null | awk '/version/ { print $NF }'`
  12.  
  13. if test -z "$version"
  14. then
  15.   echo "doinstall.sh: unable to extract version number from Octave!"
  16.   exit 1
  17. fi
  18.  
  19. # ask octave to tell us the target host type
  20. target_host_type=`echo computer | ./octave -q`
  21.  
  22. if test -z "$target_host_type"
  23. then
  24.   echo "doinstall.sh: unable to extract host type from Octave!"
  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.
  34. prefix=/usr/local
  35.  
  36. prefix="/usr/local"
  37. if test $# -eq 1
  38. then
  39.   prefix=$1
  40. else
  41.   if test $# -gt 1
  42.   then
  43.     echo "usage: doinstall.sh [prefix-directory]"
  44.     exit 1
  45.   fi
  46. fi
  47.  
  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"
  64.  
  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.
  81.  
  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.
  92. localfcnfiledir="$datadir/octave/site/m"
  93. localfcnfilepath="$localfcnfiledir//"
  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"
  100.  
  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"
  106.  
  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.
  111. localoctfiledir="$datadir/octave/site/oct/$target_host_type"
  112. localoctfilepath="$localoctfiledir//"
  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.
  121. imagedir="$datadir/octave/$version/imagelib"
  122. imagepath=".:$imagedir//"
  123.  
  124. cat << EOF
  125. Installing octave in subdirectories of $prefix.
  126.  
  127.        Binaries: $bindir
  128.  Function files: $fcnfiledir
  129.     Demo images: $imagedir
  130.      Info files: $infodir
  131.        Man page: $mandir
  132.  
  133. EOF
  134.  
  135. DIRS_TO_MAKE="$bindir $datadir $libdir $includedir $mandir $infodir \
  136.   $fcnfiledir $archlibdir $octfiledir $imagedir \
  137.   $localfcnfiledir $localoctfiledir"
  138.  
  139. ./mkinstalldirs $DIRS_TO_MAKE
  140. chmod 755 $DIRS_TO_MAKE
  141.  
  142. if test "$prefix" = /usr/local
  143. then
  144.   echo "installing ./octave as $bindir/octave"
  145.   cp octave $bindir/octave
  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"
  154.   cp octave $bindir/octave.bin
  155.   chmod 755 $bindir/octave.bin
  156. fi
  157.  
  158. echo "installing octtopnm as $archlibdir/octtopnm"
  159. cp octtopnm $archlibdir/octtopnm
  160. chmod 755 $archlibdir/octtopnm
  161.  
  162. echo "installing octave-bug as $bindir/octave-bug"
  163. cp octave-bug $bindir/octave-bug
  164. chmod 755 $bindir/octave-bug
  165.  
  166. echo "installing function files in $fcnfiledir"
  167. ( cd scripts
  168.   ../mkinstalldirs `find . -type d -print | sed -e 's,^\./,,' -e "s,^,$fcnfiledir/,"`
  169.   for f in `find . \( -name '*.m' -o -name octaverc \) -print`
  170.   do
  171.     cp $f $fcnfiledir/$f
  172.     chmod 644 $fcnfiledir/$f
  173.   done )
  174.  
  175. echo "installing image files in $imagedir"
  176. ( cd scripts
  177.   for f in `find . -name '*.img' -print`
  178.   do
  179.     file=`basename $f`
  180.     cp $f $imagedir/$file
  181.     chmod 644 $imagedir/$file
  182.   done )
  183.  
  184. echo "installing info files in $infodir"
  185. for f in doc/octave.info*
  186. do
  187.   file=`basename $f`
  188.   cp $f $infodir/$file
  189.   chmod 644 $infodir/$file
  190. done
  191.  
  192. echo "installing man page in $mandir"
  193. cp doc/octave.1 $mandir/octave.$manext
  194. chmod 644 $mandir/octave.$manext
  195.  
  196. exit 0
  197.