| ... |
... |
@@ -11,69 +11,67 @@ let |
|
11
|
11
|
hsPkgs = pkgs.haskellPackages;
|
|
12
|
12
|
alex = hsPkgs.alex;
|
|
13
|
13
|
happy = hsPkgs.happy;
|
|
14
|
|
- targetTriple = pkgs.stdenv.targetPlatform.config;
|
|
|
14
|
+ targetTriple = pkgs.stdenvNoCC.targetPlatform.config;
|
|
15
|
15
|
|
|
16
|
16
|
ghcBindists = let version = ghc.version; in {
|
|
17
|
|
- aarch64-darwin = hostPkgs.fetchurl {
|
|
|
17
|
+ aarch64-darwin = hostPkgs.fetchzip {
|
|
18
|
18
|
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-aarch64-apple-darwin.tar.xz";
|
|
19
|
|
- sha256 = "sha256-/6+DtdeossBJIMbjkJwL4h3eJ7rzgNCV+ifoQKOi6AQ=";
|
|
|
19
|
+ hash = "sha512-xUlt7zc/OT3a1SR0BxmFFgrabPkWUENATdw4NbQwEi5+nH5yPau+HSrGI5UUoKdO4gdpgZlPaxtI7eSk0fx1+g==";
|
|
20
|
20
|
};
|
|
21
|
|
- x86_64-darwin = hostPkgs.fetchurl {
|
|
|
21
|
+ x86_64-darwin = hostPkgs.fetchzip {
|
|
22
|
22
|
url = "https://downloads.haskell.org/ghc/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
|
|
23
|
|
- sha256 = "sha256-jPIhiJMOENesUnDUJeIaPatgavc6ZVSTY5NFIAxlC+k=";
|
|
|
23
|
+ hash = "sha512-4/INeJwPPGbOj9MepwnIvIg2lvFkqS8w/3U/I8f6gCsoNlgwPr78iyY9vd6vfMONR1GxNQU3L/lxE07F3P0Qag==";
|
|
24
|
24
|
};
|
|
25
|
|
-
|
|
26
|
25
|
};
|
|
27
|
26
|
|
|
28
|
|
- ghc = pkgs.stdenv.mkDerivation rec {
|
|
29
|
|
- version = "9.10.1";
|
|
|
27
|
+ ghc = pkgs.stdenvNoCC.mkDerivation rec {
|
|
|
28
|
+ version = "9.10.3";
|
|
30
|
29
|
name = "ghc";
|
|
31
|
|
- src = ghcBindists.${pkgs.stdenv.hostPlatform.system};
|
|
|
30
|
+ src = ghcBindists.${pkgs.stdenvNoCC.hostPlatform.system};
|
|
|
31
|
+
|
|
|
32
|
+ dontUpdateAutotoolsGnuConfigScripts = true;
|
|
|
33
|
+
|
|
32
|
34
|
configureFlags = [
|
|
33
|
|
- "CC=/usr/bin/clang"
|
|
34
|
|
- "CLANG=/usr/bin/clang"
|
|
35
|
35
|
"AR=/usr/bin/ar"
|
|
36
|
|
- "LLC=${llvm}/bin/llc"
|
|
37
|
|
- "OPT=${llvm}/bin/opt"
|
|
38
|
|
- "LLVMAS=${llvm_clang}/bin/clang"
|
|
39
|
|
- "CONF_CC_OPTS_STAGE2=--target=${targetTriple}"
|
|
40
|
|
- "CONF_CXX_OPTS_STAGE2=--target=${targetTriple}"
|
|
41
|
|
- "CONF_GCC_LINKER_OPTS_STAGE2=--target=${targetTriple}"
|
|
|
36
|
+ "CC=/usr/bin/clang"
|
|
|
37
|
+ "CXX=/usr/bin/clang++"
|
|
|
38
|
+ "INSTALL=/usr/bin/install"
|
|
|
39
|
+ "INSTALL_NAME_TOOL=/usr/bin/install_name_tool"
|
|
|
40
|
+ "MergeObjsCmd=/usr/bin/ld"
|
|
|
41
|
+ "NM=/usr/bin/nm"
|
|
|
42
|
+ "OTOOL=/usr/bin/otool"
|
|
|
43
|
+ "RANLIB=/usr/bin/ranlib"
|
|
42
|
44
|
];
|
|
43
|
|
- buildPhase = "true";
|
|
44
|
|
-
|
|
45
|
|
- # This is a horrible hack because the configure script invokes /usr/bin/clang
|
|
46
|
|
- # without a `--target` flag. Then depending on whether the `nix` binary itself is
|
|
47
|
|
- # a native x86 or arm64 binary means that /usr/bin/clang thinks it needs to run in
|
|
48
|
|
- # x86 or arm64 mode.
|
|
49
|
|
-
|
|
50
|
|
- # The correct answer for the check in question is the first one we try, so by replacing
|
|
51
|
|
- # the condition to true; we select the right C++ standard library still.
|
|
52
|
|
- preConfigure = ''
|
|
53
|
|
- sed "s/\"\$CC\" -o actest actest.o \''${1} 2>\/dev\/null/true/i" configure > configure.new
|
|
54
|
|
- mv configure.new configure
|
|
55
|
|
- chmod +x configure
|
|
56
|
|
- cat configure
|
|
57
|
45
|
|
|
|
46
|
+ # Use the arch command to explicitly specify architecture, so that
|
|
|
47
|
+ # configure and its subprocesses would pick up the architecture we
|
|
|
48
|
+ # choose via the system argument.
|
|
|
49
|
+ preConfigure = pkgs.lib.optionalString (system == "aarch64-darwin") ''
|
|
|
50
|
+ substituteInPlace configure \
|
|
|
51
|
+ --replace-fail "#! /bin/sh" "#!/usr/bin/env -S /usr/bin/arch -arm64 /bin/sh"
|
|
|
52
|
+ '' + pkgs.lib.optionalString (system == "x86_64-darwin") ''
|
|
|
53
|
+ substituteInPlace configure \
|
|
|
54
|
+ --replace-fail "#! /bin/sh" "#!/usr/bin/env -S /usr/bin/arch -x86_64 /bin/sh"
|
|
|
55
|
+ '' + ''
|
|
|
56
|
+ unset DEVELOPER_DIR SDKROOT
|
|
|
57
|
+ export DEVELOPER_DIR="$(/usr/bin/xcode-select --print-path)"
|
|
|
58
|
+ export SDKROOT="$(/usr/bin/xcrun --sdk macosx --show-sdk-path)"
|
|
58
|
59
|
'';
|
|
59
|
60
|
|
|
|
61
|
+ dontPatchShebangsInConfigure = true;
|
|
|
62
|
+
|
|
60
|
63
|
# N.B. Work around #20253.
|
|
61
|
64
|
nativeBuildInputs = [ pkgs.gnused ];
|
|
62
|
|
- postInstallPhase = ''
|
|
63
|
|
- settings="$out/lib/ghc-${version}/settings"
|
|
64
|
|
- sed -i -e "s%\"llc\"%\"${llvm}/bin/llc\"%" $settings
|
|
65
|
|
- sed -i -e "s%\"opt\"%\"${llvm}/bin/opt\"%" $settings
|
|
66
|
|
- sed -i -e "s%\"clang\"%\"/usr/bin/clang\"%" $settings
|
|
67
|
|
- sed -i -e 's%("C compiler command", "")%("C compiler command", "/usr/bin/clang")%' $settings
|
|
68
|
|
- sed -i -e 's%("C compiler flags", "")%("C compiler flags", "--target=${targetTriple}")%' $settings
|
|
69
|
|
- sed -i -e 's%("C++ compiler flags", "")%("C++ compiler flags", "--target=${targetTriple}")%' $settings
|
|
70
|
|
- sed -i -e 's%("C compiler link flags", "")%("C compiler link flags", "--target=${targetTriple}")%' $settings
|
|
71
|
|
- '';
|
|
|
65
|
+
|
|
|
66
|
+ dontBuild = true;
|
|
|
67
|
+
|
|
|
68
|
+ enableParallelInstalling = true;
|
|
|
69
|
+
|
|
|
70
|
+ dontFixup = true;
|
|
72
|
71
|
|
|
73
|
72
|
# Sanity check: verify that we can compile hello world.
|
|
74
|
73
|
doInstallCheck = true;
|
|
75
|
74
|
installCheckPhase = ''
|
|
76
|
|
- unset DYLD_LIBRARY_PATH
|
|
77
|
75
|
$out/bin/ghc --info
|
|
78
|
76
|
cd $TMP
|
|
79
|
77
|
mkdir test-ghc; cd test-ghc
|
| ... |
... |
@@ -91,13 +89,13 @@ let |
|
91
|
89
|
ourtexlive = with pkgs;
|
|
92
|
90
|
texlive.combine {
|
|
93
|
91
|
inherit (texlive)
|
|
94
|
|
- scheme-medium collection-xetex fncychap titlesec tabulary varwidth
|
|
|
92
|
+ scheme-small collection-xetex fncychap tex-gyre titlesec tabulary varwidth
|
|
95
|
93
|
framed capt-of wrapfig needspace dejavu-otf helvetic upquote;
|
|
96
|
94
|
};
|
|
97
|
95
|
fonts = with pkgs; makeFontsConf { fontDirectories = [ dejavu_fonts ]; };
|
|
98
|
96
|
|
|
99
|
|
- llvm = pkgs.llvm_15;
|
|
100
|
|
- llvm_clang = pkgs.llvmPackages_15.clang-unwrapped;
|
|
|
97
|
+ llvm = pkgs.llvm_21;
|
|
|
98
|
+ llvm_clang = pkgs.llvmPackages_21.clang-unwrapped;
|
|
101
|
99
|
in
|
|
102
|
100
|
pkgs.writeTextFile {
|
|
103
|
101
|
name = "toolchain";
|