#!/bin/csh -f
wget ftp://ftp.ccp4.ac.uk/ccp4/6.1.1/ccp4-6.1.1-core-src.tar.gz
wget http://www.ysbl.york.ac.uk/~cowtan/clipper/clipper21.latest.tar.gz
#wget http://www.ysbl.york.ac.uk/~cowtan/clipper/clipper-kiss.latest.tar.gz
tar xvfz ccp4-6.1.1-core-src.tar.gz
setenv CCP4_MASTER      $PWD/
setenv CCP4             $CCP4_MASTER/ccp4-6.1.1/
setenv CCP4_SCR         /tmp/$USER
setenv BINSORT_SCR      $CCP4_SCR
setenv CCP4_OPEN        UNKNOWN
setenv CLIB             $CCP4/lib
setenv CLIBD            $CCP4/lib/data
setenv CLIBS            $CCP4/lib/src
setenv CINCL            $CCP4/include
setenv PUBLIC_FONT84    $CLIB/font84.dat
cd $CCP4
sed -i.orig 's#^\(.*passwd_struct.*\)$#//\1#' lib/src/library_utils.c 
./configure --enable-fftw --disable-clipper --disable-ccif --disable-lapack --disable-ssm --disable-pdb_extract --disable-cctbx --disable-diffractionImg --onlylib
gmake -k install

cd $CCP4_MASTER
mkdir clipper
cd clipper
tar xvfz ../clipper21.latest.tar.gz
#tar xvfz ../clipper-kiss.latest.tar.gz
setenv OPT -O1
./configure --ccp4dir=$CCP4
gmake examples
