Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
-
2dafc65a
by Cheng Shao at 2026-01-14T03:55:31-05:00
21 changed files:
- compiler/GHC/Driver/MakeFile.hs
- compiler/GHC/SysTools/Terminal.hs
- configure.ac
- docs/users_guide/packages.rst
- docs/users_guide/win32-dlls.rst
- driver/ghci/ghci.c
- driver/utils/cwrapper.c
- driver/utils/isMinTTY.c
- hadrian/bindist/cwrappers/cwrapper.c
- hadrian/src/Settings/Program.hs
- libraries/base/tests/IO/T12010/cbits/initWinSock.c
- libraries/ghc-internal/cbits/consUtils.c
- libraries/ghc-internal/configure.ac
- libraries/ghc-internal/src/GHC/Internal/ConsoleHandler.hsc
- libraries/ghc-internal/src/GHC/Internal/IO/Handle.hs
- m4/ghc_select_file_extensions.m4
- testsuite/driver/runtests.py
- testsuite/driver/testglobals.py
- testsuite/driver/testlib.py
- testsuite/mk/test.mk
- testsuite/tests/rts/linker/rdynamic.hs
Changes:
| ... | ... | @@ -331,7 +331,7 @@ writeDependency :: FilePath -> Handle -> [FilePath] -> FilePath -> IO () |
| 331 | 331 | writeDependency root hdl targets dep
|
| 332 | 332 | = do let -- We need to avoid making deps on
|
| 333 | 333 | -- c:/foo/...
|
| 334 | - -- on cygwin as make gets confused by the :
|
|
| 334 | + -- on Windows as make gets confused by the :
|
|
| 335 | 335 | -- Making relative deps avoids some instances of this.
|
| 336 | 336 | dep' = makeRelative root dep
|
| 337 | 337 | forOutput = escapeSpaces . reslash Forwards . normalise
|
| ... | ... | @@ -41,7 +41,7 @@ stderrSupportsAnsiColors' = do |
| 41 | 41 | case eMode of
|
| 42 | 42 | Left (_ :: IOError) -> Win32.isMinTTYHandle h
|
| 43 | 43 | -- Check if the we're in a MinTTY terminal
|
| 44 | - -- (e.g., Cygwin or MSYS2)
|
|
| 44 | + -- (e.g., MSYS2)
|
|
| 45 | 45 | Right mode
|
| 46 | 46 | | modeHasVTP mode -> pure True
|
| 47 | 47 | | otherwise -> enableVTP h mode
|
| ... | ... | @@ -469,7 +469,7 @@ dnl -------------------------------------------------------------- |
| 469 | 469 | dnl Note: we may not have objdump on OS X, and we only need it on
|
| 470 | 470 | dnl Windows (for DLL checks), OpenBSD, and AIX
|
| 471 | 471 | case $HostOS_CPP in
|
| 472 | - cygwin32|mingw32|openbsd|aix)
|
|
| 472 | + mingw32|openbsd|aix)
|
|
| 473 | 473 | AC_CHECK_TARGET_TOOL([OBJDUMP], [objdump])
|
| 474 | 474 | ;;
|
| 475 | 475 | esac
|
| ... | ... | @@ -1139,7 +1139,7 @@ read and write this syntax respectively. Here's an example of the |
| 1139 | 1139 | Operating System Interface for Computing Environments -
|
| 1140 | 1140 | IEEE Std. 1003.1).
|
| 1141 | 1141 | .
|
| 1142 | - The package is not supported under Windows (except under Cygwin).
|
|
| 1142 | + The package is not supported under Windows.
|
|
| 1143 | 1143 | category: System
|
| 1144 | 1144 | author:
|
| 1145 | 1145 | exposed: True
|
| ... | ... | @@ -33,23 +33,16 @@ We recommend running GHCi in a standard Windows console: select the |
| 33 | 33 | use ``Start->Run->cmd`` to get a Windows console and invoke ``ghci``
|
| 34 | 34 | from there (as long as it's in your ``PATH``).
|
| 35 | 35 | |
| 36 | -If you run GHCi in a Cygwin or MSYS shell, then the Control-C behaviour
|
|
| 37 | -is adversely affected. In one of these environments you should use the
|
|
| 36 | +If you run GHCi in an MSYS shell, then the Control-C behaviour
|
|
| 37 | +is adversely affected. In this environment you should use the
|
|
| 38 | 38 | ``ghcii.sh`` script to start GHCi, otherwise when you hit Control-C
|
| 39 | 39 | you'll be returned to the shell prompt but the GHCi process will still
|
| 40 | 40 | be running. However, even using the ``ghcii.sh`` script, if you hit
|
| 41 | 41 | Control-C then the GHCi process will be killed immediately, rather than
|
| 42 | 42 | letting you interrupt a running program inside GHCi as it should. This
|
| 43 | -problem is caused by the fact that the Cygwin and MSYS shell
|
|
| 44 | -environments don't pass Control-C events to non-Cygwin child processes,
|
|
| 45 | -because in order to do that there needs to be a Windows console.
|
|
| 46 | - |
|
| 47 | -There's an exception: you can use a Cygwin shell if the ``CYGWIN``
|
|
| 48 | -environment variable does *not* contain ``tty``. In this mode, the
|
|
| 49 | -Cygwin shell behaves like a Windows console shell and console events are
|
|
| 50 | -propagated to child processes. Note that the ``CYGWIN`` environment
|
|
| 51 | -variable must be set *before* starting the Cygwin shell; changing it
|
|
| 52 | -afterwards has no effect on the shell.
|
|
| 43 | +problem is caused by the fact that the MSYS shell environment doesn't
|
|
| 44 | +pass Control-C events to non-console child processes, because in order
|
|
| 45 | +to do that there needs to be a Windows console.
|
|
| 53 | 46 | |
| 54 | 47 | This problem doesn't just affect GHCi, it affects any GHC-compiled
|
| 55 | 48 | program that wants to catch console events. See the
|
| ... | ... | @@ -138,78 +131,6 @@ See the |
| 138 | 131 | for more details.
|
| 139 | 132 | |
| 140 | 133 | |
| 141 | -.. _ghci-cygwin:
|
|
| 142 | - |
|
| 143 | -Using GHC (and other GHC-compiled executables) with Cygwin
|
|
| 144 | -----------------------------------------------------------
|
|
| 145 | - |
|
| 146 | -Background
|
|
| 147 | -~~~~~~~~~~
|
|
| 148 | - |
|
| 149 | -The Cygwin tools aim to provide a Unix-style API on top of the windows
|
|
| 150 | -libraries, to facilitate ports of Unix software to windows. To this end,
|
|
| 151 | -they introduce a Unix-style directory hierarchy under some root
|
|
| 152 | -directory (typically ``/`` is ``C:\cygwin\``). Moreover, everything
|
|
| 153 | -built against the Cygwin API (including the Cygwin tools and programs
|
|
| 154 | -compiled with Cygwin's GHC) will see ``/`` as the root of their file system,
|
|
| 155 | -happily pretending to work in a typical unix environment, and finding
|
|
| 156 | -things like ``/bin`` and ``/usr/include`` without ever explicitly
|
|
| 157 | -bothering with their actual location on the windows system (probably
|
|
| 158 | -``C:\cygwin\bin`` and ``C:\cygwin\usr\include``).
|
|
| 159 | - |
|
| 160 | -The problem
|
|
| 161 | -~~~~~~~~~~~
|
|
| 162 | - |
|
| 163 | -GHC, by default, no longer depends on cygwin, but is a native Windows
|
|
| 164 | -program. It is built using mingw, and it uses mingw's GHC while
|
|
| 165 | -compiling your Haskell sources (even if you call it from cygwin's bash),
|
|
| 166 | -but what matters here is that - just like any other normal windows
|
|
| 167 | -program - neither GHC nor the executables it produces are aware of
|
|
| 168 | -Cygwin's pretended unix hierarchy. GHC will happily accept either ``/`` or
|
|
| 169 | -``\`` as path separators, but it won't know where to find ``/home/joe/Main.hs``
|
|
| 170 | -or ``/bin/bash`` or the like. This causes all kinds of fun when GHC is used from
|
|
| 171 | -within Cygwin's bash, or in make-sessions running under Cygwin.
|
|
| 172 | - |
|
| 173 | -Things to do
|
|
| 174 | -~~~~~~~~~~~~
|
|
| 175 | - |
|
| 176 | -- Don't use absolute paths in ``make``, ``configure`` & co if there is any
|
|
| 177 | - chance that those might be passed to GHC (or to GHC-compiled
|
|
| 178 | - programs). Relative paths are fine because cygwin tools are happy
|
|
| 179 | - with them and GHC accepts ``/`` as path-separator. And relative paths
|
|
| 180 | - don't depend on where Cygwin's root directory is located, or on which
|
|
| 181 | - partition or network drive your source tree happens to reside, as
|
|
| 182 | - long as you ``cd`` there first.
|
|
| 183 | - |
|
| 184 | -- If you have to use absolute paths (beware of the innocent-looking
|
|
| 185 | - ``ROOT=$(pwd)`` in makefile hierarchies or configure scripts), Cygwin
|
|
| 186 | - provides a tool called ``cygpath`` that can convert Cygwin's
|
|
| 187 | - Unix-style paths to their actual Windows-style counterparts. Many
|
|
| 188 | - Cygwin tools actually accept absolute Windows-style paths (remember,
|
|
| 189 | - though, that you either need to escape ``\`` or convert ``\`` to ``/``),
|
|
| 190 | - so you should be fine just using those everywhere. If you need to use
|
|
| 191 | - tools that do some kind of path-mangling that depends on unix-style
|
|
| 192 | - paths (one fun example is trying to interpret ``:`` as a separator in
|
|
| 193 | - path lists), you can still try to convert paths using ``cygpath``
|
|
| 194 | - just before they are passed to GHC and friends.
|
|
| 195 | - |
|
| 196 | -- If you don't have ``cygpath``, you probably don't have cygwin and
|
|
| 197 | - hence no problems with it... unless you want to write one build
|
|
| 198 | - process for several platforms. Again, relative paths are your friend,
|
|
| 199 | - but if you have to use absolute paths, and don't want to use
|
|
| 200 | - different tools on different platforms, you can simply write a short
|
|
| 201 | - Haskell program to print the current directory (thanks to George
|
|
| 202 | - Russell for this idea): compiled with GHC, this will give you the
|
|
| 203 | - view of the file system that GHC depends on (which will differ
|
|
| 204 | - depending on whether GHC is compiled with cygwin's gcc or mingw's gcc
|
|
| 205 | - or on a real Unix system..) - that little program can also deal with
|
|
| 206 | - escaping ``\`` in paths. Apart from the banner and the startup time,
|
|
| 207 | - something like this would also do:
|
|
| 208 | - |
|
| 209 | - .. code-block:: none
|
|
| 210 | - |
|
| 211 | - $ echo "Directory.getCurrentDirectory >>= putStrLn . init . tail . show " | ghci
|
|
| 212 | - |
|
| 213 | 134 | .. _win32-dlls:
|
| 214 | 135 | |
| 215 | 136 | Building and using Win32 DLLs
|
| ... | ... | @@ -27,7 +27,7 @@ int main(int argc, char** argv) { |
| 27 | 27 | char *preArgv[1];
|
| 28 | 28 | |
| 29 | 29 | if (isMinTTY()) {
|
| 30 | - printf("WARNING: GHCi invoked via 'ghci.exe' in MinTTY consoles (e.g., Cygwin or MSYS)\n");
|
|
| 30 | + printf("WARNING: GHCi invoked via 'ghci.exe' in MinTTY consoles (e.g., MSYS2)\n");
|
|
| 31 | 31 | printf(" doesn't handle Ctrl-C well; use the 'ghcii.sh' shell wrapper instead\n");
|
| 32 | 32 | fflush(stdout);
|
| 33 | 33 | }
|
| ... | ... | @@ -116,7 +116,7 @@ __attribute__((noreturn)) int run (char *exePath, |
| 116 | 116 | didn't do the trick either.
|
| 117 | 117 | |
| 118 | 118 | Irrespective of this issue, using CreateProcess() is preferable,
|
| 119 | - as it makes this wrapper work on both mingw and cygwin.
|
|
| 119 | + as it makes this wrapper work reliably on Windows.
|
|
| 120 | 120 | */
|
| 121 | 121 | #if 0
|
| 122 | 122 | fprintf(stderr, "Invoking %s\n", new_cmdline); fflush(stderr);
|
| ... | ... | @@ -28,6 +28,6 @@ bool isMinTTY() { |
| 28 | 28 | PWSTR fn = pfni->FileName;
|
| 29 | 29 | fn[pfni->FileNameLength] = L'\0';
|
| 30 | 30 | |
| 31 | - return ((wcsstr(fn, L"\\cygwin-") || wcsstr(fn, L"\\msys-")) &&
|
|
| 32 | - wcsstr(fn, L"-pty") && wcsstr(fn, L"-master"));
|
|
| 31 | + return (wcsstr(fn, L"\\msys-") &&
|
|
| 32 | + wcsstr(fn, L"-pty") && wcsstr(fn, L"-master"));
|
|
| 33 | 33 | } |
| ... | ... | @@ -116,7 +116,7 @@ __attribute__((noreturn)) int run (char *exePath, |
| 116 | 116 | didn't do the trick either.
|
| 117 | 117 | |
| 118 | 118 | Irrespective of this issue, using CreateProcess() is preferable,
|
| 119 | - as it makes this wrapper work on both mingw and cygwin.
|
|
| 119 | + as it makes this wrapper work reliably on Windows.
|
|
| 120 | 120 | */
|
| 121 | 121 | #if 0
|
| 122 | 122 | fprintf(stderr, "Invoking %s\n", new_cmdline); fflush(stderr);
|
| ... | ... | @@ -40,7 +40,7 @@ programContext stage pkg = do |
| 40 | 40 | ghcWithInterpreter :: Stage -> Action Bool
|
| 41 | 41 | ghcWithInterpreter stage = do
|
| 42 | 42 | is_cross <- flag CrossCompiling
|
| 43 | - goodOs <- anyTargetOs [ OSMinGW32, OSLinux, OSSolaris2 -- TODO "cygwin32"?,
|
|
| 43 | + goodOs <- anyTargetOs [ OSMinGW32, OSLinux, OSSolaris2
|
|
| 44 | 44 | , OSFreeBSD, OSDragonFly, OSNetBSD, OSOpenBSD
|
| 45 | 45 | , OSDarwin, OSKFreeBSD
|
| 46 | 46 | , OSWasi ]
|
| 1 | 1 | #include "HsBase.h"
|
| 2 | 2 | #include "HsFFI.h"
|
| 3 | 3 | |
| 4 | -#if defined(HAVE_WINSOCK_H) && !defined(__CYGWIN__)
|
|
| 4 | +#if defined(HAVE_WINSOCK_H)
|
|
| 5 | 5 | |
| 6 | 6 | static int winsock_inited = 0;
|
| 7 | 7 |
| ... | ... | @@ -3,17 +3,13 @@ |
| 3 | 3 | *
|
| 4 | 4 | * Win32 Console API support
|
| 5 | 5 | */
|
| 6 | -#if defined(_WIN32) || defined(__CYGWIN__)
|
|
| 6 | +#if defined(_WIN32)
|
|
| 7 | 7 | /* to the end */
|
| 8 | 8 | |
| 9 | 9 | #include "consUtils.h"
|
| 10 | 10 | #include <windows.h>
|
| 11 | 11 | #include <io.h>
|
| 12 | 12 | |
| 13 | -#if defined(__CYGWIN__)
|
|
| 14 | -#define _get_osfhandle get_osfhandle
|
|
| 15 | -#endif
|
|
| 16 | - |
|
| 17 | 13 | int is_console__(int fd) {
|
| 18 | 14 | DWORD st;
|
| 19 | 15 | HANDLE h;
|
| ... | ... | @@ -12,7 +12,7 @@ AC_USE_SYSTEM_EXTENSIONS |
| 12 | 12 | |
| 13 | 13 | AC_MSG_CHECKING(for WINDOWS platform)
|
| 14 | 14 | case $host_alias in
|
| 15 | - *mingw32*|*mingw64*|*cygwin*|*msys*|*windows*)
|
|
| 15 | + *mingw32*|*mingw64*|*msys*|*windows*)
|
|
| 16 | 16 | WINDOWS=YES;;
|
| 17 | 17 | *)
|
| 18 | 18 | WINDOWS=NO;;
|
| ... | ... | @@ -67,9 +67,7 @@ data Handler |
| 67 | 67 | -- running in a Windows console. Certain environments that look like consoles
|
| 68 | 68 | -- do not support console events, these include:
|
| 69 | 69 | --
|
| 70 | --- * Cygwin shells with @CYGWIN=tty@ set (if you don't set @CYGWIN=tty@,
|
|
| 71 | --- then a Cygwin shell behaves like a Windows console).
|
|
| 72 | --- * Cygwin xterm and rxvt windows
|
|
| 70 | +-- * MSYS MinTTY shells
|
|
| 73 | 71 | -- * MSYS rxvt windows
|
| 74 | 72 | --
|
| 75 | 73 | -- In order for your application to receive console events, avoid running
|
| ... | ... | @@ -575,7 +575,7 @@ hGetEcho handle = do |
| 575 | 575 | -- | Is the handle connected to a terminal?
|
| 576 | 576 | --
|
| 577 | 577 | -- On Windows the result of 'hIsTerminalDevide' might be misleading,
|
| 578 | --- because non-native terminals, such as MinTTY used in MSYS and Cygwin environments,
|
|
| 578 | +-- because non-native terminals, such as MinTTY used in MSYS environments,
|
|
| 579 | 579 | -- are implemented via redirection.
|
| 580 | 580 | -- Use @System.Win32.Types.withHandleToHANDLE System.Win32.MinTTY.isMinTTYHandle@
|
| 581 | 581 | -- to recognise it. Also consider @ansi-terminal@ package for crossplatform terminal
|
| ... | ... | @@ -3,11 +3,6 @@ AC_DEFUN([GHC_SELECT_FILE_EXTENSIONS], |
| 3 | 3 | $2=''
|
| 4 | 4 | $3='.so'
|
| 5 | 5 | case $1 in
|
| 6 | - *-unknown-cygwin32)
|
|
| 7 | - AC_MSG_WARN([GHC does not support the Cygwin target at the moment])
|
|
| 8 | - AC_MSG_WARN([I'm assuming you wanted to build for x86_64-w64-mingw32])
|
|
| 9 | - exit 1
|
|
| 10 | - ;;
|
|
| 11 | 6 | # examples: x86_64-w64-mingw32
|
| 12 | 7 | *-mingw32)
|
| 13 | 8 | windows=YES
|
| ... | ... | @@ -21,8 +21,8 @@ from pathlib import Path |
| 21 | 21 | # We don't actually need subprocess in runtests.py, but:
|
| 22 | 22 | # * We do need it in testlibs.py
|
| 23 | 23 | # * We can't import testlibs.py until after we have imported ctypes
|
| 24 | -# * If we import ctypes before subprocess on cygwin, then sys.exit(0)
|
|
| 25 | -# says "Aborted" and we fail with exit code 134.
|
|
| 24 | +# * If we import ctypes before subprocess on some Windows environments,
|
|
| 25 | +# then sys.exit(0) says "Aborted" and we fail with exit code 134.
|
|
| 26 | 26 | # So we import it here first, so that the testsuite doesn't appear to fail.
|
| 27 | 27 | import subprocess
|
| 28 | 28 | |
| ... | ... | @@ -182,16 +182,13 @@ elif args.ignore_perf_failures == 'decreases': |
| 182 | 182 | if args.test_env:
|
| 183 | 183 | config.test_env = args.test_env
|
| 184 | 184 | |
| 185 | -config.cygwin = False
|
|
| 186 | 185 | config.msys = False
|
| 187 | 186 | |
| 188 | 187 | if windows:
|
| 189 | 188 | h = os.popen('uname -s', 'r')
|
| 190 | 189 | v = h.read()
|
| 191 | 190 | h.close()
|
| 192 | - if v.startswith("CYGWIN"):
|
|
| 193 | - config.cygwin = True
|
|
| 194 | - elif v.startswith("MINGW") or v.startswith("MSYS"):
|
|
| 191 | + if v.startswith("MINGW") or v.startswith("MSYS"):
|
|
| 195 | 192 | # msys gives "MINGW32"
|
| 196 | 193 | # msys2 gives "MINGW_NT-6.2" or "MSYS_NT-6.3"
|
| 197 | 194 | config.msys = True
|
| ... | ... | @@ -274,12 +271,6 @@ def format_path(path): |
| 274 | 271 | # letter representation. Otherwise it thinks we're adding two env
|
| 275 | 272 | # variables E and /Foo when we add E:/Foo.
|
| 276 | 273 | path = re.sub('([a-zA-Z]):', '/\\1', path)
|
| 277 | - if config.cygwin:
|
|
| 278 | - # On cygwin we can't put "c:\foo" in $PATH, as : is a
|
|
| 279 | - # field separator. So convert to /cygdrive/c/foo instead.
|
|
| 280 | - # Other pythons use ; as the separator, so no problem.
|
|
| 281 | - path = re.sub('([a-zA-Z]):', '/cygdrive/\\1', path)
|
|
| 282 | - path = re.sub('\\\\', '/', path)
|
|
| 283 | 274 | return path
|
| 284 | 275 | |
| 285 | 276 | # On Windows we need to set $PATH to include the paths to all the DLLs
|
| ... | ... | @@ -80,7 +80,6 @@ class TestConfig: |
| 80 | 80 | self.os = ''
|
| 81 | 81 | self.arch = ''
|
| 82 | 82 | self.msys = False
|
| 83 | - self.cygwin = False
|
|
| 84 | 83 | |
| 85 | 84 | # What is the wordsize (in bits) of this platform?
|
| 86 | 85 | self.wordsize = ''
|
| ... | ... | @@ -1023,9 +1023,6 @@ def wordsize( ws: int ) -> bool: |
| 1023 | 1023 | def msys( ) -> bool:
|
| 1024 | 1024 | return config.msys
|
| 1025 | 1025 | |
| 1026 | -def cygwin( ) -> bool:
|
|
| 1027 | - return config.cygwin
|
|
| 1028 | - |
|
| 1029 | 1026 | def js_arch() -> bool:
|
| 1030 | 1027 | return arch("javascript");
|
| 1031 | 1028 |
| ... | ... | @@ -65,13 +65,13 @@ TEST_HC_OPTS_INTERACTIVE = $(TEST_HC_OPTS) --interactive -v0 -ignore-dot-ghci -f |
| 65 | 65 | |
| 66 | 66 | RUNTEST_OPTS =
|
| 67 | 67 | |
| 68 | -ifeq "$(filter $(TargetOS_CPP), cygwin32 mingw32)" ""
|
|
| 68 | +ifeq "$(filter $(TargetOS_CPP), mingw32)" ""
|
|
| 69 | 69 | exeext =
|
| 70 | 70 | else
|
| 71 | 71 | exeext = .exe
|
| 72 | 72 | endif
|
| 73 | 73 | |
| 74 | -ifneq "$(filter $(TargetOS_CPP),cygwin32 mingw32)" ""
|
|
| 74 | +ifneq "$(filter $(TargetOS_CPP),mingw32)" ""
|
|
| 75 | 75 | dllext = .dll
|
| 76 | 76 | else ifeq "$(TargetOS_CPP)" "darwin"
|
| 77 | 77 | dllext = .dylib
|
| ... | ... | @@ -39,10 +39,8 @@ loadFunction mpkg m valsym = do |
| 39 | 39 | where
|
| 40 | 40 | prefixUnderscore = case (os, arch) of
|
| 41 | 41 | ("mingw32", "x86_64") -> ""
|
| 42 | - ("cygwin" , "x86_64") -> ""
|
|
| 43 | 42 | ("mingw32", _ ) -> "_"
|
| 44 | 43 | ("darwin" , _ ) -> "_"
|
| 45 | - ("cygwin" , _ ) -> "_"
|
|
| 46 | 44 | _ -> ""
|
| 47 | 45 | |
| 48 | 46 | foreign import ccall safe "lookupSymbol" c_lookupSymbol :: CString -> IO (Ptr a)
|