on iko/ghcjs-patch-master help sign in
Profiled iserv for profiled builds (#574)

* Profiled iserv for profiled builds When trying to build profiled builds, we might end up in a situation where the library we load requires symbols from the profiled rts. In those cases we rely on the profiled RTS linked against iserv. Also ghc has the slightly annoying preference of adding the `-prof` suffix to the provided iserv program, thus we need two iservs now. * Update mingw_w64.nix Only prof, not debug.

commita6ad1b1775e348620a92b4d2b24dd7e02137be52 authorMoritz Angermann <moritz.angermann@gmail.com> dateSat 2 May 2020, 10:53 (6 years ago) parenta6d25ce
2 files changed+27−2
overlays/mingw_w64.nix+26−2 overlays/windows.nix+1
overlays/mingw_w64.nix+26−2
@@ -12,10 +12,13 @@
1212# when tests are run.
1313, extra-test-libs ? []
1414, hostPlatform
15+, symlinkJoin
1516}:
1617let
1718
18− wineIservWrapper = writeScriptBin "iserv-wrapper" ''
19+ configureFlags = lib.optional hostPlatform.isWindows "--disable-split-sections";
20+
21+ wineIservWrapperVanilla = writeScriptBin "iserv-wrapper" ''
1922 #!${stdenv.shell}
2023 set -euo pipefail
2124 # unset the configureFlags.
@@ -32,6 +35,27 @@ let
3235 (>&2 echo "---> killing remote-iserv...")
3336 kill $RISERV_PID
3437 '';
38+
39+ wineIservWrapperProf = writeScriptBin "iserv-wrapper-prof" ''
40+ #!${stdenv.shell}
41+ set -euo pipefail
42+ # unset the configureFlags.
43+ # configure should have run already
44+ # without restting it, wine might fail
45+ # due to a too large environment.
46+ unset configureFlags
47+ PORT=$((5000 + $RANDOM % 5000))
48+ (>&2 echo "---> Starting remote-iserv on port $PORT")
49+ WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag WINEPREFIX=$TMP ${wine}/bin/wine64 ${remote-iserv.override { enableExecutableProfiling = true; }}/bin/remote-iserv.exe tmp $PORT &
50+ (>&2 echo "---| remote-iserv should have started on $PORT")
51+ RISERV_PID="$!"
52+ ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT"
53+ (>&2 echo "---> killing remote-iserv...")
54+ kill $RISERV_PID
55+ '';
56+
57+ wineIservWrapper = symlinkJoin { name = "iserv-wrapper"; paths = [ wineIservWrapperVanilla wineIservWrapperProf ]; };
58+
3559 ################################################################################
3660 # Build logic (TH support via remote iserv via wine)
3761 #
@@ -89,4 +113,4 @@ let
89113 echo "================================================================================"
90114 '';
91115
92−in { inherit preCheck testWrapper postCheck setupBuildFlags; }
116+in { inherit preCheck testWrapper postCheck setupBuildFlags configureFlags; }
overlays/windows.nix+1
@@ -34,6 +34,7 @@ self: super:
3434 wine = pkgs.buildPackages.winePackages.minimal;
3535 inherit (pkgs.windows) mingw_w64_pthreads;
3636 inherit (pkgs) gmp;
37+ inherit (pkgs.buildPackages) symlinkJoin;
3738 # iserv-proxy needs to come from the buildPackages, as it needs to run on the
3839 # build host.
3940 inherit (self.buildPackages.ghc-extra-packages."${config.compiler.nix-name}".iserv-proxy.components.exes) iserv-proxy;