Skip to content

Commit 6c57d4f

Browse files
authored
Faster profiled builds (#623)
1 parent 2819a93 commit 6c57d4f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

builder/comp-builder.nix

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{ stdenv, buildPackages, ghc, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, ghcForComponent, hsPkgs, runCommand, libffi, gmp, zlib, ncurses, nodejs }:
22

33
lib.makeOverridable (
4+
let self =
45
{ componentId
56
, component
67
, package
@@ -53,7 +54,7 @@ lib.makeOverridable (
5354

5455
# Debug
5556
, enableDebugRTS ? false
56-
}:
57+
}@drvArgs:
5758

5859
let
5960
# TODO fix cabal wildcard support so hpack wildcards can be mapped to cabal wildcards
@@ -188,6 +189,7 @@ stdenv.mkDerivation ({
188189
# The directory containing the haddock documentation.
189190
# `null' if no haddock documentation was built.
190191
haddockDir = if doHaddock' then "${docdir drv.doc}/html" else null;
192+
profiled = self (drvArgs // { enableLibraryProfiling = true; });
191193
};
192194

193195
meta = {
@@ -379,4 +381,4 @@ stdenv.mkDerivation ({
379381
preInstall postInstall preHaddock postHaddock;
380382
}
381383
// lib.optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${buildPackages.glibcLocales}/lib/locale/locale-archive"; }
382-
)))
384+
)); in self)

builder/make-config-files.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ in { identifier, component, fullName, flags ? {}, needsProfiling ? false }:
4545
# Filters out only library packages that for this GHC target
4646
# TODO investigate why this is needed
4747
# TODO find out why p ? configFiles helps (for instance for `R1909.aarch64-unknown-linux-gnu.tests.cabal-22.run.x86_64-linux`)
48-
let libDeps = (if needsProfiling then (x: map (p: p.override { enableLibraryProfiling = true; }) x) else x: x)
48+
let libDeps = (if needsProfiling then (x: map (p: p.profiled or p) x) else x: x)
4949
(lib.filter (p: (p ? configFiles) && p.configFiles.targetPrefix == ghc.targetPrefix)
5050
(map getLibComponent component.depends));
5151
cfgFiles =

0 commit comments

Comments
 (0)