Skip to content

Instantly share code, notes, and snippets.

@nsolsen
Last active December 10, 2015 12:18
Show Gist options
  • Save nsolsen/4432853 to your computer and use it in GitHub Desktop.
Save nsolsen/4432853 to your computer and use it in GitHub Desktop.
Build Gnu Emacs distribution on Ubuntu
#!/bin/sh
# Pre-requisites:
#
# wget http://ftp.gnu.org/pub/gnu/emacs/emacs-24.2.tar.gz
# sudo apt-get install build-essential xorg-dev libgtk-2.0-dev libjpeg-dev libpng12-dev libgif-dev libtiff4-dev libncurses5-dev
#
REQUIRED_PACKAGES="build-essential xorg-dev libgtk-2.0-dev libjpeg-dev libpng12-dev libgif-dev libtiff4-dev libncurses5-dev"
DIST_VERSION=$1
DIST_FILE=$1.tar.gz
BUILD_DIR=build-$1
missing_packages=0
for i in $REQUIRED_PACKAGES
do
dpkg -s $i >/dev/null 2>/dev/null
if [ $? != 0 ]
then
echo Missing required package: $i
missing_packages=1
fi
done
if [ $missing_packages = 1 ]
then
echo One or more prerequisute packages are missing.
echo Please run: sudo apt-get install $REQUIRED_PACKAGES
exit 0
fi
if [ "$DIST_VERSION" = "" ] || [ ! -f $DIST_FILE ]
then
echo "Please specify an emacs distribution version for which a corresponding .tar.gz file exists."
exit 1
fi
echo Unpacking and building $DIST_VERSION
rm -rf $BUILD_DIR
mkdir $BUILD_DIR
cd $BUILD_DIR
tar xzf ../$DIST_FILE
cd $DIST_VERSION
./configure --with-x-toolkit=gtk
make
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment