#!/bin/sh
# script to build lemur lite after some hand editing
# and manual setup.
# (no babel, no ruby, no mpi, no web)
# by Ben Allan (baallan@ca.sandia.gov) Nov 7, 2003
#
# In the following directions/script, you can change
# the paths for java and srcdir and prefix
# so long as you do it consistently.
# if completed properly, you end up with
# $HOME/cca/lemur_r2
# containing an installed framework.

# start by setting up the source code tree:
# % mkdir $HOME/cca/lemur_r2_src
SRCDIR=$HOME/cca/lemur_r2_src
# then move the downloaded tar file
# ccafe-0.4.3-lemur-r2.tar.bz
# into $SRCDIR.
# %  bunzip2 ccafe-0.4.3-lemur-r2.tar.bz; tar xf ccafe-0.4.3-lemur-r2.tar
# then copy this script into $SRCDIR
# and run it after adjusting any of the variables
# and verifying that java is installed as commented below.

if ! test -d $SRCDIR; then
  echo " you need to read $0 first and follow the steps before it will run"
  exit 1
fi

# Next is where the cca stuff will be installed
# when 'make install' targets are called.
# % mkdirhier $HOME/cca/lemur_r2
PREFIX=$HOME/cca/lemur_r2

# get sun java 1.4 or later
# % mkdir $HOME/java
# http://java.sun.com/j2se/1.4.2/download.html
# get the linux self-extracting file
# into $HOME/java
# and extract it:
# % chmod a+x j2sdk-1_4_2_02-linux-i586.bin; ./j2sdk-1_4_2_02-linux-i586.bin
# if you already have a java 1.4, just change JAVA_ROOT
# next line to point to it.
JAVA_ROOT=$HOME/java/j2sdk1.4.2_02

if ! test -x $JAVA_ROOT/bin/javac; then
  echo "JAVA_ROOT not set right in $0. Fix this."
  exit 1;
fi
# build classic
cd $SRCDIR
cd cca-spec-classic
./configure \
--with-jdk12=$JAVA_ROOT \
--prefix=$PREFIX
make 
make install
#build ccaffeine, no mpi, ruby, python, www, etc
cd $SRCDIR
cd ccafe
./configure --prefix=$PREFIX \
--with-cca-classic=$PREFIX \
--with-jdk12=$JAVA_ROOT \
--with-mpi=no \
--with-ruby=: \
--with-blas=no \
--with-lapack=no \
--with-cca-babel=no \
--disable-webhost

make
make install

exit 0

