Skip to content

Instantly share code, notes, and snippets.

@henry0312
Created August 27, 2012 10:07
Show Gist options
  • Save henry0312/3487115 to your computer and use it in GitHub Desktop.
Save henry0312/3487115 to your computer and use it in GitHub Desktop.
Build Emacs 24.2 on OS X 10.8.1
#!/bin/sh
# 初期設定
EMACS_VER=24.2
WORK_DIR=$HOME/Builds/Emacs
BUILD_DIR=$WORK_DIR/build
PATCH_DIR=$WORK_DIR/patch
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export CC='/usr/bin/clang'
export CXX='/usr/bin/clang++'
# ディレクトリ移動
cd $WORK_DIR
# ソースコードのダウンロード
if [ ! -d src ] ; then
mkdir src
curl -o src/emacs-${EMACS_VER}.tar.bz2 -O http://ftp.gnu.org/pub/gnu/emacs/emacs-${EMACS_VER}.tar.bz2
# mirror
# curl -o src/emacs-${EMACS_VER}.tar.bz2 -O http://ftp.gnu.org/pub/gnu/emacs/emacs-${EMACS_VER}.tar.bz2
elif [ ! -f src/emacs-${EMACS_VER}.tar.bz2 ] ; then
curl -o src/emacs-${EMACS_VER}.tar.bz2 -O http://ftp.gnu.org/pub/gnu/emacs/emacs-${EMACS_VER}.tar.bz2
# mirror
# curl -o src/emacs-${EMACS_VER}.tar.bz2 -O http://ftp.gnu.org/pub/gnu/emacs/emacs-${EMACS_VER}.tar.bz2
fi
# ソースコードの展開
if [ -d $WORK_DIR/emacs-${EMACS_VER} ] ; then
rm -fr $WORK_DIR/emacs-${EMACS_VER}
fi
tar xjf src/emacs-${EMACS_VER}.tar.bz2
# ビルドディレクトリの作成
if [ -d $BUILD_DIR ] ; then
rm -fr $BUILD_DIR
fi
mkdir $BUILD_DIR
# パッチのDL
## ディレクトリ作成
if [ ! -d $PATCH_DIR ] ; then
mkdir $PATCH_DIR
fi
## emacs-24.1-lion-fullscreen.patch
if [ ! -f $PATCH_DIR/emacs-24.1-lion-fullscreen.patch ] ; then
cd $PATCH_DIR
curl -L -O https://gist.github.com/raw/2862477/8162639df106036f3ab5e2f1e83a7d1500f17a1d/emacs-24.1-lion-fullscreen.patch
fi
## IMEパッチ
if [ ! -d $PATCH_DIR/inline_patch -o ! -f $PATCH_DIR/inline_patch/emacs-inline.patch ] ; then
cd $PATCH_DIR
svn co http://svn.sourceforge.jp/svnroot/macemacsjp/inline_patch/trunk inline_patch
else
cd $PATCH_DIR/inline_patch
svn up
fi
# パッチを当てる
cd $WORK_DIR/emacs-${EMACS_VER}
patch -p0 < $PATCH_DIR/emacs-24.1-lion-fullscreen.patch
patch -p0 < $PATCH_DIR/inline_patch/emacs-inline.patch
patch -p1 < $PATCH_DIR/atok25.diff
# ビルド
cd $BUILD_DIR
$WORK_DIR/emacs-${EMACS_VER}/configure --with-ns --without-x
make bootstrap -j4
make install
# アプリケーションディレクトリへコピー
#cp -r ./nextstep/Emacs.app /Applications
cp -r ./nextstep/Emacs.app /Applications/Emacs${EMACS_VER}.app
# Clean
cd $WORK_DIR
rm -fr emacs-${EMACS_VER}
rm -fr $BUILD_DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment