#!/bin/csh
## $local/com/INSTALL_MOTIF_POPLOG
## Install Motif poplog then run INSTALL_LIKE_BHAM
## Not properly tested
## Aaron Sloman
## 25 Sep 1999
## Changed 22 Sep 2000, to do only poplog install, then run separate
## script for Bham stuff
## Changed 28 Sep 2001 to make symbolic link
## Changed 4 Apr 2002 to allow for reorganisation of tar files
## Changed 22 Apr 2002: Fixed bugs due to environment variables

## Run this in the directory in which popcd.tar has been unpacked

set tardir=`pwd`

## EDIT THIS LINE IF NECESSARY: location for $poplocal, etc.
set rootdir=/usr/local/poplog

## Change this for new version of Poplog
mkdir $rootdir $rootdir/v15.53a $rootdir/local

chmod 755 $rootdir $rootdir/v15.53a $rootdir/local

setenv usepop $rootdir/v15.53a

## Location for local saved images
## Version specific
setenv poplocalbin $usepop/poplocalbin

mkdir $poplocalbin

setenv poplocal $rootdir

setenv local $poplocal/local

cd $rootdir
ln -s v15.53a current.poplog

cd $usepop

echo "Unpacking poplog+motif. May take some time"

# Install linux poplog with motif
zcat $tardir/linuxmotif1553a.tar.gz | tar xf -

echo "UNPACKING POPLOG TAR FILE COMPLETE"

echo "main poplog system installed in $usepop"

echo "======================================================"

echo "directories in $usepop/pop "
ls -l $usepop/pop/

echo "======================================================"
echo "Now rebuilding system images"

source $usepop/pop/com/poplog

# Extend $path (needed for mknewpop and mksyscomp)
set path = ($usepop/pop/pop $path)

$popsrc/mknewpop

$popsrc/mksyscomp poplink poplibr popc

echo ""
echo "System images made"
echo ""
ls -l $popsys/*.psv

echo ""
echo "======================================================"
echo ""
echo "Now making standard images in $usepop/pop/lib/psv"

$popcom/mkstartup

## Needed for next items
setenv pop_pop11 "-$popsavelib/startup.psv"

$popcom/mkplog
$popcom/mkclisp
$popcom/mkpml
$popcom/mkxved

echo ""
echo "Standard images made"
echo ""

ls -l $usepop/pop/lib/psv

echo "Delete any you don't need"
echo ""

echo "======================================================"

echo "Now installing packages in $local"

cd $tardir

echo "Run INSTALL_LIKE_BHAM"

./INSTALL_LIKE_BHAM

echo "======================================================"
echo "Finished INSTALL_LIKE_BHAM"

echo "done INSTALL_MOTIF_POPLOG"
