From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Brian Burns Newsgroups: gmane.emacs.bugs Subject: bug#22240: Build instructions for 64-bit Windows? Date: Wed, 30 Dec 2015 01:08:38 -0600 Message-ID: References: <83ege9k3xa.fsf@gnu.org> <83d1tpdusw.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0122a59c71652d052818379b X-Trace: ger.gmane.org 1451459427 31216 80.91.229.3 (30 Dec 2015 07:10:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Dec 2015 07:10:27 +0000 (UTC) Cc: Chris Zheng , 22240@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 30 08:10:16 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aEAtj-0003c1-AW for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 08:10:15 +0100 Original-Received: from localhost ([::1]:51393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAti-0000d9-Gu for geb-bug-gnu-emacs@m.gmane.org; Wed, 30 Dec 2015 02:10:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50104) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAtb-0000a9-8q for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aEAtX-0007Sd-3B for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41700) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aEAtW-0007SS-VV for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aEAtW-00057Y-R5 for bug-gnu-emacs@gnu.org; Wed, 30 Dec 2015 02:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Brian Burns Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Dec 2015 07:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 22240 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 22240-submit@debbugs.gnu.org id=B22240.145145937019621 (code B ref 22240); Wed, 30 Dec 2015 07:10:02 +0000 Original-Received: (at 22240) by debbugs.gnu.org; 30 Dec 2015 07:09:30 +0000 Original-Received: from localhost ([127.0.0.1]:49300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEAsw-00056K-6n for submit@debbugs.gnu.org; Wed, 30 Dec 2015 02:09:29 -0500 Original-Received: from mail-ig0-f171.google.com ([209.85.213.171]:37948) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aEAst-000566-Ov for 22240@debbugs.gnu.org; Wed, 30 Dec 2015 02:09:25 -0500 Original-Received: by mail-ig0-f171.google.com with SMTP id mw1so47193991igb.1 for <22240@debbugs.gnu.org>; Tue, 29 Dec 2015 23:09:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ES2OUPMmrBStlIV7mgekHxI5IBwxrMOMFIzMk7LrL78=; b=bJ3DZd9EC/q6HeDD307V7kjoAyoe+EOIgelVj01SHY+RBFMo8vLcvCqE+1ISS9PMat 9cQXjZfIhY/XS4glk5ff+GDx5iLa6JmNva6NNLHUgIZ/mzcF8/ysoKPQSOlIsBLngjdQ apixd62WjU19BpjWwc2OfLKMk1ul98I/9hUd6ci63w90CnR+zMV5FJKOCkOWDoqYx7He G+tJm7EwJR4KRpf/3/m2hnEsZWm/Z1bULoNEwcrLOeGIQYmXTIZd/t90A8pfSFxiKJcp yWWoYD/a0PhUd8BquMwu6pw//KwE/HUu7QwBGf0CiPv9Y6uIce0FX5AWTlg94auy7qiz 26+w== X-Received: by 10.50.79.234 with SMTP id m10mr10039199igx.23.1451459358055; Tue, 29 Dec 2015 23:09:18 -0800 (PST) Original-Received: by 10.50.227.173 with HTTP; Tue, 29 Dec 2015 23:08:38 -0800 (PST) In-Reply-To: <83d1tpdusw.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:111009 Archived-At: --089e0122a59c71652d052818379b Content-Type: text/plain; charset=UTF-8 Thanks for the feedback - the updated file is included at the end and at https://gist.github.com/bburns/43c9f170361aecee3b71 - Chris added a few comments there. >> I tried running configure without the '--host=x86_64-w64-mingw32' etc switches >> but got an error: >> configure: error: Emacs does not support 'x86_64-pc-msys' systems. This turned out to be due to not being in the right environment - I added the step to switch to the MinGW-w64 environment and now it works without specifying the --host, etc. > Sorry, I don't understand: this _is_ INSTALL, isn't it? And the > current INSTALL does include a couple of examples. What am I missing? At the moment, this is a separate file - e.g. it could be nt/INSTALL64, though if we wanted we could merge them. When I tried using the nt/INSTALL instructions last year I was mostly confused about the --prefix option - I didn't understand what was meant by build inside or outside the source tree, and the example given, /d/usr, was a bit foreign to me as a place to store programs, so Chris's example was easier to follow. I tried to keep these instructions simple also, but referred the user to the nt/INSTALL file for more information in a couple of places. >> I think this was in part because MSYS2 doesn't add its folders to the PATH, and >> if you use the PATH variable there might be both 32-bit and 64-bit DLLs on it, > But that's a problem MSYS2 and MinGW64 should have solved already, > right? IOW, it's not something specific to Emacs. Okay, straightened that out a bit, now it says 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. > I indeed think that the instructions should tell how to create a > desktop shortcut for running Emacs. > I would suggest removing this time information Okay, added a section for making a shortcut, and removed the time info. > I guess you didn't use "make -j8" or some such. That's a good option to include - I added it to the make section. Thanks again for your help - Brian ------------ Building and Installing Emacs on 64-bit MS-Windows using MSYS2 and MinGW-w64 Copyright (c) 2015 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 more detailed information on the build process, and instructions for building a 32-bit Emacs using MSYS and MinGW, see the INSTALL document 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-.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. Then you'll need to add the following directories to your Windows PATH environment variable - c:\msys64\usr\bin;c:\msys64\mingw64\bin 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. ** 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): pacman -S base-devel \ mingw-w64-x86_64-toolchain \ mingw-w64-x86_64-xpm-nox \ mingw-w64-x86_64-libtiff \ mingw-w64-x86_64-giflib \ mingw-w64-x86_64-libpng \ mingw-w64-x86_64-libjpeg-turbo \ mingw-w64-x86_64-librsvg \ mingw-w64-x86_64-libxml2 \ mingw-w64-x86_64-gnutls The packages include the base developer tools (autoconf, automake, grep, make, etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries, an xml library, and the GnuTLS (transport layer security) library. Only the first three packages are required (base-devel, toolchain, xpm-nox) - the rest are optional. 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 http://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 xf 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-25: mkdir /c/emacs cd /c/emacs git clone git://git.sv.gnu.org/emacs.git emacs-25 * 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_shell.bat in the C:\msys64 folder, then cd back to your Emacs source directory, e.g.: cd /c/emacs/emacs-25 ** Run autogen 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 nt/INSTALL file. 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-25. 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-25 \ --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. * 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 . On Tue, Dec 29, 2015 at 11:33 AM, Eli Zaretskii wrote: > > From: Brian Burns > > Date: Tue, 29 Dec 2015 01:12:51 -0600 > > Cc: 22240@debbugs.gnu.org, Chris Zheng > > > > Okay thanks, here's a rough draft for the instructions > > Thanks. Allow me a few comments. > > > > the --host, --target, and --build switches should not be needed > > > > I tried running configure without the '--host=x86_64-w64-mingw32' etc > switches > > but got an error: > > > > configure: error: Emacs does not support 'x86_64-pc-msys' systems. > > If you think it should, please send a report to bug-gnu-emacs@gnu.org. > > Check 'etc/MACHINES' for recognized configuration names. > > > > but the MACHINES file says to see the nt/INSTALL document, which doesn't > cover > > the 64-bit options. So I left them in for the moment - I can file a bug > report > > for that also if needed. > > Please do file a bug report. Users shouldn't need to specify the host > for supported systems. > > It's also worthwhile to report this to MSYS2 developers, I think: that > string is not the canonical host description for MinGW64, it's for > building an MSYS program, which is not what is going on here. > > > Okay, I put the --prefix on the configure command, but I think it would > be good > > if the instructions included a simple example, and refer the user to the > > INSTALL > > instructions for more options > > Sorry, I don't understand: this _is_ INSTALL, isn't it? And the > current INSTALL does include a couple of examples. What am I missing? > > > > the 'cp' commands I don't understand at all: if PREFIX is chosen > > > correctly, the Emacs's bin/ directory and the MinGW64's bin/ > > > directory should be the same, so there's no need to copy; and > > > even if these two bin/ directories are different, the directory > > > with DLLs should be on PATH. this sounds like some workaround > > > for some misconfiguration, so we had better not repeated that. > > > > I think this was in part because MSYS2 doesn't add its folders to the > PATH, and > > if you use the PATH variable there might be both 32-bit and 64-bit DLLs > on it, > > But that's a problem MSYS2 and MinGW64 should have solved already, > right? IOW, it's not something specific to Emacs. > > > > The "Run" section doesn't belong in installation instructions. > > > > I think it might be good to include a simple Test section that just says > to > > run emacs with > > > > ./bin/runemacs.exe -Q > > > > to check that it works - mainly because a Windows user might tend to > launch > > Emacs from a shortcut on the desktop and might be unused to launching it > > from the console, so a simple line like that might be helpful. > > I indeed think that the instructions should tell how to create a > desktop shortcut for running Emacs. > > > Any corrections or additions are welcome - I'm a novice at building > things > > like this so am not sure what a more advanced user might want to see. > > See below for some more. > > > * Requirements > > > > The total time to download all tools and build Emacs is approximately 90 > > minutes on an Intel i3 processor, and 3GB of free space is required > (1.8GB for > > MSYS2 / MinGW-w64 and 1.2GB for Emacs with the full repository). > > > > Approximate times for the first pass through each step are given - to > time > > them yourself you can precede any BASH command with 'time'. > > I would suggest removing this time information: it is very > system-dependent, and can also change radically depending on your > network access speed. nt/INSTALL doesn't have such information, and I > don't recall anyone ever complaining. > > > Run this file to install MSYS2 in your preferred directory, e.g. the > default > > C:\msys64 - this will install MinGW-w64 also. Note that a path containing > > spaces may cause problems. > > GNU Coding Standards frown upon using "path" for anything except > PATH-style lists of directories. Please use "file names" or > "directory name" instead. > > Also, please keep 2 spaces between sentences, as we use the US English > conventions in GNU documentation. > > > 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): > > > > pacman -S base-devel \ > > mingw-w64-x86_64-toolchain \ > > mingw-w64-x86_64-xpm-nox \ > > mingw-w64-x86_64-libtiff \ > > mingw-w64-x86_64-giflib \ > > mingw-w64-x86_64-libpng \ > > mingw-w64-x86_64-libjpeg-turbo \ > > mingw-w64-x86_64-librsvg \ > > mingw-w64-x86_64-libxml2 \ > > mingw-w64-x86_64-gnutls > > > > The packages include the base developer tools (autoconf, automake, grep, > make, > > etc.), the compiler toolchain (gcc, gdb, etc.), several image libraries, > an > > xml library, and the GnuTLS (transport layer security) library. > > Here I would say that the user can omit some or all of the optional > libraries (all but the first 3), if they so wish. > > > * Install git (optional) and disable autocrlf [2 mins] > > This section should say that Git is only needed if the user wants to > build the development version. > > > Note that the --prefix option specifies a location for the resulting > binary > > files, which 'make install' will use - if a prefix is not specified the > files > > will be put in the standard MinGW-w64 directories. > > No, if --prefix is not specified, the files will be installed in the > standard _Unix_ directories, not standard MinGW-w64 directories. > > > ** Run make [30 mins] > > This takes 4 min on my system, for the full bootstrap (building a > release tarball is much faster). I guess you didn't use "make -j8" or > some such. See, this is why these times are not such a good idea. > > > ** Run make install [6 mins] > > Takes something like 2 min here. > > > Now you can run make install, which will copy the executable and other > files > > to the location specified in the configure step: > > > > make install > > One can also say > > make install prefix=/wherever > > to install in a different place. > > > * Emacs settings > > > > Local Variables: > > mode: org > > sentence-end-double-space: t > > End: > > This should be preceded by a Ctrl-L character, since Emacs looks for > the file-local variables in the last page of the file. > > Thanks. > --089e0122a59c71652d052818379b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Thanks for the feedback - the updated file is included at = the end and at
https://gist.github.com/bburns/43c9f170361aecee3b7= 1 - Chris added a
few comments there.

>> I tried runn= ing configure without the '--host=3Dx86_64-w64-mingw32' etc switche= s
>> but got an error:
>> configure: error: Emacs does no= t support 'x86_64-pc-msys' systems.

This turned out to be du= e to not being in the right environment - I added the
step to switch to = the MinGW-w64 environment and now it works without specifying
the --host= , etc.

> Sorry, I don't understand: this _is_ INSTALL, isn= 9;t it?=C2=A0 And the
> current INSTALL does include a couple of exam= ples.=C2=A0 What am I missing?

At the moment, this is a separate fil= e - e.g. it could be nt/INSTALL64, though
if we wanted we could merge th= em.

When I tried using the nt/INSTALL instructions last year I was m= ostly confused
about the --prefix option - I didn't understand what = was meant by build inside
or outside the source tree, and the example gi= ven, /d/usr, was a bit foreign to
me as a place to store programs, so Ch= ris's example was easier to follow. I
tried to keep these instructio= ns simple also, but referred the user to the
nt/INSTALL file for more in= formation in a couple of places.

>> I think this was in part b= ecause MSYS2 doesn't add its folders to the PATH, and
>> if yo= u use the PATH variable there might be both 32-bit and 64-bit DLLs on it,> But that's a problem MSYS2 and MinGW64 should have solved alread= y,
> right?=C2=A0 IOW, it's not something specific to Emacs.
<= br>Okay, straightened that out a bit, now it says

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

>= ; I indeed think that the instructions should tell how to create a
> = desktop shortcut for running Emacs.
> I would suggest removing this t= ime information

Okay, added a section for making a shortcut, and rem= oved the time info.

> I guess you didn't use "make -j8&= quot; or some such.=C2=A0

That's a good option to include - I a= dded it to the make section.

Thanks again for your help -
=C2=A0<= br>Brian

------------

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Building and Installing Emacs= on 64-bit MS-Windows
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 using MSYS2 and MinGW-w64

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 Copyright (c) 2015 Free Software Foundation, Inc.
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Se= e the end of the file for license conditions.

This document describe= s how to compile a 64-bit GNU Emacs using MSYS2 and
MinGW-w64.=C2=A0 For= more detailed information on the build process, and instructions
for bu= ilding a 32-bit Emacs using MSYS and MinGW, see the INSTALL document in
= this directory.

Do not use this recipe with Cygwin.=C2=A0 For buildi= ng on Cygwin, use the normal
installation instructions in ../INSTALL.

* Requirements

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


* Set up the= MinGW-w64 / MSYS2 build environment

=C2=A0 MinGW-w64 provides a com= plete runtime for projects built with gcc for 64-bit
=C2=A0 Windows - it= 's located at http://mingw-w64.org/.

=C2=A0 MSYS2 is a Cygwin-derived software distribution for Windo= ws which provides
=C2=A0 build tools for MinGW-w64 - see
http://msys2.github.io/.


** Download an= d install MinGW-w64 and MSYS2

=C2=A0 You can download the x86_64 ver= sion of MSYS2 (i.e. msys2-x86_64-<date>.exe)
=C2=A0 from

= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 https://sourceforge.net/projects/msys2/files/Base/= x86_64

=C2=A0 Run this file to install MSYS2 in your preferred d= irectory, e.g. the default
=C2=A0 C:\msys64 - this will install MinGW-w6= 4 also.=C2=A0 Note that directory names
=C2=A0 containing spaces may cau= se problems.

=C2=A0 Then you'll need to add the following direct= ories to your Windows PATH
=C2=A0 environment variable -

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 c:\msys64\usr\bin;c:\msys64\mingw64\bin

=C2= =A0 you can do this through Control Panel / System and Security / System /<= br>=C2=A0 Advanced system settings / Environment Variables / Edit path.
=
=C2=A0 Adding these directories to your PATH tells Emacs where to find = the DLLs it
=C2=A0 needs to run, and some optional commands like grep an= d find.=C2=A0 These commands
=C2=A0 will also be available at the Window= s console.


** Download and install the necessary packages
=C2=A0 Run msys2_shell.bat in your MSYS2 directory and you will see a BASH= window
=C2=A0 opened.

=C2=A0 In the BASH prompt, use the followi= ng command to install the necessary
=C2=A0 packages (you can copy and pa= ste it into the shell with Shift + Insert):

=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 pacman -S base-devel \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x= 86_64-toolchain \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x86_64-xpm-no= x \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x86_64-libtiff \
=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x86_64-giflib \
=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 mingw-w64-x86_64-libpng \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw= -w64-x86_64-libjpeg-turbo \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x86= _64-librsvg \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x86_64-libxml2 \<= br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mingw-w64-x86_64-gnutls

=C2=A0 The= packages include the base developer tools (autoconf, automake, grep, make,=
=C2=A0 etc.), the compiler toolchain (gcc, gdb, etc.), several image li= braries, an
=C2=A0 xml library, and the GnuTLS (transport layer security= ) library.=C2=A0 Only the
=C2=A0 first three packages are required (base= -devel, toolchain, xpm-nox) - the rest
=C2=A0 are optional.

=C2= =A0 You now have a complete build environment for Emacs.


* Insta= ll git (optional) and disable autocrlf

=C2=A0 If you're going to= be building the development version of Emacs from the git
=C2=A0 reposi= tory, and you don't already have git on your system, you can install it=
=C2=A0 in your MSYS2 environment with:

=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 pacman -S git

=C2=A0 The autocrlf feature of Git may interfer= e with the configure file, so it is
=C2=A0 best to disable this feature = by running the command:

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 git config co= re.autocrlf false


* Get the Emacs source code

=C2=A0 Now = you can either get an existing release version of the Emacs source code
= =C2=A0 from the GNU ftp site, or get the more current version and history f= rom the
=C2=A0 git repository.

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


** From the FTP site

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

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cd /c/em= acs
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 tar xf emacs-24.5.tar.xz


*= * From the git repository

=C2=A0 To download the git repository, do = something like the following - this will
=C2=A0 put the Emacs source int= o C:\emacs\emacs-25:

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 mkdir /c/emacs=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cd /c/emacs
=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 git clone git://git.sv.gnu.= org/emacs.git emacs-25


* Build Emacs

=C2=A0 Now you&#= 39;re ready to build and install Emacs with autogen, configure, make,
= =C2=A0 and make install.

=C2=A0 First we need to switch to the MinGW= -w64 environment - exit the MSYS2 BASH
=C2=A0 console and run mingw64_sh= ell.bat in the C:\msys64 folder, then cd back to
=C2=A0 your Emacs sourc= e directory, e.g.:

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cd /c/emacs/emacs-= 25


** Run autogen

=C2=A0 Run autogen to generate the conf= igure script (note: this step is not necessary
=C2=A0 if you are using a= release source tarball, as the configure file is included):

=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 ./autogen.sh


** Run configure

= =C2=A0 Now you can run configure, which will build the various Makefiles - = note that
=C2=A0 the example given here is just a simple one - for more = information on the
=C2=A0 options available please see the nt/INSTALL fi= le.

=C2=A0 The --prefix option specifies a location for the resultin= g binary files, which
=C2=A0 'make install' will use - in this e= xample we set it to C:\emacs\emacs-25. If a
=C2=A0 prefix is not specifi= ed the files will be put in the standard Unix directories
=C2=A0 located= in your C:\msys64 directory, but this is not recommended.

=C2=A0 No= te also that we need to disable Imagemagick because Emacs does not yet
= =C2=A0 support it on Windows.

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PKG_CON= FIG_PATH=3D/mingw64/lib/pkgconfig \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ./con= figure \
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 --prefix=3D/c/emacs/emacs-25 \=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 --without-imagemagick


** Run ma= ke

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

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= make

=C2=A0 To speed up the process, you can try running

=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 make -jN

=C2=A0 where N is the number of= cores in your system - if your MSYS2 make supports
=C2=A0 parallel exec= ution it will run significantly faster.


** Run make install
<= br>=C2=A0 Now you can run make install, which will copy the executable and = other files
=C2=A0 to the location specified in the configure step.=C2= =A0 This will create the bin,
=C2=A0 libexec, share, and var directories= :

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 make install

=C2=A0 You can = also say

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 make install prefix=3D/c/som= ewhere

=C2=A0 to install them somewhere else.


* Test Emac= s

=C2=A0 To test it out, run

=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 .= /bin/runemacs.exe -Q

=C2=A0 and if all went well, you will have a ne= w 64-bit version of Emacs.


* Make a shortcut

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

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


* Credits=

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

=C2=A0 https://sourceforge.net/p/emacsbinw64/wiki/Build%20gu= ideline%20for%20MSYS2-MinGW-w64%20system/


* License

= =C2=A0 This file is part of GNU Emacs.

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

=C2=A0 GNU Emacs is distributed in the hope that= it will be useful,
=C2=A0 but WITHOUT ANY WARRANTY; without even the im= plied warranty of
=C2=A0 MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR= POSE.=C2=A0 See the
=C2=A0 GNU General Public License for more details.<= br>
=C2=A0 You should have received a copy of the GNU General Public Lic= ense
=C2=A0 along with GNU Emacs.=C2=A0 If not, see <http://www.gnu.org/licenses/>.


<= /div>

On Tue, Dec = 29, 2015 at 11:33 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> From: Brian Burns <bburns.km@gmail.com>
> Date: Tue, 29 Dec 2015 01:12:51 -0600
> Cc: 22240@debbugs.gnu.org= , Chris Zheng <chriszheng99@gm= ail.com>
>
> Okay thanks, here's a rough draft for the instructions

Thanks.=C2=A0 Allow me a few comments.

> > the --host, --target, and --build switches should not be needed >
> I tried running configure without the '--host=3Dx86_64-w64-mingw32= ' etc switches
> but got an error:
>
> configure: error: Emacs does not support 'x86_64-pc-msys' syst= ems.
> If you think it should, please send a report to bug-gnu-emacs@gnu.org.
> Check 'etc/MACHINES' for recognized configuration names.
>
> but the MACHINES file says to see the nt/INSTALL document, which doesn= 't cover
> the 64-bit options. So I left them in for the moment - I can file a bu= g report
> for that also if needed.

Please do file a bug report.=C2=A0 Users shouldn't need to specify the = host
for supported systems.

It's also worthwhile to report this to MSYS2 developers, I think: that<= br> string is not the canonical host description for MinGW64, it's for
building an MSYS program, which is not what is going on here.

> Okay, I put the --prefix on the configure command, but I think it woul= d be good
> if the instructions included a simple example, and refer the user to t= he
> INSTALL
> instructions for more options

Sorry, I don't understand: this _is_ INSTALL, isn't it?=C2=A0 And t= he
current INSTALL does include a couple of examples.=C2=A0 What am I missing?=

> > the 'cp' commands I don't understand at all: if PREFI= X is chosen
> > correctly, the Emacs's bin/ directory and the MinGW64's b= in/
> > directory should be the same, so there's no need to copy; and=
> > even if these two bin/ directories are different, the directory > > with DLLs should be on PATH. this sounds like some workaround
> > for some misconfiguration, so we had better not repeated that. >
> I think this was in part because MSYS2 doesn't add its folders to = the PATH, and
> if you use the PATH variable there might be both 32-bit and 64-bit DLL= s on it,

But that's a problem MSYS2 and MinGW64 should have solved already,
right?=C2=A0 IOW, it's not something specific to Emacs.

> > The "Run" section doesn't belong in installation in= structions.
>
> I think it might be good to include a simple Test section that just sa= ys to
> run emacs with
>
> ./bin/runemacs.exe -Q
>
> to check that it works - mainly because a Windows user might tend to l= aunch
> Emacs from a shortcut on the desktop and might be unused to launching = it
> from the console, so a simple line like that might be helpful.

I indeed think that the instructions should tell how to create a
desktop shortcut for running Emacs.

> Any corrections or additions are welcome - I'm a novice at buildin= g things
> like this so am not sure what a more advanced user might want to see.<= br>
See below for some more.

> * Requirements
>
> The total time to download all tools and build Emacs is approximately = 90
> minutes on an Intel i3 processor, and 3GB of free space is required (1= .8GB for
> MSYS2 / MinGW-w64 and 1.2GB for Emacs with the full repository).
>
> Approximate times for the first pass through each step are given - to = time
> them yourself you can precede any BASH command with 'time'.
I would suggest removing this time information: it is very
system-dependent, and can also change radically depending on your
network access speed.=C2=A0 nt/INSTALL doesn't have such information, a= nd I
don't recall anyone ever complaining.

> Run this file to install MSYS2 in your preferred directory, e.g. the d= efault
> C:\msys64 - this will install MinGW-w64 also. Note that a path contain= ing
> spaces may cause problems.

GNU Coding Standards frown upon using "path" for anything except<= br> PATH-style lists of directories.=C2=A0 Please use "file names" or=
"directory name" instead.

Also, please keep 2 spaces between sentences, as we use the US English
conventions in GNU documentation.

> 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= ):
>
> pacman -S base-devel \
> mingw-w64-x86_64-toolchain \
> mingw-w64-x86_64-xpm-nox \
> mingw-w64-x86_64-libtiff \
> mingw-w64-x86_64-giflib \
> mingw-w64-x86_64-libpng \
> mingw-w64-x86_64-libjpeg-turbo \
> mingw-w64-x86_64-librsvg \
> mingw-w64-x86_64-libxml2 \
> mingw-w64-x86_64-gnutls
>
> The packages include the base developer tools (autoconf, automake, gre= p, make,
> etc.), the compiler toolchain (gcc, gdb, etc.), several image librarie= s, an
> xml library, and the GnuTLS (transport layer security) library.

Here I would say that the user can omit some or all of the optional
libraries (all but the first 3), if they so wish.

> * Install git (optional) and disable autocrlf [2 mins]

This section should say that Git is only needed if the user wants to
build the development version.

> Note that the --prefix option specifies a location for the resulting b= inary
> files, which 'make install' will use - if a prefix is not spec= ified the files
> will be put in the standard MinGW-w64 directories.

No, if --prefix is not specified, the files will be installed in the
standard _Unix_ directories, not standard MinGW-w64 directories.

> ** Run make [30 mins]

This takes 4 min on my system, for the full bootstrap (building a
release tarball is much faster).=C2=A0 I guess you didn't use "mak= e -j8" or
some such.=C2=A0 See, this is why these times are not such a good idea.

> ** Run make install [6 mins]

Takes something like 2 min here.

> Now you can run make install, which will copy the executable and other= files
> to the location specified in the configure step:
>
> make install

One can also say

=C2=A0 make install prefix=3D/wherever

to install in a different place.

> * Emacs settings
>
> Local Variables:
> mode: org
> sentence-end-double-space: t
> End:

This should be preceded by a Ctrl-L character, since Emacs looks for
the file-local variables in the last page of the file.

Thanks.

--089e0122a59c71652d052818379b--