xref: /freebsd/contrib/ncurses/README.MinGW (revision d9a42747950146bf03cda7f6e25d219253f8a57a)
1-------------------------------------------------------------------------------
2-- Copyright 2020 Thomas E. Dickey                                           --
3-- Copyright 2008-2011,2012 Free Software Foundation, Inc.                   --
4--                                                                           --
5-- Permission is hereby granted, free of charge, to any person obtaining a   --
6-- copy of this software and associated documentation files (the             --
7-- "Software"), to deal in the Software without restriction, including       --
8-- without limitation the rights to use, copy, modify, merge, publish,       --
9-- distribute, distribute with modifications, sublicense, and/or sell copies --
10-- of the Software, and to permit persons to whom the Software is furnished  --
11-- to do so, subject to the following conditions:                            --
12--                                                                           --
13-- The above copyright notice and this permission notice shall be included   --
14-- in all copies or substantial portions of the Software.                    --
15--                                                                           --
16-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   --
17-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                --
18-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
19-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,       --
20-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR     --
21-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
22-- USE OR OTHER DEALINGS IN THE SOFTWARE.                                    --
23--                                                                           --
24-- Except as contained in this notice, the name(s) of the above copyright    --
25-- holders shall not be used in advertising or otherwise to promote the      --
26-- sale, use or other dealings in this Software without prior written        --
27-- authorization.                                                            --
28-------------------------------------------------------------------------------
29-- $Id: README.MinGW,v 1.14 2020/09/06 22:22:44 tom Exp $
30-- Author: Juergen Pfeifer
31-------------------------------------------------------------------------------
32
33This is work in progress, but it is in an state where one can see it
34works at least on the Windows Console.
35
36You should install the MSYS2 package, so that you have a shell environment that
37allows you to run scripts, especially configure, etc.  You can get that
38from
39	https://www.msys2.org/
40
41or the individual packages from
42
43	https://sourceforge.net/projects/msys2/files/
44
45You may also use a hosted MinGW cross-compile toolchain, e.g., on Ubuntu or
46ArchLinux to build the libraries and tools.
47
48To build ncurses for native Windows with support for the new Windows 10 Virtual
49Terminal and PseudoConsole support, you should install at least version 8.0 of
50the mingw-w64-x86_64-headers package as it appears to have support for the
51required Windows SDK level.  Please note that some of the Linux distributions
52are a bit behind with respect to the required MinGW header versions and you may
53not be able to properly build the libraries for current Windows 10 using these
54toolchains.  Although it is a bit slow, MSYS2 on Windows 10 64-Bit is the
55authoritative build environment for the MinGW version of ncurses.
56
57Using MinGW is a pragmatic decision, it is the easiest way to port this
58heavily UNIX based sourcebase to native Windows. The goal is of course
59to provide the includes, libraries and DLLs to be used with the more
60common traditional development environments on Windows, mainly with
61Microsoft Visual Studio.
62
63The TERM environment variable must be set especially to activate the Windows
64console-driver.  The driver checks if TERM is set to "#win32con" (explicit
65use) or if TERM is unset or empty (implicit).
66
67Beginning with build 17763 (Fall 2018 update), Windows 10 supports ANSI escape
68sequences (Virtual Terminal support). If ncurses detects this or a later
69Windows 10 version, the interpretation of the implicit TERM setting (which
70means: TERM is not set or empty) changes. In this case, TERM is to be assumed
71to be "ms-terminal" and ncurses acts using the regular terminfo based driver,
72thus acting like a regular Terminal we all know from UNIX like environments.
73
74This code requires WindowsNT 6.0 or better, which means on the client
75Windows Vista or better, on the server Windows Server 2008 or better.
76
77If running on Windows 10 Build 17763 or later is detected, any program
78spawning a subprocess running a ncurses program should use the new
79PseudoConsole support, which provides what we know as pty from the UNIX
80world also for Windows. Using the CreatePseudoConsole API
81(see https://docs.microsoft.com/en-us/windows/console/createpseudoconsole)
82in the calling process, it is guaranteed that the called ncurses program has
83a console that is required by its implementation, even if the calling program
84is NOT a console program, e.g., MSYS2's own mintty Terminal emulator.
85
86In the current MSYS2/minGW setup, building MinGW shared libraries with
87libtool for ncurses seems to be broken, so I recommend NOT to use libtool.
88
89To build a modern but still small footprint ncurses that provides
90hooks for interop, I recommend using these options:
91
92	--without-libtool
93	--disable-home-terminfo
94	--enable-database
95	--disable-termcap
96	--enable-sp-funcs
97	--enable-term-driver
98	--enable-interop
99
100This is the configuration command line which I am using at the moment
101(assuming environment variable MINGW_ROOT holds the root directory name of
102your MinGW build):
103
104./configure \
105	--prefix=/mingw64 \
106	--without-cxx \
107	--without-ada \
108	--enable-warnings \
109	--enable-assertions \
110	--enable-exp-win32 \
111	--enable-ext-funcs \
112	--disable-home-terminfo \
113	--disable-echo \
114	--disable-getcap \
115	--disable-hard-tabs \
116	--disable-leaks \
117	--disable-macros \
118	--disable-overwrite \
119	--enable-opaque-curses \
120	--enable-opaque-panel \
121	--enable-opaque-menu \
122	--enable-opaque-form \
123	--enable-database \
124	--enable-sp-funcs \
125	--enable-term-driver \
126	--enable-interop \
127	--disable-termcap \
128	--enable-database \
129	--with-progs \
130	--without-libtool \
131	--enable-pc-files \
132	--with-shared \
133	--with-normal \
134	--without-debug \
135	--with-fallbacks=ms-terminal \
136	--without-manpages
137
138Please note that it is also necessary to set this environment variable:
139
140export PATH_SEPARATOR=";"
141
142in order to parse the terminfo paths correctly. Terminfo paths should
143always be separated by a semicolon, even when running under MSYS2.
144
145All the options above are - like the whole Windows support -
146experimental.
147
148-- vile:txtmode
149