Avoid leaving garbage on screen when using 'raise' display property
[emacs.git] / nt / INSTALL.W64
bloba12b7fc17737af217c89ac9296bfa658df587d8e
1           Building and Installing Emacs on 64-bit MS-Windows
2                       using MSYS2 and MinGW-w64
4   Copyright (c) 2015-2017 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 \
68   mingw-w64-x86_64-zlib
70 The packages include the base developer tools (autoconf, automake, grep, make,
71 etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries, an
72 XML library, the GnuTLS (transport layer security) library, and zlib for
73 decompressing text.  Only the first three packages are required (base-devel,
74 toolchain, xpm-nox); the rest are optional.  You can select only part of the
75 libraries if you don't need them all.
77 You now have a complete build environment for Emacs.
79 * Install Git (optional) and disable autocrlf
81 If you're going to be building the development version of Emacs from the Git
82 repository, and you don't already have Git on your system, you can install it
83 in your MSYS2 environment with:
85   pacman -S git
87 The autocrlf feature of Git may interfere with the configure file, so it is
88 best to disable this feature by running the command:
90   git config core.autocrlf false
92 * Get the Emacs source code
94 Now you can either get an existing release version of the Emacs source code
95 from the GNU ftp site, or get the more current version and history from the
96 Git repository.
98 You can always find the most recent information on these sources from the GNU
99 Savannah Emacs site, https://savannah.gnu.org/projects/emacs.
101 ** From the FTP site
103 The Emacs ftp site is located at http://ftp.gnu.org/gnu/emacs/ - download the
104 version you want to build and put the file into a location like C:\emacs\,
105 then uncompress it with tar.  This will put the Emacs source into a folder like
106 C:\emacs\emacs-24.5:
108   cd /c/emacs
109   tar xJf emacs-24.5.tar.xz
111 ** From the Git repository
113 To download the Git repository, do something like the following -- this will
114 put the Emacs source into C:\emacs\emacs-25:
116   mkdir /c/emacs
117   cd /c/emacs
118   git clone git://git.sv.gnu.org/emacs.git emacs-25
120 (We recommend using the command shown on Savannah Emacs project page.)
122 * Build Emacs
124 Now you're ready to build and install Emacs with autogen, configure, make,
125 and make install.
127 First we need to switch to the MinGW-w64 environment.  Exit the MSYS2 BASH
128 console and run mingw64_shell.bat in the C:\msys64 folder, then cd back to
129 your Emacs source directory, e.g.:
131   cd /c/emacs/emacs-25
133 ** Run autogen
135 If you are building the development sources, run autogen to generate the
136 configure script (note: this step is not necessary if you are using a
137 release source tarball, as the configure file is included):
139   ./autogen.sh
141 ** Run configure
143 Now you can run configure, which will build the various Makefiles -- note
144 that the example given here is just a simple one - for more information
145 on the options available please see the INSTALL file in this directory.
147 The '--prefix' option specifies a location for the resulting binary files,
148 which 'make install' will use - in this example we set it to C:\emacs\emacs-25.
149 If a prefix is not specified the files will be put in the standard Unix
150 directories located in your C:\msys64 directory, but this is not recommended.
152 Note also that we need to disable Imagemagick because Emacs does not yet
153 support it on Windows.
155   PKG_CONFIG_PATH=/mingw64/lib/pkgconfig \
156   ./configure --prefix=/c/emacs/emacs-25 --without-imagemagick
158 ** Run make
160 This will compile Emacs and build the executables, putting them in the src
161 directory:
163   make
165 To speed up the process, you can try running
167   make -jN
169 where N is the number of cores in your system -- if your MSYS2 make supports
170 parallel execution it will run significantly faster.
172 ** Run make install
174 Now you can run "make install", which will copy the executable and
175 other files to the location specified in the configure step. This will
176 create the bin, libexec, share, and var directories:
178   make install
180 You can also say
182   make install prefix=/c/somewhere
184 to install them somewhere else.
186 * Test Emacs
188 To test it out, run
190   ./bin/runemacs.exe -Q
192 and if all went well, you will have a new 64-bit version of Emacs.
194 * Make a shortcut
196 To make a shortcut to run the new Emacs, right click on the location where you
197 want to put it, e.g. the Desktop, select New / Shortcut, then select
198 runemacs.exe in the bin folder of the new Emacs, and give it a name.
200 You can set any command line options by right clicking on the resulting
201 shortcut, select Properties, then add any options to the Target command,
202 e.g. --debug-init.
204 * Credits
206 Thanks to Chris Zheng for the original build outline as used by the
207 emacsbinw64 project, located at:
209   https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/
211 * License
213 This file is part of GNU Emacs.
215 GNU Emacs is free software: you can redistribute it and/or modify
216 it under the terms of the GNU General Public License as published by
217 the Free Software Foundation, either version 3 of the License, or
218 (at your option) any later version.
220 GNU Emacs is distributed in the hope that it will be useful,
221 but WITHOUT ANY WARRANTY; without even the implied warranty of
222 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
223 GNU General Public License for more details.
225 You should have received a copy of the GNU General Public License
226 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.