#!/bin/sh
CWD=`pwd`
cd /tmp
rm -rf gcl-2.4.0
tar xzvf $CWD/gcl-2.4.0.tar.gz
cd gcl-2.4.0
CFLAGS=-O ./configure --prefix=/usr \
           --enable-tkconfig=/usr/lib \
           --enable-tclconfig=/usr/lib \
           --enable-infodir=/usr/info

## GCL needs to be static, or it crashes.  There was an attempt to fix this
## in the new sources, but it's not working for me.  I'll keep an eye on any
## new developments.
#for makefile in ./makefile */makefile ; do
#  ( cd `dirname $makefile` ; zcat $CWD/gcl-static.diff.gz | patch -p0 )
#done

make EMACS_SITE_LISP=/usr/share/emacs/site-lisp \
     EMACS_DEFAULT_EL=/usr/share/emacs/site-lisp/default.el

make EMACS_SITE_LISP=/usr/share/emacs/site-lisp \
     EMACS_DEFAULT_EL=/usr/share/emacs/site-lisp/default.el \
     install

( cd /usr/lib ; chown -R root.root gcl-2.4.0 )
( cd /usr/lib/gcl-2.4.0/info
  rm texinfo.tex
  gzip -9 --force *.info
  gzip -9 --force *.info-?
  chmod 644 *
  mv * /usr/info 
  cd ..
  rm -r info
  ln -sf /usr/info . )

# install docs:
mkdir -p /usr/doc/gcl-2.4.0
cp -a COPYING.LIB-2.0 ChangeLog faq machines readme doc /usr/doc/gcl-2.4.0
chown -R root.root /usr/doc/gcl-2.4.0/*
find /usr/doc/gcl-2.4.0 -type f -exec chmod 644 {} \;
echo
echo 'Do not strip the binaries in this package!'
echo
echo 'See inst script example:'
## Add this to doinst.sh before running makepkg:
## patcode(tm):
#if fgrep "GCL TK Doc" usr/info/dir 1> /dev/null 2> /dev/null ; then
#  true
#else
#  cat << EOF >> usr/info/dir
#* GCL Doc: (gcl-si.info).       GNU Common Lisp specific Documentation.
#* GCL TK Doc: (gcl-tk.info).    TK window GCL interface.
#* GCL Ansi Doc: (gcl.info).  Ansi Common Lisp Specification.
#EOF
#fi
## Autogenerated portion begins:

