all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob b28540d7447158ac57be3b8dca16a98de493bb79 11281 bytes (raw)
name: nt/INSTALL.W64 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
 
	  Building and Installing Emacs on 64-bit MS-Windows
		      using MSYS2 and MinGW-w64

  Copyright (c) 2015-2017 Free Software Foundation, Inc.
  See the end of the file for license conditions.

This document describes how to compile a 64-bit GNU Emacs using MSYS2
and MinGW-w64.  For instructions for building a 32-bit Emacs using
MSYS and MinGW, see the file INSTALL in this directory.

Do not use this recipe with Cygwin. For building on Cygwin, use the normal
installation instructions in ../INSTALL.

* Requirements

The total space required is 3GB: 1.8GB for MSYS2 / MinGW-w64 and 1.2GB for
Emacs with the full repository, or less if you're using a release tarball.

* Set up the MinGW-w64 / MSYS2 build environment

MinGW-w64 provides a complete runtime for projects built with GCC for 64-bit
Windows -- it's located at http://mingw-w64.org/.

MSYS2 is a Cygwin-derived software distribution for Windows which provides
build tools for MinGW-w64 -- see http://msys2.github.io/.

** Download and install MinGW-w64 and MSYS2

You can download the x86_64 version of MSYS2 (i.e. msys2-x86_64-<date>.exe)
from

	https://sourceforge.net/projects/msys2/files/Base/x86_64

Run this file to install MSYS2 in your preferred directory, e.g. the default
C:\msys64 -- this will install MinGW-w64 also.  Note that directory names
containing spaces may cause problems.

In the sequel we denote by c:\MSYS\INSTALL\DIR\msys64 the
directory where MSYS2 is installed, e.g. C:\msys64 by default.

* Configure your MSWindows PATH variable

Then you'll need to add the following directories to your Windows PATH
environment variable:

  c:\MSYS\INSTALL\DIR\msys64\usr\bin;c:\MSYS\INSTALL\DIR\msys64\mingw64\bin

where c:\MSYS\INSTALL\DIR\msys64 depends on your MSYS2 installation,
and is c:\msys64 by default.

You can do this through Control Panel / System and Security / System /
Advanced system settings / Environment Variables / Edit path.

Adding these directories to your PATH tells Emacs where to find the DLLs it
needs to run, and some optional commands like grep and find.  These commands
will also be available at the Windows console.

Concerning the find command see also the last step about configuring
your init file to get an MSWindows find port.

** Download and install the necessary packages

Run msys2_shell.bat in your MSYS2 directory and you will see a BASH window
opened.

In the BASH prompt, use the following command to install the necessary
packages (you can copy and paste it into the shell with Shift + Insert):

	for w in msys/msys2-launcher-git \
	  msys/m4 \
	  msys/autoconf \
	  msys/grep \
	  msys/findutils \
	  mingw64/mingw-w64-x86_64-pkg-config \
	  mingw64/mingw-w64-x86_64-make \
	  mingw64/mingw-w64-x86_64-toolchain \
	  mingw64/mingw-w64-x86_64-xpm-nox \
	  mingw64/mingw-w64-x86_64-libtiff \
	  mingw64/mingw-w64-x86_64-giflib \
	  mingw64/mingw-w64-x86_64-libpng \
	  mingw64/mingw-w64-x86_64-libjpeg-turbo \
	  mingw64/mingw-w64-x86_64-librsvg \
	  mingw64/mingw-w64-x86_64-liblcms2 \
	  mingw64/mingw-w64-x86_64-libxml2 \
	  mingw64/mingw-w64-x86_64-gnutls \
	  mingw64/mingw-w64-x86_64-zlib; do  pacman -S $w; done

Answer Y (for yes) to all questions when the package is not up to
date, and n (for no) otherwise.

The packages include the base developer tools (autoconf, grep, make,
etc.), the compiler toolchain (gcc, gdb, etc.), several image
libraries, an XML library, the GnuTLS (transport layer security)
library, and zlib for decompressing text.  Only the packages up to
xpm-nox are required; the rest are optional.  You can select only part
of the libraries if you don't need them all.

** Check your MSYS2 fstab file

make sure that your fstab file (c:\MSYS\INSTALL\DIR\msys64\etc\fstab)
file contains the following lines (starting a column 0 in the fstab
file):

	c:/MSYS/INSTALL/DIR/msys64/mingw64/bin /mingw64/bin ntfs binary,noacl 0 0
	c:/MSYS/INSTALL/DIR/msys64/mingw32/bin /mingw32/bin ntfs binary,noacl 0 0

Please note that only the first line is needed for 64bit compilation,
the second one is for a complete fstab file w.r.t. 32bit compilation.

If there is a space in c:\MSYS\INSTALL\DIR it shall be replaced by
\040. For instance, if MSYS is installed under "C:\Program
Files\msys64" there must be this line:


	C:/Program\040Files/msys64/mingw64/bin /mingw64/bin ntfs binary,noacl 0 0

Anyway, avoiding to have any space in the path is preferable.

** Configure your MSYS2 PATH variable for application running from an mingw64 console

When you launch the mingw64.exe console from the c:\MSYS\INSTALL\DIR\msys64, and type

	echo "$PATH"

You must have /mingw64/bin and /usr/bin in the paths list in this order.

Otherwise, you will need to exit the MINGW64 console and edit your
~/.bashrc file, where ~ denote
c:\MSYS\INSTALL\DIR\msys64\home\%USERNAME%, to have the correct PATH
variable from MSYS/MINGW32/MINGW64 consoles:

In this cas, please make sure that ~/.bashrc contains some statement
like:

	case x$MSYSTEM in
	    xMINGW64)
		PATH="/mingw64/bin:/usr/bin:$PATH"
	    ;;
	    xMINGW32)
		PATH="/mingw32/bin:/usr/bin:$PATH"
	    ;;
	    xMSYS)
		PATH="/usr/bin:$PATH"
	    ;;
	esac

Actually, for the Emacs build only the MINGW64 is useful. There could
other cases for MSYSTEM envvar equal to MSYS or to MINGW32.

You now have a complete build environment for Emacs.

* Install Git (optional) and disable autocrlf

If you're going to be building the development version of Emacs from the Git
repository, and you don't already have Git on your system, you can install it
in your MSYS2 environment with:

  pacman -S git

The autocrlf feature of Git may interfere with the configure file, so it is
best to disable this feature by running the command:

  git config core.autocrlf false

* Get the Emacs source code

Now you can either get an existing release version of the Emacs source code
from the GNU ftp site, or get the more current version and history from the
Git repository.

You can always find the most recent information on these sources from the GNU
Savannah Emacs site, https://savannah.gnu.org/projects/emacs.

** From the FTP site

The Emacs ftp site is located at https://ftp.gnu.org/gnu/emacs/ - download the
version you want to build and put the file into a location like C:\emacs\,
then uncompress it with tar.  This will put the Emacs source into a folder like
C:\emacs\emacs-24.5:

  cd /c/emacs
  tar xJf emacs-24.5.tar.xz

** From the Git repository

To download the Git repository, do something like the following -- this will
put the Emacs source into C:\emacs\emacs-26:

  mkdir /c/emacs
  cd /c/emacs
  git clone git://git.sv.gnu.org/emacs.git emacs-26

(We recommend using the command shown on Savannah Emacs project page.)

* Build Emacs

Now you're ready to build and install Emacs with autogen, configure, make,
and make install.

First we need to switch to the MinGW-w64 environment.  Exit the MSYS2
BASH console and run mingw64.exe in the C:\MSYS\INSTALL\DIR\msys64
folder, then cd back to your Emacs source directory, e.g.:

  cd /c/emacs/emacs-26

** Run autogen

If you are building the development sources, run autogen to generate the
configure script (note: this step is not necessary if you are using a
release source tarball, as the configure file is included):

  ./autogen.sh

** Run configure

Now you can run configure, which will build the various Makefiles -- note
that the example given here is just a simple one - for more information
on the options available please see the INSTALL file in this directory.

The '--prefix' option specifies a location for the resulting binary files,
which 'make install' will use - in this example we set it to C:\emacs\emacs-26.
If a prefix is not specified the files will be put in the standard Unix
directories located in your C:\msys64 directory, but this is not recommended.

Note also that we need to disable Imagemagick because Emacs does not yet
support it on Windows.

  PKG_CONFIG_PATH=/mingw64/lib/pkgconfig \
  ./configure --prefix=/c/emacs/emacs-26 --without-imagemagick

** Run make

This will compile Emacs and build the executables, putting them in the src
directory:

  make

To speed up the process, you can try running

  make -jN

where N is the number of cores in your system -- if your MSYS2 make supports
parallel execution it will run significantly faster.

** Run make install

Now you can run "make install", which will copy the executable and
other files to the location specified in the configure step. This will
create the bin, libexec, share, and var directories:

  make install

You can also say

  make install prefix=/c/somewhere

to install them somewhere else.

* Test Emacs

To test it out, run

  ./bin/runemacs.exe -Q

and if all went well, you will have a new 64-bit version of Emacs.

* Make a shortcut

To make a shortcut to run the new Emacs, right click on the location where you
want to put it, e.g. the Desktop, select New / Shortcut, then select
runemacs.exe in the bin folder of the new Emacs, and give it a name.

You can set any command line options by right clicking on the resulting
shortcut, select Properties, then add any options to the Target command,
e.g. --debug-init.

* Configure your init file for Emacs to get a findutils windows port

As far as find is concerned, at this stage you have configured the
MSWindows PATH envvar to have c:\MSYS\INSTALL\DIR\msys64\usr\bin in
it.

You should have done that in a way that
c:\MSYS\INSTALL\DIR\msys64\usr\bin is after C:\Windows\System32 in the
PATH, otherwise the MSYS2 find.exe will be used instead of the
MSWindows find.exe by other MSWindows application and this may cause
some problem in your MSWindows environment --- although nobody has
ever reported such a trouble.

As far as Emacs is concerned, the lasy way is to use the MSYS2 find
utility despit the PATH envvar by setting in your init file the
following:

	(setq grep-program "c:/MSYS/INSTALL/DIR/msys64/usr/bin/find.exe")

Actually, it is better to work a little bit more and use a MSWindows
port rather than the MSYS find. See why here
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=27393

For instance this port can be used.

https://sourceforge.net/projects/ezwinports/files/findutils-4.2.30-5-w64-bin.zip/download

Then add to your init file lines like these :

	(setq find-program "c:/PATH/TO/FIND/PORT/find.exe")

where "c:/PATH/TO/FIND/PORT/" is the place where you have installed
this find MSWindows port.

* Credits

Thanks to Chris Zheng for the original build outline as used by the
emacsbinw64 project, located at:

  https://sourceforge.net/p/emacsbinw64/wiki/Build%20guideline%20for%20MSYS2-MinGW-w64%20system/

* License

This file is part of GNU Emacs.

GNU Emacs is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.


debug log:

solving b28540d ...
found b28540d in https://yhetil.org/emacs/84h8uzwjqp.fsf@AigleRoyal/
found 4a93dc0 in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 4a93dc02c8be7244384ff178dbaabe7486e130a6	nt/INSTALL.W64

applying [1/1] https://yhetil.org/emacs/84h8uzwjqp.fsf@AigleRoyal/
diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64
index 4a93dc0..b28540d 100644

Checking patch nt/INSTALL.W64...
1:208: new blank line at EOF.
+
Applied patch nt/INSTALL.W64 cleanly.
warning: 1 line adds whitespace errors.

index at:
100644 b28540d7447158ac57be3b8dca16a98de493bb79	nt/INSTALL.W64

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.