on iko/ghcjs-patch-master help sign in
Properly build profling executables (#571)
ccd52aaMoritz Angermann
builder/comp-builder.nix+5
@@ -41,6 +41,9 @@ lib.makeOverridable (
41
41
42# Data
42# Data
43, enableSeparateDataOutput ? component.enableSeparateDataOutput
43, enableSeparateDataOutput ? component.enableSeparateDataOutput
44+
45+# Debug
46+, enableDebugRTS ? false
44}:
47}:
45
48
46let
49let
@@ -56,6 +59,7 @@ let
56 configFiles = makeConfigFiles {
59 configFiles = makeConfigFiles {
57 inherit (package) identifier;
60 inherit (package) identifier;
58 inherit component fullName flags;
61 inherit component fullName flags;
62+ needsProfiling = enableExecutableProfiling || enableLibraryProfiling;
59 };
63 };
60
64
61 enableFeature = enable: feature:
65 enableFeature = enable: feature:
@@ -114,6 +118,7 @@ let
114 ++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )
118 ++ lib.optional (package.buildType == "Configure") "--configure-option=--host=${stdenv.hostPlatform.config}" )
115 ++ component.configureFlags
119 ++ component.configureFlags
116 ++ (ghc.extraConfigureFlags or [])
120 ++ (ghc.extraConfigureFlags or [])
121+ ++ lib.optional enableDebugRTS "--ghc-option=-debug"
117 );
122 );
118
123
119 setupGhcOptions = lib.optional (package.ghcOptions != null) '' --ghc-options="${package.ghcOptions}"'';
124 setupGhcOptions = lib.optional (package.ghcOptions != null) '' --ghc-options="${package.ghcOptions}"'';
builder/make-config-files.nix+4−3
@@ -63,12 +63,13 @@ let
63 libDir = "lib/${ghcCommand}-${ghc.version}";
63 libDir = "lib/${ghcCommand}-${ghc.version}";
64 packageCfgDir = "${libDir}/package.conf.d";
64 packageCfgDir = "${libDir}/package.conf.d";
65
65
66−in { identifier, component, fullName, flags ? {} }:
66+in { identifier, component, fullName, flags ? {}, needsProfiling ? false }:
67 # Filters out only library packages that for this GHC target
67 # Filters out only library packages that for this GHC target
68 # TODO investigate why this is needed
68 # TODO investigate why this is needed
69 # TODO find out why p ? configFiles helps (for instance for `R1909.aarch64-unknown-linux-gnu.tests.cabal-22.run.x86_64-linux`)
69 # 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 = (if needsProfiling then (x: map (p: p.override { enableLibraryProfiling = true; }) x) else x: x)
70− let libDeps = lib.filter (p: (p ? configFiles) && p.configFiles.targetPrefix == ghc.targetPrefix)
71+ (lib.filter (p: (p ? configFiles) && p.configFiles.targetPrefix == ghc.targetPrefix)
71− (map getLibComponent component.depends);
72+ (map getLibComponent component.depends));
72 cfgFiles =
73 cfgFiles =
73 let xs = map
74 let xs = map
74 (p: "${p.configFiles}")
75 (p: "${p.configFiles}")