Installing E910_LOCALROOT

               INSTALLING E910_LOCALROOT FROM SCRATCH

Building a source tree which can build properly is a somewhat hairy task.
It breaks down to three subtasks:

 1) have the system configured properly
 2) installing 3rd party software needed to run our code but not under 
    our CVS development tree.
 3) checking out the base set of modules.

There is some overlap between 1 and 2, because some or all of the third party
software may well be installed on the system.  I make the distinction because
one doesn't always have the liberty or the desire to install such packages.
It is safest to assume that the system has a relatively competent admin who is
willing to install defacto standard programs for you, for instance perl, but
who is unwilling to install esoteric packages, like socket++, on the system.  

Software Category 1
-------------------
CVS 1.9
RCS 5.7
perl 5.004_04
make 3.75 or higher
g++/gcc 2.8.1
binutils-2.9.1 or higher (if relying on GNU binutils)
Fortran compiler supporting VAX extensions

Software Category 2
-------------------
socket++-1.10
postgresql-6.2.1
zlib-1.1.3
readline-2.1
gawk

Let's start with the final step, checking out the CVS source, as this is the
one most likely to succeed.  It'll boost your confidence before the other
steps shoot it down.

Checkout the e910 account setup
-------------------------------
cvs -d username@physgi03.phy.bnl.gov:/scratch15/e910 checkout setup
ln -s setup/login.e910 login.e910
edit login.e910 to reflect the following for your host:
 - E910_HOME
 - E910_ROOT : where the root of all evil lies
 - E910_LOCALROOT : use same as E910_ROOT
 - CVSROOT : use the rsh version (e910@physgi03.phy.bnl.gov:/scratch15/e910)
put this lines in e910's .login
 source ~/login.e910 

Make the directory structure
----------------------------
mkdir $HOME/e910root  (or where ever e910root should lie)
mkdir -p $E910_LOCALROOT/eostas
mkdir -p $E910_LOCALROOT/e910perl
mkdir -p $E910_LOCALROOT/database
mkdir -p $E910_LOCALROOT/utils

Checkout the source
-------------------
cd $E910_LOCALROOT/eostas
cvs checkout -d updsrc e910tas
cd $E910_LOCALROOT/database
cvs checkout -d updsrc database
cd $E910_LOCALROOT/e910perl
cvs checkout -d updsrc e910perl

Setup the 3rd Party sources
---------------------------
The assumption here is that third-party packages should reside
under $E910_LOCALROOT/utils.
mkdir -p $E910_LOCALROOT/utils/source
mkdir -p $E910_LOCALROOT/utils/include
mkdir -p $E910_LOCALROOT/utils/lib

General notes concerning building the third-party packages
----------------------------------------------------------
The recommended directory for unpacking the source code is 

  $E910_LOCALROOT/utils/source

This is mostly asthetic.  It can also help in creating a binary distribution
for sites unable to build.  If you lack the disk space to do so, there is
nothing preventing you from building elsewhere, as long as you make sure the
intallation goes under $E910_LOCALROOT/utils.

It is fairly standard for the makefiles to use CC for the C compiler and CXX
for the C++ compiler.  Thus you can explicitly indicate the compiler to use by
replacing "make" with

     make CC=cc CXX=cxx

(on DU4.0, for instance).

Some systems (nevis1, for instance) install GNU make under "gmake".  If you
would like to use GNU make instead of the system's default, substitute "gmake"
for "make" below.  Most packages don't rely on gmake.  GNU make is still
required for our source build, however.

Building gcc-2.8.1 (includes building libstdc++)
------------------------------------------------
1)  unpack the source code for gcc-2.8.1
2)  cd gcc-2.8.1/
3)  read the INSTALL file
4)  ./configure --prefix=DIR --with-local-prefix=DIR
      where DIR == $E910_LOCALROOT/utils
5)  make LANGUAGES="c c++"
      NOTE:  you may need to supply CC="your-working-compiler"
6)  make bootstrap LANGUAGES="c c++"
7)  make compare
8)  make install LANGUAGES="c c++"
      NOTE:  The command line should be the same as the make bootstrap command
9)  unpack the source for libstdc++-2.8.1
10) cd libstdc++-2.8.1/
11) read the README file
12) ./configure --prefix=DIR --with-local-prefix=DIR
   where DIR == $E910_LOCALROOT/utils
13) make 
14) make install

Building socket++
-----------------
unpack socket++-1.10
cd socket++-1.10/
./configure --prefix=$E910_LOCALROOT/utils
make CXX="your-working-c++-compiler"
cd test
make CXX="your-working-c++-compiler" check

Building zlib
-------------
unpack zlib-1.1.3
cd zlib-1.1.3/
./configure --prefix=$E910_LOCALROOT/utils
gmake
gmake test
gmake install prefix=$E910_LOCALROOT/utils

Building readline
-----------------
unpack readline-2.x
cd readline-2.x/
./configure --prefix=$E910_LOCALROOT/utils
make
make check
make install

Building postgres
-----------------
unpack postgresql-6.2.1
cd postgresql-6.2.1/
read the INSTALL file
mkdir $E910_LOCALROOT/pgsql
cd src
./configure --prefix=$E910_LOCALROOT/pgsql
make clean
make all >& make.log &
tail -f make.log
cd $E910_LOCALROOT/pgsql/src/test/regress 
make clean
make all runtest
cd $E910_LOCALROOT/pgsql/src/
make install

Notes from setting up moses.llnl.gov
====================================
compiling gcc 2.8.1:
- unpacked source into $E910_LOCALROOT/utils/source (tar creates gcc-2.8.1)
- ./configure
- make CC=cc LANGUAGES="c"
- make bootstrap LANGUAGES="c"
- make compare
- (asked ron to do as root:) 
  make install CC="stage2/xgcc -Bstage2/" CFLAGS="-O -g" LANGUAGES="c"
compiling readline 2.1:
- (setenv PATH /scr3/e910/e910root/utils/source/gcc-2.8.1/stage2:$PATH;
   make CC=$E910_LOCALROOT/utils/source/gcc-2.8.1/stage2/xgcc)
- failed in signals.c

Notes building gdb 4.17 on compass
==================================
- ./configure --prefix=$E910_LOCALROOT/utils
- gmake YACC=yacc
- gmake install

Notes from building e910 source on compass cluster (LLNL)
=========================================================
- socket++-1.10 seems to not be ported to DU
- it appears the system has readline, though i do not know what version yet
- postgres fails because it can't locate libgen.a.  why the configure script 
  can't figure this out is a mystery.
  This is particularly frustrating because all i want to do is install 
  the include files in a resonable place, but make install fails during
  the postgres link.
- readline fails during the install stage.  is appears to generate mangled
  make commands, which the shell complains about.

Notes from rebuilding code hierarchy on lllhip (irix6.5)
========================================================
postgresql-6.2.1:
-----------------
- ./configure --prefix=$E910_LOCALROOT/utils
- questions asked and answers given:
  template           : irix5
  add'l include dirs : $E910_LOCALROOT/utils/include
  add'l lib dirs     : $E910_LOCALROOT/utils/lib
- in order to make without the util lorder (not present on lllhip):
    make MK_NO_LORDER=yes
- in order to install using the GNU version of install:
    make INSTALL=ginstall install
socket++-1.10:
--------------
- had to change line 322 of socketstream.C from 
             int	sa_len = sa.size ();
  to 
             int	sa_Len = sa.size ();
  because sa_len is a "#define" in  under irix6.5.
- make install prefix=$E910_LOCALROOT/utils since .configure --prefix=DIR
  didn't seem to work.
gawk-3.0.3:
-----------
o building with gcc produced suspicious compiler warnings and several
  failures in the "make check" stage
o building with SGI's cc (MIPSpro Compilers: Version 7.2.1) produced some
  benign warnings and no suspicious errors from the "make check"

TODO
----
get socket++-1.10 to compile properly
install socket++-1.10
build postgres successfully
regression tests
install postgres successfully
install readline successfully