Emacs 25.1

Emacs 25.1 was officially released on September 17th, 2016. The excellent MSYS2 subsystem and the open source gcc compiler make it super-easy to build binaries on/for Windows (7, 8, 10). In three easy steps from source to binaries:

1: Install and prepare the MSYS2 subsytem

Download and run the installer at http://repo.msys2.org/distrib/msys2-x86_64-latest.exe After installing, run MSYS2 64bit which drops you in a Bash shell. Update all packages using the following command:

pacman -Syuu

Sometimes updates of the runtime/filesystem can cause update errors. This is no cause for panic - kill and restart the terminal. For building 64-bit Windows binaries, always use mingw64.exe to start the terminal.

Install all packages necessary for building:

pacman -Sy --noconfirm base-devel git \
mingw-w64-x86_64-{giflib,gnutls,jbigkit,lib{jpeg-turbo,png,rsvg,tiff,xml2},toolchain,xpm-nox}

2: Clone the Emacs source

To simplify building, you can define the environment variables BUILDDIR (where the binaries are built), INSTALLDIR (where the binaries will be installed to), and SOURCEDIR (where the source lives, the git repository). Note that since you're in the MSYS2 subsystem, paths are Unix-style, using forward slashes. This command creates SOURCEDIR if it doesn't exist yet, clones the repository in SOURCEDIR , and runs the autogen.sh script to create a configure script.

 SOURCEDIR=c:/var/git/emacs && mkdir -p $SOURCEDIR && cd $SOURCEDIR &&
 git clone git://git.savannah.gnu.org/emacs.git . --depth=1 &&
./autogen.sh

3: Update, build and install Emacs

This updates the repository, empties and/or creates BUILDDIR , and runs make to build a binary. Afterwards it installs a stripped version of Emacs to INSTALLDIR .

SOURCEDIR=c:/var/git/emacs INSTALLDIR=c:/programs/emacs \
BUILDDIR=t:/emacs && pushd $SOURCEDIR && git reset --hard HEAD &&
git fetch && git checkout origin/master && rm -rf $BUILDDIR &>/dev/null
mkdir -p $BUILDDIR; pushd $BUILDDIR && $SOURCEDIR/configure && make &&
make install-strip prefix=$INSTALLDIR

And listo! After having installed MSYS2, only step 3 needs to be repeated to update the binary to the latest git version.

Optional: copy necessary libraries

To run Emacs on a system without MSYS2, one needs to copy a number of libraries to the installation directory.

INSTALLDIR=c:/programs/emacs cp
/mingw64/bin/{zlib\*,lib{winpthread-\*,Xpm-noX\*,gomp-\*,gcc\_s\_seh-\*,glib-\*,intl-\*,iconv-\*,gobject-\*,ffi-\*,gio-\*,gmodule-\*,freetype-\*,pixman-\*,png\*,expat-\*,harfbuzz-\*,gnutls-\*,gnutlsxx-\*,tiff-\*,tiffxx-\*,jpeg-\*,gif-\*,bz2-\*,jbig-\*,gmp-\*,hogweed-\*,nettle-\*,p11-kit-\*,tasn1-\*}}.dll
$INSTALLDIR/bin

Comments

comments powered by Disqus