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