Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
# build emacs with experimental/hackers-only patch
# usage:
# ./makeemacs.sh EMACS_VER MACPORT_VER <PRE>
# example:
# ./makeemacs.sh 24.3 4.8
# ./makeemacs.sh 24.3.90 4.90 PRE
# ref:
# - ftp://ftp.math.s.chiba-u.ac.jp/emacs/
# - http://sakito.jp/emacs/emacs24.html
# - http://ftp.gnu.org/pub/gnu/emacs/
# - ftp://alpha.gnu.org/gnu/emacs/pretest/
# - http://lists.gnu.org/archive/html/info-gnu-emacs/2014-04/msg00000.html
if [ $# -lt 2 ]; then
echo "$0 EMACS_VER MACPORT_VER <PRE>"
exit 1
fi
EMACS_VER=$1
MACPORT_VER=$2
PRE=$3
EMACS=emacs-${EMACS_VER}
EMACS_ARC=${EMACS}.tar.xz
MACPORT=emacs-${EMACS_VER}-mac-${MACPORT_VER}
MACPORT_ARC=${MACPORT}.tar.gz
if [ ! -a ${EMACS_ARC} ]; then
if [ "${PRE}" = "PRE" ]; then
curl -O ftp://alpha.gnu.org/gnu/emacs/pretest/${EMACS_ARC}
else
curl -O http://ftp.gnu.org/pub/gnu/emacs/${EMACS_ARC}
fi
fi
if [ ! -a ${MACPORT_ARC} ]; then
curl -O ftp://ftp.math.s.chiba-u.ac.jp/emacs/${MACPORT_ARC}
fi
if [ -d ${EMACS} ]; then
rm -fr ${EMACS}
fi
if [ -d ${MACPORT} ]; then
rm -fr ${MACPORT}
fi
tar Jvxf ${EMACS_ARC}
tar xvfz ${MACPORT_ARC}
cd ${EMACS}
patch -p 0 < ../${MACPORT}/patch-mac
cp -r ../${MACPORT}/mac mac
cp ../${MACPORT}/src/* src
cp ../${MACPORT}/lisp/term/mac-win.el lisp/term
cp nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns mac/Emacs.app/Contents/Resources/Emacs.icns
./configure --with-mac --without-x --without-imagemagick --without-rsvg
make
sudo make install
# open mac/Emacs.app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment