on iko/ghcjs-patch-master help sign in
Properly build profling executables (#571)

When building profiling executables we want the libraries also with profiling. This change also adds a flag to link against the debug RTS. This does not require everything to be built against the debug RTS and only requires the final linking step, hence no threading is necessary.

commitccd52aa2fdcfa1541604d9e123bafcc9384550ef authorMoritz Angermann <moritz.angermann@gmail.com> dateFri 1 May 2020, 20:24 (7 years ago) parent5813be5
2 files changed+9−3
builder/comp-builder.nix+5 builder/make-config-files.nix+4−3
builder/comp-builder.nix+5
@@ -41,6 +41,9 @@ lib.makeOverridable (
4141
4242# Data
4343, enableSeparateDataOutput ? component.enableSeparateDataOutput
44+
45+# Debug
46+, enableDebugRTS ? false
4447}:
4548
4649let
@@ -56,6 +59,7 @@ let
5659 configFiles = makeConfigFiles {
5760 inherit (package) identifier;
5861 inherit component fullName flags;
62+ needsProfiling = enableExecutableProfiling || enableLibraryProfiling;
5963 };
6064
6165 enableFeature = enable: feature:
@@ -114,6 +118,7 @@ let
114118 ++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )
115119 ++ component.configureFlags
116120 ++ (ghc.extraConfigureFlags or [])
121+ ++ lib.optional enableDebugRTS "--ghc-option=-debug"
117122 );
118123
119124 setupGhcOptions = lib.optional (package.ghcOptions != null) '' --ghc-options="${package.ghcOptions}"'';
builder/make-config-files.nix+4−3
@@ -63,12 +63,13 @@ let
6363 libDir = "lib/${ghcCommand}-${ghc.version}";
6464 packageCfgDir = "${libDir}/package.conf.d";
6565
66−in { identifier, component, fullName, flags ? {} }:
66+in { identifier, component, fullName, flags ? {}, needsProfiling ? false }:
6767 # Filters out only library packages that for this GHC target
6868 # TODO investigate why this is needed
6969 # TODO find out why p ? configFiles helps (for instance for `R1909.aarch64-unknown-linux-gnu.tests.cabal-22.run.x86_64-linux`)
70− let libDeps = lib.filter (p: (p ? configFiles) && p.configFiles.targetPrefix == ghc.targetPrefix)
71− (map getLibComponent component.depends);
70+ let libDeps = (if needsProfiling then (x: map (p: p.override { enableLibraryProfiling = true; }) x) else x: x)
71+ (lib.filter (p: (p ? configFiles) && p.configFiles.targetPrefix == ghc.targetPrefix)
72+ (map getLibComponent component.depends));
7273 cfgFiles =
7374 let xs = map
7475 (p: "${p.configFiles}")