Skip to content

Instantly share code, notes, and snippets.

@railwaycat
Last active May 30, 2018 15:54
Show Gist options
  • Save railwaycat/10988446 to your computer and use it in GitHub Desktop.
Save railwaycat/10988446 to your computer and use it in GitHub Desktop.
build emacs mac port bundle
#!/bin/sh
# usage: ./build-emacs.app.sh <emacs-mac-port-source-directory>
installprefix=`pwd`/emacs-mac-out
app_dir=$installprefix/Emacs.app/Contents/Resources
version=26.1 # update the version nunber
compver=x86_64-apple-darwin`uname -r`
# if you install texinfo by homebrew and key-only
export PATH="/usr/local/opt/texinfo/bin:$PATH"
cd $1
# make an emacs bundle
# no longer need this I believe?
#find . -name *.elc | xargs rm
if [[ -d $installprefix ]]; then
echo "$installprefix already exists, abort."
echo "Please remove or rename this directory and try again"
exit 1;
fi
# rm -rf $installprefix
mkdir $installprefix
set -e
./autogen.sh
./configure PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig --with-mac --enable-mac-app=$installprefix --prefix=$installprefix
make
make install
set +e
mv $installprefix/share/emacs/$version/* $app_dir
mv $installprefix/share/info $app_dir
mv $installprefix/share/man $app_dir
rm -rf $installprefix/share
mv $installprefix/var $app_dir
mv $installprefix/bin $app_dir/../MacOS/bin
# mkdir $app_dir/../MacOS/libexec
mv $installprefix/libexec/emacs/$version/$compver $app_dir/../MacOS/libexec
rm -rf $installprefix/libexec
mv $installprefix/lib $app_dir
echo 'Done! Find your Emacs.app at '$installprefix'.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment