diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 7a421e4f7b68..09ab30bb1761 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -20,7 +20,8 @@ # TODO enable shared libs for cross-compiling , enableSharedExecutables ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)) , enableSharedLibraries ? !isCross && (((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)) -, enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013 +, enableSplitObjs ? null # OBSOLETE, use enableDeadCodeElimination +, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin , enableStaticLibraries ? true , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? [] , homepage ? "http://hackage.haskell.org/package/${pname}" @@ -53,6 +54,8 @@ } @ args: assert editedCabalFile != null -> revision != null; +# OBSOLETE, use enableDeadCodeElimination +assert enableSplitObjs == null; let @@ -108,13 +111,15 @@ let (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names") (optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES") (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp") - (enableFeature enableSplitObjs "split-objs") + (enableFeature (enableDeadCodeElimination && (stdenv.lib.versionAtLeast "8.0.1" ghc.version)) "split-objs") (enableFeature enableLibraryProfiling "library-profiling") (enableFeature enableExecutableProfiling (if versionOlder ghc.version "8" then "executable-profiling" else "profiling")) (enableFeature enableSharedLibraries "shared") (optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature enableStaticLibraries "library-vanilla")) (optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic")) (optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests")) + ] ++ optionals (enableDeadCodeElimination && (stdenv.lib.versionOlder "8.0.1" ghc.version)) [ + "--ghc-option=-split-sections" ] ++ optionals isGhcjs [ "--with-hsc2hs=${nativeGhc}/bin/hsc2hs" "--ghcjs" diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix index 246a9f305dba..f7c9811234ec 100644 --- a/pkgs/development/haskell-modules/lib.nix +++ b/pkgs/development/haskell-modules/lib.nix @@ -50,8 +50,8 @@ rec { enableSharedLibraries = drv: overrideCabal drv (drv: { enableSharedLibraries = true; }); disableSharedLibraries = drv: overrideCabal drv (drv: { enableSharedLibraries = false; }); - enableSplitObjs = drv: overrideCabal drv (drv: { enableSplitObjs = true; }); - disableSplitObjs = drv: overrideCabal drv (drv: { enableSplitObjs = false; }); + enableDeadCodeElimination = drv: overrideCabal drv (drv: { enableDeadCodeElimination = true; }); + disableDeadCodeElimination = drv: overrideCabal drv (drv: { enableDeadCodeElimination = false; }); enableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = true; }); disableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = false; });