#!/usr/bin/tcsh -v 

# $Id: InstPackages.sh,v 1.13 2011/11/10 22:55:06 alexk Exp $

# You need 'gzip', GNU 'tar', a C compiler, sed, pdftex to run this.
# Copy the current merged package archive to the 'pkg' subdirectory of
# your GAP installation.
# Then start this script (or do it step by step with cut and paste) inside
# this 'pkg' subdirectory.

# Frank Lübeck, Frank.Luebeck@Math.RWTH-Aachen.De for questions and complaints.

# Note, that this isn't and is not intended to be a sophisticated script.
# Even if it doesn't work completely automatically for you, you may get 
# an idea what to do for a complete installation of GAP.

# first unpack the merged package archive inside the 'pkg' subdirectory:
# tar xpzvf packages-*.tar.gz

cd ace
./configure ../..
make
cd ..

cd anupq
./configure ../..
# on Linux with gmp in standard place and with GAP 4.3 gap.sh script
# in standard path as: gap  just do: make  (otherwise check installation
# instructions - configure output gives hints)
make
cd ..

# You may not want a writable directory here! In this case substitute
# the directories 'datagens' and 'dataword' by links to somewhere else.
cd atlasrep
chmod 1777 datagens dataword
cd ..

cd Browse
./configure
make
cd ..

# Installation of Carat produces a lot of data, maybe you want to leave 
# this out until a user complains.
# It is not possible to move around compiled binaries because these have the
# path to some data files burned in.
cd carat
tar xzpf carat-2.1b1.tgz
rm -f bin
ln -s carat-2.1b1/bin bin
cd carat-2.1b1/functions
# Install the include Gmp first.
# (If you have already Gmp on your system, you can delete the file
# gmp-*.tar.gz and delete the target 'Gmp' from the target 'ALL' in
# carat-2.1b1/Makefile.)
tar xzpf gmp-*.tar.gz
cd ..
make TOPDIR=`pwd` Links
# Note that Gmp may use processor specific code, so this step may not be ok
# for a network installation if you want to use the package on older computers
# as well.
make TOPDIR=`pwd` Gmp
# And now the actual Carat programs.
make TOPDIR=`pwd` CFLAGS=`-O2`
cd ../..


cd cohomolo
./configure 
cd standalone/progs.d
cp makefile.orig makefile
cd ../..
make 
cd ..

# create dynamic library with EDIM kernel module
cd edim
make clean
unsetenv LANG
unsetenv LC_ALL
./configure
make
cd ..

cd example
./configure ../..
make
cd ..

cd fplsa
./configure ../..
make CC="gcc -O2 "
cd doc
tex manual
tex manual
makeindex manual
tex manual
cd ../..

cd grape
./configure ../..
make 
cd ..


cd guava*
./configure ../..
make
cd ..

cd io
./configure ../..
make
cd ..

cd kbmag
make clean
./configure ../..
make COPTS="-O2 -g"
cd ..

# nq needs 'gmp' the GNU multi precision integer package, it is contained in
# the 'carat' package installed above (you can use another installation
# of 'gmp', adjust the argument to 'make' below accordingly)
cd nq-*
./configure
# change paths to your GMP installation
#make GNU_MP_LIB=../../Gmplib/lib GNU_MP_INC=../../Gmplib/include
# or install gmp-dev package on your system, then
make
cd ..

# orb
cd orb
./configure 
make
cd ..

#  see the pargap documentation how to use this 
#  (in particular, user needs procgroup file)
#  [more complicated to include EDIM kernel module ...]
cd pargap
./configure ../..
make 
cp bin/pargap.sh ../../bin/
cd ..
rm -f ALLPKG

#  Easy, if prerequisites are installed. You may get GNU GMP
#  (http://gmplib.org/) and BLAS (http://www.netlib.org/blas/) 
#  via packages in your Linux distribution. But you probably need to
#  install LinBox (http://www.linalg.org/download.html) yourself.
#  Once you have install everything which is needed uncomment the following
#  lines:

#cd linboxing
#./configure ../..
#make
#cd ..

# For XGap the following shared libraries of the X window system must be 
# installed on your machine together with the development files (header 
# files and so on):
# 
#   libXaw.so, libXmu.so, libXt.so, libXext.so, libX11.so, libSM.so, libICE.so
# 
# In addition you need on XFree Version >= 4:
# 
#   libXpm.so
#
# If you  miss one of  these under Linux you  can usually just  install some
# more packages of your favorite distribution. The development files usually
# come in some package with "dev" in its name.
cd xgap
./configure
make 
rm -f ../../bin/xgap.sh
cp bin/xgap.sh ../../bin/
cd ..




