Skip to content

Instantly share code, notes, and snippets.

@takaxp
Last active August 20, 2022 16:53
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 takaxp/77acfca20579a899e68a4fe90d9c596f to your computer and use it in GitHub Desktop.
Save takaxp/77acfca20579a899e68a4fe90d9c596f to your computer and use it in GitHub Desktop.
Build self-contained EMP with some custom variables (for 28.1)
#!/bin/sh
# The original script is here: https://gist.githubusercontent.com/railwaycat/10988446/raw/990dde69ea728b9ceff68dd649ad2112c5692ef0/build-emacs.app.sh
rootdir=$HOME/Desktop/emacs_mac_port
if [ ! -d $rootdir ]; then
mkdir $rootdir
fi
installprefix=$rootdir/build
app_dir=$installprefix/Emacs.app/Contents/Resources
compver=x86_64-apple-darwin`uname -r`
## for release version
source_url=http://ftpmirror.gnu.org/emacs
version=28.1
version_postfix=""
patch_version=28.1-mac-9.0
## for alpha version
# source_url=ftp://alpha.gnu.org/gnu/emacs/pretest
# version=25.2 # 25.1
# version_postfix="-rc2" # ".90"
# patch_version=25.2-rc1-mac-6.2
cd $rootdir
find . -name *.elc | xargs rm
if [ -d $installprefix ]; then
rm -rf $installprefix
fi
mkdir $installprefix
#
if [ ! -f emacs-mac-custom.patch ]; then
# 28.1
curl -LO https://gist.githubusercontent.com/takaxp/ed9ae4a736628156a28fddb20a2fe0d7/raw/72543c1980771857f883f50e3e39cbaa7a8fac09/emacs-mac-custom.patch
fi
if [ ! -f emacs-$version$version_postfix.tar.xz ]; then
curl -LO $source_url/emacs-$version$version_postfix.tar.xz
fi
if [ -d $rootdir/emacs-$version ]; then
rm -rf $rootdir/emacs-$version
fi
tar zxvf emacs-$version$version_postfix.tar.xz
if [ ! -f emacs-$patch_version.tar.gz ]; then
curl -LO ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-$patch_version.tar.gz
fi
if [ -d $rootdir/emacs-$patch_version ]; then
rm -rf $rootdir/emacs-$patch_version
fi
tar zxvf emacs-$patch_version.tar.gz
cd $rootdir/emacs-$version
patch -p1 < ../emacs-$patch_version/patch-mac
cp -r ../emacs-$patch_version/mac mac
cp ../emacs-$patch_version/src/* src
cp ../emacs-$patch_version/lisp/term/mac-win.el lisp/term
if [ -f ../emacs-mac-custom.patch ]; then
patch -p1 < ../emacs-mac-custom.patch
fi
sleep 5
cp -f nextstep/Cocoa/Emacs.base/Contents/Resources/Emacs.icns mac/Emacs.app/Contents/Resources/Emacs.icns
./configure --without-x --with-mac --enable-mac-self-contained --with-modules --with-rsvg --enable-mac-app=$installprefix --prefix=$installprefix
sleep 5
make bootstrap -j6
make install -j6
cd $installprefix
open .
echo '--------'
echo 'enjoy!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment