changeset 811:433ab56e62cd

[project @ 1994-10-14 21:58:37 by jwe]
author jwe
date Fri, 14 Oct 1994 21:59:41 +0000
parents 1865b6725111
children 0aac647c3f97
files doinstall.sh src/variables.cc
diffstat 2 files changed, 129 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/doinstall.sh	Fri Oct 14 18:47:48 1994 +0000
+++ b/doinstall.sh	Fri Oct 14 21:59:41 1994 +0000
@@ -7,55 +7,127 @@
 # Department of Chemical Engineering
 # The University of Texas at Austin
 
+# ask octave to tell us the version number
+version=`./octave -v 2>/dev/null | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q`
+
+if test -z "$version"
+then
+  echo "doinstall.sh: unable to extract version number from Octave!"
+  exit 1
+fi
+
+# ==================== 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=/usr/local
-if test $# -eq 1 ; then
+
+prefix="/usr/local"
+if test $# -eq 1
+then
   prefix=$1
 else
-  if test $# -gt 1 ; then
+  if test $# -gt 1
+  then
     echo "usage: doinstall.sh [prefix-directory]"
     exit 1
   fi
 fi
 
-# ask octave to tell us the version number
-version=`./octave -v 2>/dev/null | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q`
+# 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/lib"
+
+# Where to install and expect libraries like libcruft.a, liboctave.a,
+# and libreadline.a, executable files to be run by Octave rather than
+# directly by users, and other architecture-dependent data.
+# ${archlibdir} is a subdirectory of this. 
+libdir="$exec_prefix/lib"
 
-if test -z "$version" ; then
-  echo "doinstall.sh: unable to extract version number from Octave!"
-  exit 1
-fi
+# Where to install Octave's include files.  The default is
+# ${prefix}/include/octave
+includedir="$prefix/include/octave"
+
+# 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"
+
+# ==================== 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 binaries.
-bindir=$prefix/bin
+# 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.
+localfcnfilepath="$datadir/octave/site/m//"
+
+# 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="$libdir/octave/$version/exec/$target_host_type"
 
-# where to install M-files
-libsubdir=$prefix/lib/octave/$version
+# 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="$libdir/octave/$version/oct/$target_host_type"
 
-# where to install Info files
-infodir=$prefix/info
+# 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.
+localoctfilepath="$datadir/octave/site/oct/$target_host_type//"
+
+# 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.
+imagedir="$fcnfiledir/imagelib"
+imagepath=".:$imagedir//"
 
 cat << EOF
-Installing octave in subdirectories of $prefix:
+Installing octave in subdirectories of $prefix.
 
-    Binaries: $bindir
-     M-files: $libsubdir
-  Info files: $infodir
+       Binaries: $bindir
+ Function files: $fcnfiledir
+     Info files: $infodir
+       Man page: $mandir
 
 EOF
 
-for d in $bindir $libsubdir $infodir ; do
-  if test -d $d ; then
-    true
-  else
-    echo "making $d"
-    ./mkpath $d
-    chmod 755 $d
-  fi
-done
-chmod 755 $prefix/lib
-chmod 755 $prefix/lib/octave
+DIRS_TO_MAKE="$bindir $datadir $libdir $includedir $mandir $infodir \
+  $fcnfiledir $archlibdir $octfiledir $imagedir" 
 
-if test "$prefix" = /usr/local ; then
+./mkinstalldirs $DIRS_TO_MAKE
+chmod 755 $DIRS_TO_MAKE
+
+if test "$prefix" = /usr/local
+then
   echo "installing ./octave as $bindir/octave"
   cp ./octave $bindir/octave
   chmod 755 $bindir/octave
@@ -70,20 +142,25 @@
   chmod 755 $bindir/octave.bin
 fi
 
-echo "installing M-files in $libsubdir"
-for f in scripts/*.m ; do
-  file=`basename $f`
-  echo $file
-  cp $f $libsubdir/$file
-  chmod 644 $libsubdir/$file
-done
+echo "installing function files in $fcnfiledir"
+( cd scripts
+  ../mkinstalldirs `find . -type d | sed "s,^,$fcnfiledir/,"`
+  for f in `find . -name '*.m'`
+  do
+    cp $f $fcnfiledir/$f
+    chmod 644 $fcnfiledir/$f
+  done )
 
 echo "installing info files in $infodir"
-for f in doc/octave.info* ; do
+for f in doc/octave.info*
+do
   file=`basename $f`
-  echo $file
   cp $f $infodir/$file
   chmod 644 $infodir/$file
 done
 
+echo "installing man page in $mandir"
+cp doc/octave.1 $mandir/octave.$manext
+chmod 644 $mandir/octave.$manext
+
 exit 0
--- a/src/variables.cc	Fri Oct 14 18:47:48 1994 +0000
+++ b/src/variables.cc	Fri Oct 14 21:59:41 1994 +0000
@@ -288,15 +288,18 @@
 
       int count = 0;
       char *ptr = s;
-      while (strstr (ptr, prefix))
+      char *next = 0;
+      while ((next = strstr (ptr, prefix)))
 	{
-	  ptr += len_prefix;
+	  ptr = next + len_prefix;
 	  count++;
 	}
 
       int grow_size = count * (len_home - len_prefix);
 
-      int len_retval = strlen (s) + grow_size;
+      int len_s = strlen (s);
+
+      int len_retval = len_s + count * grow_size;
 
       retval = new char [len_retval+1];
 
@@ -304,21 +307,23 @@
       char *p2 = p1;
       char *pdest = retval;
 
-      for (int i = 0; i < count; i++)
+// Is this really a good way to do this?
+
+      while (count >= 0)
 	{
 	  p2 = strstr (p1, prefix);
 	  
 	  if (! p2)
 	    {
-	      error ("unable to substitute OCTAVE_HOME");
-	      return retval;
+	      memcpy (pdest, p1, strlen (p1)+1);
+	      break;
 	    }
-
-	  if (p1 == p2)
+	  else if (p1 == p2)
 	    {
 	      memcpy (pdest, home, len_home);
 	      pdest += len_home;
 	      p1 += len_prefix;
+	      count--;
 	    }
 	  else
 	    {