#!/bin/sh
PACKAGEDIR="$1"
INSTALLDIR="$2"
echo
echo "Creating links from /usr/local/bin to the Emacs binaries."
/bin/mkdirs /usr/local/bin
for binary in b2m ctags emacs emacsclient etags rcs-checkin; do
  /bin/ln -s $INSTALLDIR/Emacs.app/bin/$binary /usr/local/bin
done

echo "Creating links from /usr/local/man subdirectories to the Emacs man pages."
/bin/mkdirs /usr/local/man/man1 /usr/local/man/man6
/bin/ln -s $INSTALLDIR/Emacs.app/man/man1/* $INSTALLDIR/Emacs.app/lib/emacs/*/etc/celibacy.1 $INSTALLDIR/Emacs.app/lib/emacs/*/etc/condom.1 /usr/local/man/man1
/bin/ln -s  $INSTALLDIR/Emacs.app/lib/emacs/*/etc/sex.6 /usr/local/man/man6

echo "Creating a link from /usr/local/lib/emacs to the emacs library directory."
/bin/mkdirs /usr/local/lib
/bin/ln -s $INSTALLDIR/Emacs.app/share/emacs /usr/local/lib

echo "Done."
exit 0
