#!/bin/sh
# Build and install GNU emacs for Slackware:
CWD=`pwd`
cd /tmp
rm -rf emacs-20.7
tar xyvf $CWD/emacs-20.7.tar.bz2
tar xyvf $CWD/leim-20.7.tar.bz2
cd emacs-20.7
# Save some docs:
rm -rf /usr/doc/emacs-20.7
mkdir -p /usr/doc/emacs-20.7
cp -a BUGS GETTING.GNU.SOFTWARE INSTALL README /usr/doc/emacs-20.7
chmod 644 /usr/doc/emacs-20.7/*
chown root.root /usr/doc/emacs-20.7/*
( cd /usr/doc/emacs-20.7 ; ln -sf /usr/share/emacs/20.7/etc . )
# Build a version of emacs that is not linked to the X11 libraries:
CFLAGS=-O2 LDFLAGS=-s ./configure i386-slackware-linux \
            --prefix=/usr \
            --with-x=no \
            --with-pop
make
make install
( cd /usr/bin ; mv emacs-20.7 emacs-20.7-no-x11 )
# OK, now we start over building the full X11 emacs:
CFLAGS=-O2 LDFLAGS=-s ./configure i386-slackware-linux \
            --prefix=/usr \
            --with-x11 \
            --with-x-toolkit \
            --with-pop
make
make install
( cd /usr/bin
  mv emacs-20.7 emacs-20.7-with-x11 
  ln -sf emacs-20.7-with-x11 emacs
)
