Skip to content

Commit 7466b2d

Browse files
Try #628:
2 parents ed67395 + a823ba4 commit 7466b2d

File tree

20 files changed

+5687
-14
lines changed

20 files changed

+5687
-14
lines changed

builder/comp-builder.nix

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp, zlib, ncurses, nodejs }:
22

33
lib.makeOverridable (
4-
let self =
4+
let self =
55
{ componentId
66
, component
77
, package
@@ -34,7 +34,10 @@ let self =
3434
, dontStrip ? component.dontStrip
3535

3636
, enableStatic ? component.enableStatic
37-
, enableShared ? component.enableShared && !haskellLib.isCrossHost
37+
, enableShared ? ghc.enableShared && component.enableShared && !haskellLib.isCrossHost
38+
# on x86 we'll use shared libraries, even with musl m(
39+
# ghc's internal linker seems to be broken on x86.
40+
&& !(stdenv.hostPlatform.isMusl && !stdenv.hostPlatform.isx86)
3841
, enableDeadCodeElimination ? component.enableDeadCodeElimination
3942

4043
# Options for Haddock generation
@@ -52,8 +55,15 @@ let self =
5255
# Data
5356
, enableSeparateDataOutput ? component.enableSeparateDataOutput
5457

58+
# Prelinked ghci libraries; will make iserv faster; especially for static builds.
59+
, enableLibraryForGhci ? true
60+
5561
# Debug
5662
, enableDebugRTS ? false
63+
, enableDWARF ? false
64+
65+
# LLVM
66+
, useLLVM ? ghc.useLLVM
5767
}@drvArgs:
5868

5969
let
@@ -112,6 +122,7 @@ let
112122
(enableFeature enableExecutableProfiling "executable-profiling")
113123
(enableFeature enableStatic "static")
114124
(enableFeature enableShared "shared")
125+
(enableFeature enableLibraryForGhci "library-for-ghci")
115126
] ++ lib.optionals (stdenv.hostPlatform.isMusl && (haskellLib.isExecutableType componentId)) [
116127
# These flags will make sure the resulting executable is statically linked.
117128
# If it uses other libraries it may be necessary for to add more
@@ -120,9 +131,6 @@ let
120131
"--disable-executable-dynamic"
121132
"--ghc-option=-optl=-pthread"
122133
"--ghc-option=-optl=-static"
123-
"--ghc-option=-optl=-L${gmp.override { withStatic = true; }}/lib"
124-
"--ghc-option=-optl=-L${zlib.static}/lib"
125-
"--ghc-option=-optl=-L${ncurses.override { enableStatic = true; }}/lib"
126134
] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"
127135
++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
128136
++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
@@ -133,6 +141,10 @@ let
133141
++ configureFlags
134142
++ (ghc.extraConfigureFlags or [])
135143
++ lib.optional enableDebugRTS "--ghc-option=-debug"
144+
++ lib.optional enableDWARF "--ghc-option=-g"
145+
++ lib.optionals useLLVM [
146+
"--ghc-option=-fPIC" "--gcc-option=-fPIC"
147+
]
136148
);
137149

138150
setupGhcOptions = lib.optional (package.ghcOptions != null) '' --ghc-options="${package.ghcOptions}"'';

compiler/ghc/default.nix

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ let
105105
'' + stdenv.lib.optionalString (!enableTerminfo) ''
106106
WITH_TERMINFO=NO
107107
''
108+
# musl doesn't have a system-linker. Only on x86, and on x86 we need it, as
109+
# our elf linker for x86_64 is broken.
110+
+ stdenv.lib.optionalString (targetPlatform.isMusl && !targetPlatform.isx86) ''
111+
compiler_CONFIGURE_OPTS += --flags=-dynamic-system-linker
112+
''
108113
# While split sections are now enabled by default in ghc 8.8 for windows,
109114
# the seem to lead to `too many sections` errors when building base for
110115
# profiling.
@@ -333,6 +338,7 @@ in let configured-src = stdenv.mkDerivation (rec {
333338

334339
inherit llvmPackages;
335340
inherit enableShared;
341+
inherit useLLVM;
336342

337343
# Our Cabal compiler name
338344
haskellCompilerName = "ghc-${version}";

materialized/dummy-ghc/aarch64-unknown-linux-musl-aarch64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc-pkg/dump-global

Lines changed: 1221 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/aarch64-unknown-linux-musl-aarch64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc-pkg/version

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/aarch64-unknown-linux-musl-aarch64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc/info

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/aarch64-unknown-linux-musl-aarch64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc/numeric-version

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

materialized/dummy-ghc/aarch64-unknown-linux-musl-aarch64-unknown-linux-musl-ghc-8.6.5-x86_64-linux/ghc/supported-languages

Lines changed: 247 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)