xref: /freebsd/contrib/ncurses/README.MinGW (revision 7a65641922f404b84e9a249d48593de84d8e8d17)
106bfebdeSXin LI-------------------------------------------------------------------------------
2e1865124SBaptiste Daroussin-- Copyright 2020 Thomas E. Dickey                                           --
3e1865124SBaptiste Daroussin-- Copyright 2008-2011,2012 Free Software Foundation, Inc.                   --
406bfebdeSXin LI--                                                                           --
506bfebdeSXin LI-- Permission is hereby granted, free of charge, to any person obtaining a   --
606bfebdeSXin LI-- copy of this software and associated documentation files (the             --
706bfebdeSXin LI-- "Software"), to deal in the Software without restriction, including       --
806bfebdeSXin LI-- without limitation the rights to use, copy, modify, merge, publish,       --
906bfebdeSXin LI-- distribute, distribute with modifications, sublicense, and/or sell copies --
1006bfebdeSXin LI-- of the Software, and to permit persons to whom the Software is furnished  --
1106bfebdeSXin LI-- to do so, subject to the following conditions:                            --
1206bfebdeSXin LI--                                                                           --
1306bfebdeSXin LI-- The above copyright notice and this permission notice shall be included   --
1406bfebdeSXin LI-- in all copies or substantial portions of the Software.                    --
1506bfebdeSXin LI--                                                                           --
1606bfebdeSXin LI-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS   --
1706bfebdeSXin LI-- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF                --
1806bfebdeSXin LI-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN --
1906bfebdeSXin LI-- NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,       --
2006bfebdeSXin LI-- DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR     --
2106bfebdeSXin LI-- OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE --
2206bfebdeSXin LI-- USE OR OTHER DEALINGS IN THE SOFTWARE.                                    --
2306bfebdeSXin LI--                                                                           --
2406bfebdeSXin LI-- Except as contained in this notice, the name(s) of the above copyright    --
2506bfebdeSXin LI-- holders shall not be used in advertising or otherwise to promote the      --
2606bfebdeSXin LI-- sale, use or other dealings in this Software without prior written        --
2706bfebdeSXin LI-- authorization.                                                            --
2806bfebdeSXin LI-------------------------------------------------------------------------------
29*7a656419SBaptiste Daroussin-- $Id: README.MinGW,v 1.14 2020/09/06 22:22:44 tom Exp $
3006bfebdeSXin LI-- Author: Juergen Pfeifer
3106bfebdeSXin LI-------------------------------------------------------------------------------
3206bfebdeSXin LI
33*7a656419SBaptiste DaroussinThis is work in progress, but it is in an state where one can see it
3406bfebdeSXin LIworks at least on the Windows Console.
3506bfebdeSXin LI
36*7a656419SBaptiste DaroussinYou should install the MSYS2 package, so that you have a shell environment that
37*7a656419SBaptiste Daroussinallows you to run scripts, especially configure, etc.  You can get that
38*7a656419SBaptiste Daroussinfrom
39*7a656419SBaptiste Daroussin	https://www.msys2.org/
4006bfebdeSXin LI
41*7a656419SBaptiste Daroussinor the individual packages from
4206bfebdeSXin LI
43*7a656419SBaptiste Daroussin	https://sourceforge.net/projects/msys2/files/
4406bfebdeSXin LI
45*7a656419SBaptiste DaroussinYou may also use a hosted MinGW cross-compile toolchain, e.g., on Ubuntu or
46*7a656419SBaptiste DaroussinArchLinux to build the libraries and tools.
47*7a656419SBaptiste Daroussin
48*7a656419SBaptiste DaroussinTo build ncurses for native Windows with support for the new Windows 10 Virtual
49*7a656419SBaptiste DaroussinTerminal and PseudoConsole support, you should install at least version 8.0 of
50*7a656419SBaptiste Daroussinthe mingw-w64-x86_64-headers package as it appears to have support for the
51*7a656419SBaptiste Daroussinrequired Windows SDK level.  Please note that some of the Linux distributions
52*7a656419SBaptiste Daroussinare a bit behind with respect to the required MinGW header versions and you may
53*7a656419SBaptiste Daroussinnot be able to properly build the libraries for current Windows 10 using these
54*7a656419SBaptiste Daroussintoolchains.  Although it is a bit slow, MSYS2 on Windows 10 64-Bit is the
55*7a656419SBaptiste Daroussinauthoritative build environment for the MinGW version of ncurses.
56*7a656419SBaptiste Daroussin
57*7a656419SBaptiste DaroussinUsing MinGW is a pragmatic decision, it is the easiest way to port this
5806bfebdeSXin LIheavily UNIX based sourcebase to native Windows. The goal is of course
5906bfebdeSXin LIto provide the includes, libraries and DLLs to be used with the more
6006bfebdeSXin LIcommon traditional development environments on Windows, mainly with
6106bfebdeSXin LIMicrosoft Visual Studio.
6206bfebdeSXin LI
63*7a656419SBaptiste DaroussinThe TERM environment variable must be set especially to activate the Windows
6473f0a83dSXin LIconsole-driver.  The driver checks if TERM is set to "#win32con" (explicit
6573f0a83dSXin LIuse) or if TERM is unset or empty (implicit).
6606bfebdeSXin LI
67*7a656419SBaptiste DaroussinBeginning with build 17763 (Fall 2018 update), Windows 10 supports ANSI escape
68*7a656419SBaptiste Daroussinsequences (Virtual Terminal support). If ncurses detects this or a later
69*7a656419SBaptiste DaroussinWindows 10 version, the interpretation of the implicit TERM setting (which
70*7a656419SBaptiste Daroussinmeans: TERM is not set or empty) changes. In this case, TERM is to be assumed
71*7a656419SBaptiste Daroussinto be "ms-terminal" and ncurses acts using the regular terminfo based driver,
72*7a656419SBaptiste Daroussinthus acting like a regular Terminal we all know from UNIX like environments.
7306bfebdeSXin LI
74*7a656419SBaptiste DaroussinThis code requires WindowsNT 6.0 or better, which means on the client
75*7a656419SBaptiste DaroussinWindows Vista or better, on the server Windows Server 2008 or better.
7606bfebdeSXin LI
77*7a656419SBaptiste DaroussinIf running on Windows 10 Build 17763 or later is detected, any program
78*7a656419SBaptiste Daroussinspawning a subprocess running a ncurses program should use the new
79*7a656419SBaptiste DaroussinPseudoConsole support, which provides what we know as pty from the UNIX
80*7a656419SBaptiste Daroussinworld also for Windows. Using the CreatePseudoConsole API
81*7a656419SBaptiste Daroussin(see https://docs.microsoft.com/en-us/windows/console/createpseudoconsole)
82*7a656419SBaptiste Daroussinin the calling process, it is guaranteed that the called ncurses program has
83*7a656419SBaptiste Daroussina console that is required by its implementation, even if the calling program
84*7a656419SBaptiste Daroussinis NOT a console program, e.g., MSYS2's own mintty Terminal emulator.
85*7a656419SBaptiste Daroussin
86*7a656419SBaptiste DaroussinIn the current MSYS2/minGW setup, building MinGW shared libraries with
87*7a656419SBaptiste Daroussinlibtool for ncurses seems to be broken, so I recommend NOT to use libtool.
8806bfebdeSXin LI
8973f0a83dSXin LITo build a modern but still small footprint ncurses that provides
9073f0a83dSXin LIhooks for interop, I recommend using these options:
9173f0a83dSXin LI
92*7a656419SBaptiste Daroussin	--without-libtool
9306bfebdeSXin LI	--disable-home-terminfo
9473f0a83dSXin LI	--enable-database
9573f0a83dSXin LI	--disable-termcap
9606bfebdeSXin LI	--enable-sp-funcs
9706bfebdeSXin LI	--enable-term-driver
9806bfebdeSXin LI	--enable-interop
9906bfebdeSXin LI
100*7a656419SBaptiste DaroussinThis is the configuration command line which I am using at the moment
101*7a656419SBaptiste Daroussin(assuming environment variable MINGW_ROOT holds the root directory name of
102*7a656419SBaptiste Daroussinyour MinGW build):
10306bfebdeSXin LI
10406bfebdeSXin LI./configure \
105*7a656419SBaptiste Daroussin	--prefix=/mingw64 \
106*7a656419SBaptiste Daroussin	--without-cxx \
10706bfebdeSXin LI	--without-ada \
10806bfebdeSXin LI	--enable-warnings \
10906bfebdeSXin LI	--enable-assertions \
110*7a656419SBaptiste Daroussin	--enable-exp-win32 \
111*7a656419SBaptiste Daroussin	--enable-ext-funcs \
11206bfebdeSXin LI	--disable-home-terminfo \
113*7a656419SBaptiste Daroussin	--disable-echo \
114*7a656419SBaptiste Daroussin	--disable-getcap \
115*7a656419SBaptiste Daroussin	--disable-hard-tabs \
116*7a656419SBaptiste Daroussin	--disable-leaks \
117*7a656419SBaptiste Daroussin	--disable-macros \
118*7a656419SBaptiste Daroussin	--disable-overwrite \
119*7a656419SBaptiste Daroussin	--enable-opaque-curses \
120*7a656419SBaptiste Daroussin	--enable-opaque-panel \
121*7a656419SBaptiste Daroussin	--enable-opaque-menu \
122*7a656419SBaptiste Daroussin	--enable-opaque-form \
12373f0a83dSXin LI	--enable-database \
12406bfebdeSXin LI	--enable-sp-funcs \
12506bfebdeSXin LI	--enable-term-driver \
12606bfebdeSXin LI	--enable-interop \
12773f0a83dSXin LI	--disable-termcap \
128*7a656419SBaptiste Daroussin	--enable-database \
12973f0a83dSXin LI	--with-progs \
130*7a656419SBaptiste Daroussin	--without-libtool \
13173f0a83dSXin LI	--enable-pc-files \
132*7a656419SBaptiste Daroussin	--with-shared \
133*7a656419SBaptiste Daroussin	--with-normal \
134*7a656419SBaptiste Daroussin	--without-debug \
135*7a656419SBaptiste Daroussin	--with-fallbacks=ms-terminal \
136*7a656419SBaptiste Daroussin	--without-manpages
13706bfebdeSXin LI
13873f0a83dSXin LIPlease note that it is also necessary to set this environment variable:
13906bfebdeSXin LI
14073f0a83dSXin LIexport PATH_SEPARATOR=";"
14173f0a83dSXin LI
14273f0a83dSXin LIin order to parse the terminfo paths correctly. Terminfo paths should
143*7a656419SBaptiste Daroussinalways be separated by a semicolon, even when running under MSYS2.
14406bfebdeSXin LI
14506bfebdeSXin LIAll the options above are - like the whole Windows support -
14606bfebdeSXin LIexperimental.
14706bfebdeSXin LI
148*7a656419SBaptiste Daroussin-- vile:txtmode
149