Fix bug in --eval reply message from server
[emacs.git] / nt / INSTALL.W64
blobe109c6f0f234a127b13f0dc6147c9bab5d444be5
1           Building and Installing Emacs on 64-bit MS-Windows
2                       using MSYS2 and MinGW-w64
4   Copyright (c) 2015-2016 Free Software Foundation, Inc.
5   See the end of the file for license conditions.
7 This document describes how to compile a 64-bit GNU Emacs using MSYS2
8 and MinGW-w64.  For instructions for building a 32-bit Emacs using
9 MSYS and MinGW, see the file INSTALL in this directory.
11 Do not use this recipe with Cygwin. For building on Cygwin, use the normal
12 installation instructions in ../INSTALL.
14 * Requirements
16 The total space required is 3GB: 1.8GB for MSYS2 / MinGW-w64 and 1.2GB for
17 Emacs with the full repository, or less if you're using a release tarball.
19 * Set up the MinGW-w64 / MSYS2 build environment
21 MinGW-w64 provides a complete runtime for projects built with GCC for 64-bit
22 Windows -- it's located at http://mingw-w64.org/.
24 MSYS2 is a Cygwin-derived software distribution for Windows which provides
25 build tools for MinGW-w64 -- see http://msys2.github.io/.
27 ** Download and install MinGW-w64 and MSYS2
29 You can download the x86_64 version of MSYS2 (i.e. msys2-x86_64-<date>.exe)
30 from
32   https://sourceforge.net/projects/msys2/files/Base/x86_64
34 Run this file to install MSYS2 in your preferred directory, e.g. the default
35 C:\msys64 -- this will install MinGW-w64 also.  Note that directory names
36 containing spaces may cause problems.
38 Then you'll need to add the following directories to your Windows PATH
39 environment variable:
41   c:\msys64\usr\bin;c:\msys64\mingw64\bin
43 you can do this through Control Panel / System and Security / System /
44 Advanced system settings / Environment Variables / Edit path.
46 Adding these directories to your PATH tells Emacs where to find the DLLs it
47 needs to run, and some optional commands like grep and find.  These commands
48 will also be available at the Windows console.
50 ** Download and install the necessary packages
52 Run msys2_shell.bat in your MSYS2 directory and you will see a BASH window
53 opened.
55 In the BASH prompt, use the following command to install the necessary
56 packages (you can copy and paste it into the shell with Shift + Insert):
58   pacman -S base-devel \
59   mingw-w64-x86_64-toolchain \
60   mingw-w64-x86_64-xpm-nox \
61   mingw-w64-x86_64-libtiff \
62   mingw-w64-x86_64-giflib \
63   mingw-w64-x86_64-libpng \
64   mingw-w64-x86_64-libjpeg-turbo \
65   mingw-w64-x86_64-librsvg \
66   mingw-w64-x86_64-libxml2 \
67   mingw-w64-x86_64-gnutls
69 The packages include the base developer tools (autoconf, automake, grep, make,
70 etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries, an
71 XML library, and the GnuTLS (transport layer security) library.  Only the
72 first three packages are required (base-devel, toolchain, xpm-nox); the rest
73 are optional.
75 You now have a complete build environment for Emacs.
77 * Install Git (optional) and disable autocrlf
79 If you're going to be building the development version of Emacs from the Git
80 repository, and you don't already have Git on your system, you can install it
81 in your MSYS2 environment with:
83   pacman -S git
85 The autocrlf feature of Git may interfere with the configure file, so it is
86 best to disable this feature by running the command:
88   git config core.autocrlf false
90 * Get the Emacs source code
92 Now you can either get an existing release version of the Emacs source code
93 from the GNU ftp site, or get the more current version and history from the
94 Git repository.
96 You can always find the most recent information on these sources from the GNU
97 Savannah Emacs site, https://savannah.gnu.org/projects/emacs.
99 ** From the FTP site
101 The Emacs ftp site is located at http://ftp.gnu.org/gnu/emacs/ - download the
102 version you want to build and put the file into a location like C:\emacs\,
103 then uncompress it with tar.  This will put the Emacs source into a folder like
104 C:\emacs\emacs-24.5:
106   cd /c/emacs
107   tar xJf emacs-24.5.tar.xz
109 ** From the Git repository
111 To download the Git repository, do something like the following -- this will
112 put the Emacs source into C:\emacs\emacs-25:
114   mkdir /c/emacs
115   cd /c/emacs
116   git clone git://git.sv.gnu.org/emacs.git emacs-25
118 (We recommend using the command shown on Savannah Emacs project page.)
120 * Build Emacs
122 Now you're ready to build and install Emacs with autogen, configure, make,
123 and make install.
125 First we need to switch to the MinGW-w64 environment.  Exit the MSYS2 BASH
126 console and run mingw64_shell.bat in the C:\msys64 folder, then cd back to
127 your Emacs source directory, e.g.:
129   cd /c/emacs/emacs-25
131 ** Run autogen
133 If you are building the development sources, run autogen to generate the
134 configure script (note: this step is not necessary if you are using a
135 release source tarball, as the configure file is included):
137   ./autogen.sh
139 ** Run configure
141 Now you can run configure, which will build the various Makefiles -- note
142 that the example given here is just a simple one - for more information
143 on the options available please see the INSTALL file in this directory.
145 The '--prefix' option specifies a location for the resulting binary files,
146 which 'make install' will use - in this example we set it to C:\emacs\emacs-25.
147 If a prefix is not specified the files will be put in the standard Unix
148 directories located in your C:\msys64 directory, but this is not recommended.
150 Note also that we need to disable Imagemagick because Emacs does not yet
151 support it on Windows.
153   PKG_CONFIG_PATH=/mingw64/lib/pkgconfig \
154   ./configure --prefix=/c/emacs/emacs-25 --without-imagemagick
156 ** Run make
158 This will compile Emacs and build the executables, putting them in the src
159 directory:
161   make
163 To speed up the process, you can try running
165   make -jN
167 where N is the number of cores in your system -- if your MSYS2 make supports
168 parallel execution it will run significantly faster.
170 ** Run make install
172 Now you can run "make install", which will copy the executable and
173 other files to the location specified in the configure step. This will
174 create the bin, libexec, share, and var directories:
176   make install
178 You can also say
180   make install prefix=/c/somewhere
182 to install them somewhere else.
184 * Test Emacs
186 To test it out, run
188   ./bin/runemacs.exe -Q
190 and if all went well, you will have a new 64-bit version of Emacs.
192 * Make a shortcut
194 To make a shortcut to run the new Emacs, right click on the location where you
195 want to put it, e.g. the Desktop, select New / Shortcut, then select
196 runemacs.exe in the bin folder of the new Emacs, and give it a name.
198 You can set any command line options by right clicking on the resulting
199 shortcut, select Properties, then add any options to the Target command,
200 e.g. --debug-init.
202 * Credits
204 Thanks to Chris Zheng for the original build outline as used by the
205 emacsbinw64 project, located at:
207   https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/
209 * License
211 This file is part of GNU Emacs.
213 GNU Emacs is free software: you can redistribute it and/or modify
214 it under the terms of the GNU General Public License as published by
215 the Free Software Foundation, either version 3 of the License, or
216 (at your option) any later version.
218 GNU Emacs is distributed in the hope that it will be useful,
219 but WITHOUT ANY WARRANTY; without even the implied warranty of
220 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
221 GNU General Public License for more details.
223 You should have received a copy of the GNU General Public License
224 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.