@@ -20,16 +20,17 @@
2020, preHaddock ? component.preHaddock , postHaddock ? component.postHaddock
2121, shellHook ? ""
2222
23−, dontPatchELF ? true
24−, dontStrip ? true
23+, dontPatchELF ? component.dontPatchELF
24+, dontStrip ? component.dontStrip
2525
26−, static ? stdenv.hostPlatform.isMusl
27−, deadCodeElimination ? true
26+, enableStatic ? component.enableStatic
27+, enableShared ? component.enableShared
28+, enableDeadCodeElimination ? component.enableDeadCodeElimination
2829
2930# Options for Haddock generation
3031, doHaddock ? component.doHaddock # Enable haddock and hoogle generation
31−, doHoogle ? true # Also build a hoogle index
32−, hyperlinkSource ? true # Link documentation to the source code
32+, doHoogle ? component.doHoogle # Also build a hoogle index
33+, hyperlinkSource ? component.doHyperlinkSource # Link documentation to the source code
3334
3435# Profiling
3536, enableLibraryProfiling ? component.enableLibraryProfiling
@@ -55,6 +56,11 @@ let
5556 inherit component fullName flags;
5657 };
5758
59+ enableFeature = enable: feature:
60+ (if enable then "--enable-" else "--disable-") + feature;
61+
62+ disableFeature = disable: enableFeature (!disable);
63+
5864 finalConfigureFlags = lib.concatStringsSep " " (
5965 [ "--prefix=$out"
6066 "${haskellLib.componentTarget componentId}"
@@ -82,15 +88,16 @@ let
8288 "--with-strip=${stdenv.cc.bintools.targetPrefix}strip"
8389 ]
8490 ) ++ [ # other flags
85− (if dontStrip then "--disable-executable-stripping" else "--enable-executable-stripping")
86− (if dontStrip then "--disable-library-stripping" else "--enable-library-stripping")
87− (if enableLibraryProfiling then "--enable-library-profiling" else "--disable-library-profiling" )
88− (if enableExecutableProfiling then "--enable-executable-profiling" else "--disable-executable-profiling" )
91+ (disableFeature dontStrip "executable-stripping")
92+ (disableFeature dontStrip "library-stripping")
93+ (enableFeature enableLibraryProfiling "library-profiling")
94+ (enableFeature enableExecutableProfiling "executable-profiling")
95+ (enableFeature enableStatic "static")
96+ (enableFeature enableShared "shared")
8997 ] ++ lib.optional enableSeparateDataOutput "--datadir=$data/share/${ghc.name}"
9098 ++ lib.optional doHaddock' "--docdir=${docdir "$doc"}"
9199 ++ lib.optional (enableLibraryProfiling || enableExecutableProfiling) "--profiling-detail=${profilingDetail}"
92− ++ lib.optional (deadCodeElimination && stdenv.hostPlatform.isLinux) "--enable-split-sections"
93− ++ lib.optional (static) "--enable-static"
100+ ++ lib.optional stdenv.hostPlatform.isLinux (enableFeature enableDeadCodeElimination "split-sections")
94101 ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) (
95102 map (arg: "--hsc2hs-option=" + arg) (["--cross-compile"] ++ lib.optionals (stdenv.hostPlatform.isWindows) ["--via-asm"])
96103 ++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )