Created
September 26, 2017 06:28
-
-
Save takaxp/88b9e7f7e73e386173a0337fb87e51e0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
#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 | |
source_url=http://ftpmirror.gnu.org/emacs | |
version=25.3 | |
version_postfix="" # ".90" | |
patch_version=$version-mac-6.8 | |
compver=x86_64-apple-darwin`uname -r` | |
if [ -d $installprefix ]; then | |
echo "target directory $installprefix exists, exit." | |
exit | |
fi | |
cd $rootdir | |
find . -name *.elc | xargs rm | |
if [ -d $installprefix ]; then | |
rm -rf $installprefix | |
fi | |
mkdir $installprefix | |
# | |
curl -LO $source_url/emacs-$version$version_postfix.tar.gz | |
curl -LO ftp://ftp.math.s.chiba-u.ac.jp/emacs/emacs-$patch_version.tar.gz | |
curl -LO https://gist.githubusercontent.com/takaxp/fc5ae440b3279679dc854e5b9adbfe08/raw/3178aa953b840da47e55f2cef32ffd7a71e1cf0b/emacs-mac-custom.patch | |
#curl -LO https://gist.githubusercontent.com/takaxp/fc5ae440b3279679dc854e5b9adbfe08/raw/651a2da9dbb273f8e18841197b5cd9fb5bf96992/emacs-mac-custom.patch | |
# curl -LO https://gist.githubusercontent.com/takaxp/d2137e0add397440229f3b309643ec3a/raw/68b6266fc0af96d34924d1e4d98993594809596d/my-emacs-mac.patch | |
if [ ! -f emacs-$version$version_postfix.tar.gz ]; then | |
echo "emacs-$version$version_postfix.tar.gz missing." | |
exit | |
fi | |
tar zxvf emacs-$version$version_postfix.tar.gz | |
if [ ! -f emacs-$patch_version.tar.gz ]; then | |
echo "emacs-$patch_version.tar.gz EMP patch messing." | |
exit | |
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 --with-modules --with-rsvg --with-imagemagick --enable-mac-app=$installprefix --prefix=$installprefix | |
sleep 5 | |
make bootstrap -j1 | |
make install -j1 | |
# self-containing | |
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 | |
mv $installprefix/libexec/emacs/$version/$compver $app_dir/../MacOS/libexec | |
rm -rf $installprefix/libexec | |
cd $installprefix | |
open . | |
echo '--------' | |
echo 'enjoy!' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment