---------------------------------------------------------------------- Personal recipe for building GNU Emacs on MS-Windows platforms. By Dani Moncayo. ---------------------------------------------------------------------- 0. Prerequisites ---------------------------------------------------------------------- * Operating system: MS-Windows XP or higher. I've actually tested this on: - Windows XP SP3. - Windows 7 (32 and 64-bit). * Development environment: MinGW (www.mingw.org). Once MinGW is installed, make sure that the "bin" and "msys\1.0\bin" subdirectories of your installation are included in your PATH environment variable. Install also the "msys-base" package: >> mingw-get install msys-base This package provides you with a set of tools needed for the build process. Update the MinGW packages: >> mingw-get update >> mingw-get upgrade * Internet conectivity (optional). Needed if you don't have the (latest) source code in your machine yet. * Version control system: Bazaar (bazaar.canonical.com) (optional). Needed if you want to get the latest source code directly from a bzr branch. Make sure that the top directory of your Bazaar installation is included in your PATH environment variable. * Compression tool: 7-zip (http://www.7-zip.org/) (optional). Needed if you want to generate a binary distribution automatically. Make sure that the top directory of your 7-zip installation is included in your PATH environment variable. * Libraries (optional). Emacs has some optional features that depend on some libraries. If you want these features, you need Windows ports of such libraries: - giflib: http://gnuwin32.sourceforge.net/ - gnutls: http://sourceforge.net/projects/ezwinports/files/ - jpeg: http://gnuwin32.sourceforge.net/ - libiconv: ?? - libpng: http://gnuwin32.sourceforge.net/ - libxml: http://sourceforge.net/projects/ezwinports/files/ - libxpm: http://cgit.freedesktop.org/xorg/lib/libXpm - tiff: ?? - zlib: http://zlib.net/ 1. Get the source code tree ---------------------------------------------------------------------- If you want a released version, download the corresponding file from the GNU project (http://ftp.gnu.org/pub/gnu/emacs/) and extract it. If you want the latest version of a branch (e.g. "trunk"): * If you don't still have the branch, create it: - Change to the directory where you want to create the branch. - Run: >> bzr branch bzr://bzr.savannah.gnu.org/emacs/ * If you already have the branch, update it: - Change to the branch directory. - Run: >> bzr pull 2. Run the "configure" script ---------------------------------------------------------------------- This step can be omitted if you have a previous build and some files are unchanged (that includes makefile.w32-in files, nt/config.nt, and nt/configure.bat itself). Change to the "nt" subdirectory. For building without libraries, run: >> configure --with-gcc --no-opt --enable-checking --without-xpm --without-png --without-jpeg --without-tiff --without-gif For building with all the libraries, run: >> configure --with-gcc --no-opt --enable-checking --cflags -I../../libs/libxpm-3.5.8/include --cflags -I../../libs/libxpm-3.5.8/src --cflags -I../../libs/libpng-1.4.10 --cflags -I../../libs/zlib-1.2.6 --cflags -I../../libs/giflib-4.1.4-1/include --cflags -I../../libs/jpeg-6b-4/include --cflags -I../../libs/tiff-3.8.2-1/include --cflags -I../../libs/libxml2-2.7.8-w32-bin/include/libxml2 --cflags -I../../libs/gnutls-3.0.16/include --cflags -I../../libs/libiconv-1.14-2-mingw32-dev/include --distfiles ../../libs/libxpm-3.5.8/src/libXpm.dll Notes: * Change the library paths (after each -I) to suit your setup. * Use --no-opt for an unoptimized build (needed for debugging). * If you don't want to use some of the libraries described above, don't write the correspondig "-I" parameters. * If your version of GCC is 4.6.1, add this parameter: --cflags -fno-omit-frame-pointer 3. Run the makefile targets ---------------------------------------------------------------------- * If you have a previous build of emacs, you can take the quick way: >> mingw32-make >> cd ..\lisp >> mingw32-make bzr-update >> cd ..\nt >> mingw32-make >> mingw32-make info >> mingw32-make install * Else, you'll have to bootstrap from scratch: >> mingw32-make bootstrap >> mingw32-make info >> mingw32-make install For paralell buiding: >> mingw32-make -j 4 >> mingw32-make -j 4 XMFLAGS="-j 4" bootstrap The latter is for GNU Make versions < 3.82. 3. Generating a redistributable Emacs binary ---------------------------------------------------------------------- * Run the "dist" target (requires 7-zip installed and on PATH): >> cd nt >> mingw32-make dist ---------------------------------------------------------------------- Now you can take your binary distribution to any machine with a MS-Windows OS. Just uncompess the zip file in the directory you want.