#!/bin/sh
# http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/get-and-install
# Aaron Sloman
# http://www.cs.bham.ac.uk/~axs/
# 7 Jun 2008
# Altered to redirect all error output to install.log
# 11 Apr 2007
# Either run this script or run the steps separately. It should
# fetch and install poplog in /usr/local/poplog, and put some
# easily removable links in /usr/local/bin and /usr/local/man
# so you need write access to those two directories (or you
# can run this as super user).


# Find a suitable place to download stuff from the free poplog site
# when you run this it will create a sub-directory v15.61-amd64 and put
# the downloaded files in there, then run them.

echo ""
echo ""

echo "mkdir v15.61-amd64"
mkdir v15.61-amd64

echo "cd v15.61-amd64"
cd v15.61-amd64
echo "`pwd`"

echo ""
echo ""

echo "Fetching documentation file"
echo "wget http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/AREADME.txt"
wget http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/AREADME.txt

echo ""
echo ""

echo "Fetching two shell scripts"

echo "wget http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/CHECK_LINUX_FACILITIES_64bit"
wget http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/CHECK_LINUX_FACILITIES_64bit

sleep 3

echo ""
echo ""
echo "wget http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/INSTALL_BHAM_LINUX_64bitPOPLOG"
wget http://www.cs.bham.ac.uk/research/projects/poplog/v15.61-amd64/INSTALL_BHAM_LINUX_64bitPOPLOG

sleep 3

echo ""
echo "Making those two executable"
echo "chmod 755 CHECK_LINUX_FACILITIES_64bit INSTALL_BHAM_LINUX_64bitPOPLOG"
chmod 755 CHECK_LINUX_FACILITIES_64bit INSTALL_BHAM_LINUX_64bitPOPLOG

sleep 3

echo ""
echo ""
echo "Fetching tar file. About 22 Mbytes. May take some time."
echo "wget http://www.cs.bham.ac.uk/research/poplog/v15.61-amd64/bham-linux-poplog-v15.61-amd64.tar.gz"
wget http://www.cs.bham.ac.uk/research/poplog/v15.61-amd64/bham-linux-poplog-v15.61-amd64.tar.gz

echo ""
echo ""
echo "Run the install script without arguments to get instructions"
echo "./INSTALL_BHAM_LINUX_64bitPOPLOG"
./INSTALL_BHAM_LINUX_64bitPOPLOG
echo "(pausing 3 seconds)"

sleep 3

echo ""
echo "Run the install script with arguments to install poplog in current directory"
#echo "./INSTALL_BHAM_LINUX_64bitPOPLOG motif bham `pwd`/pop nolinks > install.log"
echo "./INSTALL_BHAM_LINUX_64bitPOPLOG motif bham `pwd`/pop nolinks 1> install.log 2>&1"
echo "(May take some time, depending on speed of your machine)"
sleep 3
#./INSTALL_BHAM_LINUX_64bitPOPLOG motif bham `pwd`/pop nolinks > install.log
./INSTALL_BHAM_LINUX_64bitPOPLOG motif bham `pwd`/pop nolinks 1> install.log 2>&1

echo ""
echo ""
echo "FINISHED!"
echo ""
echo "Look in subdirectory v15.61-amd64 and v15.61-amd64/pop"
echo ""
echo "You can read the install.log file if you are curious."
echo "PLEASE SEND THE install.log file IF REPORTING INSTALLATION PROBLEMS"
echo "====="
echo "There are lots of warning messages printed while compiling"
echo "common lisp, prolog and pml which you can ignore."
echo "You can email the install.log file to A.Sloman if you have"
echo "problems with installation. But please include details of hardware"
echo "and operating system, including version."
echo "(pausing)"
sleep 5

echo ""
echo "You can can now 'cd v15.61-amd64/pop/current-poplog/bin/demos' "
echo "then read the file AREADME-DEMOS.txt to see  how to test poplog"
echo "E.g. run eliza, or run a graphical pop11 demo."
echo ""

echo ""
echo "Report Problems learning/using pop11 to pop-forum@cs.bham.ac.uk"
echo ""
