@@ -20,16 +20,17 @@
20, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
20, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
21, shellHook ? ""
21, shellHook ? ""
23−, dontPatchELF ? true
23+, dontPatchELF ? component.dontPatchELF
24−, dontStrip ? true
24+, dontStrip ? component.dontStrip
26−, static ? stdenv.hostPlatform.isMusl
26+, enableStatic ? component.enableStatic
27−, deadCodeElimination ? true
27+, enableShared ? component.enableShared
28+, enableDeadCodeElimination ? component.enableDeadCodeElimination
29# Options for Haddock generation
30# Options for Haddock generation
30, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
31, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
31−, doHoogle ? true # Also build a hoogle index
32+, doHoogle ? component.doHoogle # Also build a hoogle index
32−, hyperlinkSource ? true # Link documentation to the source code
33+, hyperlinkSource ? component.doHyperlinkSource # Link documentation to the source code
34# Profiling
35# Profiling
35, enableLibraryProfiling ? component.enableLibraryProfiling
36, enableLibraryProfiling ? component.enableLibraryProfiling
@@ -55,6 +56,11 @@ let
55 inherit component fullName flags;
56 inherit component fullName flags;
59+ enableFeature = enable: feature:
60+ (if enable then "--enable-" else "--disable-") + feature;
62+ disableFeature = disable: enableFeature (!disable);
58 finalConfigureFlags = lib.concatStringsSep " " (
64 finalConfigureFlags = lib.concatStringsSep " " (
59 [ "--prefix=$out"
65 [ "--prefix=$out"
60 "${haskellLib.componentTarget componentId}"
66 "${haskellLib.componentTarget componentId}"
@@ -82,15 +88,16 @@ let
82 "--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
88 "--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
84 ) ++ [ # other flags
90 ) ++ [ # other flags
85− (if dontStrip then "--disable-executable-stripping" else "--enable-executable-stripping")
91+ (disableFeature dontStrip "executable-stripping")
86− (if dontStrip then "--disable-library-stripping" else "--enable-library-stripping")
92+ (disableFeature dontStrip "library-stripping")
87− (if enableLibraryProfiling then "--enable-library-profiling" else "--disable-library-profiling" )
93+ (enableFeature enableLibraryProfiling "library-profiling")
88− (if enableExecutableProfiling then "--enable-executable-profiling" else "--disable-executable-profiling" )
94+ (enableFeature enableExecutableProfiling "executable-profiling")
95+ (enableFeature enableStatic "static")
96+ (enableFeature enableShared "shared")
89 ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"
97 ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"
90 ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
98 ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
91 ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
99 ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
92− ++ lib.optional (deadCodeElimination && stdenv.hostPlatform.isLinux) "--enable-split-sections"
100+ ++ lib.optional stdenv.hostPlatform.isLinux (enableFeature enableDeadCodeElimination "split-sections")
93− ++ lib.optional (static) "--enable-static"
94 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) (
101 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) (
95 map (arg: "--hsc2hs-option=" + arg) (["--cross-compile"] ++ lib.optionals (stdenv.hostPlatform.isWindows) ["--via-asm"])
102 map (arg: "--hsc2hs-option=" + arg) (["--cross-compile"] ++ lib.optionals (stdenv.hostPlatform.isWindows) ["--via-asm"])
96 ++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )
103 ++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )