mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 11:50:51 -08:00
dc4e6b1329; Update copyright years in more files64b3777631; Run set-copyright from admin.el8e1c56ae46; Add 2024 to copyright years # Conflicts: # doc/misc/modus-themes.org # doc/misc/texinfo.tex # etc/NEWS # etc/refcards/ru-refcard.tex # etc/themes/modus-operandi-theme.el # etc/themes/modus-themes.el # etc/themes/modus-vivendi-theme.el # lib/alloca.in.h # lib/binary-io.h # lib/c-ctype.h # lib/c-strcasecmp.c # lib/c-strncasecmp.c # lib/careadlinkat.c # lib/cloexec.c # lib/close-stream.c # lib/diffseq.h # lib/dup2.c # lib/filemode.h # lib/fpending.c # lib/fpending.h # lib/fsusage.c # lib/getgroups.c # lib/getloadavg.c # lib/gettext.h # lib/gettime.c # lib/gettimeofday.c # lib/group-member.c # lib/malloc.c # lib/md5-stream.c # lib/md5.c # lib/md5.h # lib/memmem.c # lib/memrchr.c # lib/nanosleep.c # lib/save-cwd.h # lib/sha1.c # lib/sig2str.c # lib/stdlib.in.h # lib/strtoimax.c # lib/strtol.c # lib/strtoll.c # lib/time_r.c # lib/xalloc-oversized.h # lisp/auth-source-pass.el # lisp/emacs-lisp/lisp-mnt.el # lisp/emacs-lisp/timer.el # lisp/info-look.el # lisp/jit-lock.el # lisp/loadhist.el # lisp/mail/rmail.el # lisp/net/ntlm.el # lisp/net/webjump.el # lisp/progmodes/asm-mode.el # lisp/progmodes/project.el # lisp/progmodes/sh-script.el # lisp/textmodes/flyspell.el # lisp/textmodes/reftex-toc.el # lisp/textmodes/reftex.el # lisp/textmodes/tex-mode.el # lisp/url/url-gw.el # m4/alloca.m4 # m4/clock_time.m4 # m4/d-type.m4 # m4/dirent_h.m4 # m4/dup2.m4 # m4/euidaccess.m4 # m4/fchmodat.m4 # m4/filemode.m4 # m4/fsusage.m4 # m4/getgroups.m4 # m4/getloadavg.m4 # m4/getrandom.m4 # m4/gettime.m4 # m4/gettimeofday.m4 # m4/gnulib-common.m4 # m4/group-member.m4 # m4/inttypes.m4 # m4/malloc.m4 # m4/manywarnings.m4 # m4/mempcpy.m4 # m4/memrchr.m4 # m4/mkostemp.m4 # m4/mktime.m4 # m4/nproc.m4 # m4/nstrftime.m4 # m4/pathmax.m4 # m4/pipe2.m4 # m4/pselect.m4 # m4/pthread_sigmask.m4 # m4/readlink.m4 # m4/realloc.m4 # m4/sig2str.m4 # m4/ssize_t.m4 # m4/stat-time.m4 # m4/stddef_h.m4 # m4/stdint.m4 # m4/stdio_h.m4 # m4/stdlib_h.m4 # m4/stpcpy.m4 # m4/strnlen.m4 # m4/strtoimax.m4 # m4/strtoll.m4 # m4/time_h.m4 # m4/timegm.m4 # m4/timer_time.m4 # m4/timespec.m4 # m4/unistd_h.m4 # m4/warnings.m4 # nt/configure.bat # nt/preprep.c # test/lisp/register-tests.el
279 lines
9 KiB
Text
279 lines
9 KiB
Text
Building and Installing Emacs on 64-bit MS-Windows
|
|
using MSYS2 and MinGW-w64
|
|
|
|
Copyright (c) 2015-2024 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.org's 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.
|
|
|
|
As of December 2022, the minimum supported system, both for building
|
|
Emacs with the MSYS2/MinGW-w64 toolchain and for running the produced
|
|
binary, is Windows 8.1. The computer hardware should also match the
|
|
Microsoft requirements for Windows 8.1.
|
|
|
|
* 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 https://mingw-w64.org/.
|
|
|
|
MSYS2 is a Cygwin-derived software distribution for Windows which provides
|
|
build tools for MinGW-w64 -- see https://msys2.org/.
|
|
|
|
** Download and install MinGW-w64 and MSYS2
|
|
|
|
Go to https://msys2.org and follow the Installation instructions, up
|
|
to where they say to use 'pacman -S' to install packages. Instead,
|
|
install the necessary packages as instructed in the next section.
|
|
|
|
** Download and install the necessary packages
|
|
|
|
Run mingw64.exe in your MSYS2 directory and you will see a BASH window
|
|
open.
|
|
|
|
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 --needed base-devel \
|
|
mingw-w64-x86_64-toolchain \
|
|
mingw-w64-x86_64-xpm-nox \
|
|
mingw-w64-x86_64-gmp \
|
|
mingw-w64-x86_64-gnutls \
|
|
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-libwebp \
|
|
mingw-w64-x86_64-lcms2 \
|
|
mingw-w64-x86_64-jansson \
|
|
mingw-w64-x86_64-libxml2 \
|
|
mingw-w64-x86_64-zlib \
|
|
mingw-w64-x86_64-harfbuzz \
|
|
mingw-w64-x86_64-libgccjit \
|
|
mingw-w64-x86_64-sqlite3 \
|
|
mingw-w64-x86_64-tree-sitter
|
|
|
|
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, zlib for decompressing text, HarfBuzz for use as the shaping
|
|
engine, libgccjit for native-compilation support, SQLite3 for
|
|
accessing SQL databases, and the tree-sitter library used by some
|
|
major modes. Only the first four packages are required (base-devel,
|
|
toolchain, xpm-nox, GMP), and GnuTLS is highly recommended; the rest
|
|
are optional. You can select only part of the libraries if you don't
|
|
need them all.
|
|
|
|
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 (see below), 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-29.1:
|
|
|
|
cd /c/emacs
|
|
tar xJf emacs-29.1.tar.xz
|
|
|
|
** From the Git repository
|
|
|
|
To clone the Git repository, do something like the following -- this will
|
|
put the Emacs source into C:\emacs\emacs-master:
|
|
|
|
mkdir /c/emacs
|
|
cd /c/emacs
|
|
git clone https://git.savannah.gnu.org/git/emacs.git emacs-master
|
|
|
|
This will produce the development sources, i.e. the master branch of
|
|
the Emacs Git repository, in the directory C:\emacs\emacs-master.
|
|
|
|
(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.
|
|
|
|
cd /c/emacs/emacs-29.1 (if building a source tarball)
|
|
cd /c/emacs/emacs-master (if building from Git)
|
|
|
|
** Run autogen
|
|
|
|
If you are building from Git, 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:\programs\emacs. 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 D-Bus because Emacs does not yet
|
|
support them on Windows.
|
|
|
|
./configure --prefix=/c/programs/emacs --without-dbus
|
|
|
|
** 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.
|
|
|
|
When running Emacs from outside the mingw64 shell, you will need to
|
|
add c:\msys64\mingw64\bin to your Windows PATH, or copy the needed
|
|
DLLs into Emacs' bin/ directory. Otherwise features such as TLS which
|
|
depend on those DLLs will be missing.
|
|
|
|
You can do this through Control Panel / System and Security / System /
|
|
Advanced system settings / Environment Variables / Edit path.
|
|
|
|
* 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.
|
|
|
|
* Troubleshooting
|
|
|
|
** Missing mingw64.exe launcher
|
|
|
|
Older versions of Msys2 may lack the mingw64.exe launcher program. If
|
|
you have them, running mingw64_shell.bat or "msys2_shell.cmd -mingw64"
|
|
should work instead.
|
|
|
|
Alternatively, install mingw64.exe with
|
|
|
|
pacman -S msys/msys2-launcher-git
|
|
|
|
** Configure errors
|
|
|
|
*** Check that mingw64 gcc is accessible
|
|
|
|
Errors like
|
|
|
|
configure: error: Emacs does not support 'x86_64-pc-msys' systems.
|
|
|
|
or
|
|
|
|
checking the compiler's target... configure: error: Impossible to obtain gcc compiler target.
|
|
|
|
indicate you didn't use the mingw64 launcher, or you didn't install
|
|
gcc. It's also possible you have something in ~/.bashrc or ~/.profile
|
|
which modifies PATH or MSYSTEM to an unexpected value, preventing gcc
|
|
from being found. At the mingw64 bash shell, running
|
|
|
|
gcc -v
|
|
|
|
should give output which includes the text
|
|
|
|
Target: x86_64-w64-mingw32
|
|
|
|
*** Check your $PKG_CONFIG_PATH
|
|
|
|
For a typical MSYS2 install, running
|
|
|
|
echo $PKG_CONFIG_PATH
|
|
|
|
at the mingw64 bash shell should give print a value starting with
|
|
'/mingw64/lib/pkgconfig'. Incorrect values may prevent configure from
|
|
finding installed libraries.
|
|
|
|
* 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/>.
|