Skip to content

Commit bd92fa4

Browse files
Try #1450:
2 parents 45a9357 + be54380 commit bd92fa4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+12922
-8
lines changed

ci.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107"]))) {
6464
inherit (lib.systems.examples) ghcjs;
6565
} // lib.optionalAttrs (system == "x86_64-linux" &&
66-
nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc8107"])) {
66+
nixpkgsName == "unstable" && (__elem compiler-nix-name ["ghc8107" "ghc902" "ghc922"])) {
6767
# Windows cross compilation is currently broken on macOS
6868
inherit (lib.systems.examples) mingwW64;
6969
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && compiler-nix-name == "ghc8107") {

compiler/ghc/default.nix

+19-2
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,30 @@ stdenv.mkDerivation (rec {
384384
dontStrip = true;
385385
dontPatchELF = true;
386386
noAuditTmpdir = true;
387-
} // lib.optionalAttrs stdenv.buildPlatform.isDarwin {
387+
} // lib.optionalAttrs (stdenv.buildPlatform.isDarwin || stdenv.targetPlatform.isWindows) {
388388
# ghc install on macOS wants to run `xattr -r -c`
389389
# The macOS version fails because it wants python 2.
390390
# The nix version of xattr does not support those args.
391391
# Luckily setting the path to something that does not exist will skip the step.
392-
preBuild = ''
392+
preBuild = lib.optionalString stdenv.buildPlatform.isDarwin ''
393393
export XATTR=$(mktemp -d)/nothing
394+
''
395+
# We need to point at a stand in `windows.h` header file so that the RTS headers can
396+
# work on the hostPlatform. We also need to work around case sensitve file system issues.
397+
+ lib.optionalString stdenv.targetPlatform.isWindows ''
398+
export NIX_CFLAGS_COMPILE_${
399+
# We want this only to apply to the non windows hostPlatform (the
400+
# windows gcc cross compiler has a full `windows.h`).
401+
# This matches the way `suffixSalt` is calculated in nixpkgs.
402+
# See https://github.com/NixOS/nixpkgs/blob/8411006d6bcd7f6e6a8a1a80ce8fcdccdd16c6ab/pkgs/build-support/cc-wrapper/default.nix#L58
403+
lib.replaceStrings ["-" "."] ["_" "_"] stdenv.hostPlatform.config
404+
}+=" -I${../windows/include}"
405+
if [[ -f libraries/base/include/winio_structs.h ]]; then
406+
substituteInPlace libraries/base/include/winio_structs.h --replace Windows.h windows.h
407+
fi
408+
if [[ -f rts/win32/ThrIOManager.c ]]; then
409+
substituteInPlace rts/win32/ThrIOManager.c --replace rts\\OSThreads.h rts/OSThreads.h
410+
fi
394411
'';
395412
});
396413
in self

compiler/windows/include/synchapi.h

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <windows.h>

compiler/windows/include/windows.h

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Just enoough windows.h stuff to make rts headers usable when building GHC cross compiler.
2+
// See compiler/ghc/default.nix for where this is used.
3+
#ifndef _WINDOWS_
4+
#define _WINDOWS_
5+
6+
#define __stdcall
7+
8+
typedef unsigned long DWORD;
9+
typedef void * PVOID;
10+
11+
typedef struct _RTL_CONDITION_VARIABLE { PVOID Ptr; } RTL_CONDITION_VARIABLE;
12+
typedef RTL_CONDITION_VARIABLE CONDITION_VARIABLE;
13+
14+
typedef struct _RTL_SRWLOCK { PVOID Ptr; } RTL_SRWLOCK;
15+
typedef RTL_SRWLOCK SRWLOCK;
16+
17+
#endif
18+

materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-9.0.1-x86_64-linux/ghc-pkg/dump-global

+1,504
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-9.0.1-x86_64-linux/ghc-pkg/version

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-9.0.1-x86_64-linux/ghc/info

+70
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-9.0.1-x86_64-linux/ghc/numeric-version

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/x86_64-w64-mingw32-x86_64-w64-mingw32-ghc-9.0.1-x86_64-linux/ghc/supported-languages

+261
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)