Automating Emacs Build and Install from Source

A little while back I wrote up my notes on how to build and install Emacs from souce on Ubuntu.

I have now automated the task in the form of the crude script provided below. The script takes one parameter: gui. This parameter tells the build whether you intend to do a GUI or command line only build of Emacs. It also writes out some messages to a file called emacs-build.log ... Enjoy!

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
echo "Building @`date`" | tee -a ~/emacs-build.log
mkdir ~/emacs-src
cd ~/emacs-src

echo "Installing pre-requisites" | tee -a ~/emacs-build.log
apt-get -q -y install build-essential gcc git-core texinfo libncurses5-dev

if [ "$1" = gui ]; then
    echo "Installing GUI pre-requisites" | tee -a ~/emacs-build.log
    apt-get -q -y install libgtk2.0-dev libtiff4-dev libgif-dev libjpeg62-dev libpng12-dev libxpm-dev
fi

echo "Cloning Emacs Git Repo" | tee -a ~/emacs-build.log
git clone git://git.savannah.gnu.org/emacs.git

cd ./emacs

echo "Configuring build" | tee -a ~/emacs-build.log
if [ "$1" = gui ]; then
    ./configure
else
    ./configure --without-x
fi

echo "Building source code" | tee -a ~/emacs-build.log
make
echo "Installing emacs" | tee -a ~/emacs-build.log
make install
echo "Clean up" | tee -a ~/emacs-build.log
cd ~/
rm -rf ~/emacs-src
echo "All Done!" | tee -a ~/emacs-build.log

Comments

Comments powered by Disqus