Skip to content

Instantly share code, notes, and snippets.

@pedz
Created November 29, 2018 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pedz/2f650dc8fe0f0f3a56d18ccdc3643364 to your computer and use it in GitHub Desktop.
Save pedz/2f650dc8fe0f0f3a56d18ccdc3643364 to your computer and use it in GitHub Desktop.
Script to build emacs on Mac OS
#!/bin/bash -x
VERSION=emacs-26.1
if [[ ! -d /usr/local/src/${VERSION} ]] ; then
cd /usr/local/src
tar xf /usr/local/images/${VERSION}/${VERSION}.tar.*
fi
cd /usr/local/images/${VERSION}
image=$( ls -1 ${VERSION}-mac* | tail -1 )
base="${image%.tar.*}"
if [[ ! -d "/usr/local/src/${base}" ]] ; then
cd /usr/local/src
tar xf "/usr/local/images/${VERSION}/${image}"
fi
echo "Does everything look good? If so, hit return"
read not_used
# step a.
EMACS_SOURCE_TOP=/usr/local/src/${VERSION}
# FTP from ftp://ftp.math.s.chiba-u.ac.jp/emacs
MACDIR="/usr/local/src/${base}"
cd "${EMACS_SOURCE_TOP}"
# step b.
if ! patch -p1 < $MACDIR/patch-mac ; then
echo Patching Failed
exit 1
fi
# steps c, f, and g.
( cd "${MACDIR}" ; tar cf - mac src lisp ) | tar xf -
# step d.
cp nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns \
mac/Emacs.app/Contents/Resources/Emacs.icns
cat << \EOF > Do-Configure
#!/bin/bash
export LDFLAGS="-L/usr/local/opt/libxml2/lib"
export CPPFLAGS="-I/usr/local/opt/libxml2/include/libxml2"
./configure --with-mac \
--without-imagemagick \
--enable-mac-app \
--prefix=/Applications/Emacs.app/Contents/Resources \
--exec_prefix=/Applications/Emacs.app/Contents/MacOS && \
make -j10 && \
make DESTDIR=`pwd`/root install && \
open root
echo $?
EOF
chmod +x ./Do-Configure
./Do-Configure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment