@@ -18,7 +18,7 @@ let
19 configureFlags = lib.optional hostPlatform.isWindows "--disable-split-sections";
19 configureFlags = lib.optional hostPlatform.isWindows "--disable-split-sections";
21− wineIservWrapperVanilla = writeScriptBin "iserv-wrapper" ''
21+ wineIservWrapperScript = enableProfiling: writeScriptBin ("iserv-wrapper" + lib.optionalString enableProfiling "-prof") ''
22 #!${stdenv.shell}
22 #!${stdenv.shell}
23 set -euo pipefail
23 set -euo pipefail
24 # unset the configureFlags.
24 # unset the configureFlags.
@@ -28,25 +28,23 @@ let
28 unset configureFlags
28 unset configureFlags
29 PORT=$((5000 + $RANDOM % 5000))
29 PORT=$((5000 + $RANDOM % 5000))
30 (>&2 echo "---> Starting remote-iserv on port $PORT")
30 (>&2 echo "---> Starting remote-iserv on port $PORT")
31− WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag WINEPREFIX=$TMP ${wine}/bin/wine64 ${remote-iserv}/bin/remote-iserv.exe tmp $PORT &
31+ REMOTE_ISERV=$(mktemp -d)
32− (>&2 echo "---| remote-iserv should have started on $PORT")
32+ ln -s ${if enableProfiling then remote-iserv.override { inherit enableProfiling; } else remote-iserv}/bin/* $REMOTE_ISERV
33− RISERV_PID="$!"
33+ # See coment in comp-builder.nix for where this comes from and why it's here
34− ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT"
34+ for p in $pkgsHostTargetAsString; do
35− (>&2 echo "---> killing remote-iserv...")
35+ find "$p" -iname '*.dll' -exec ln -s {} $REMOTE_ISERV \;
36− kill $RISERV_PID
36+ find "$p" -iname '*.dll.a' -exec ln -s {} $REMOTE_ISERV \;
38−
38+ # Some DLLs have a `lib` prefix but we attempt to load them without the prefix.
39− wineIservWrapperProf = writeScriptBin "iserv-wrapper-prof" ''
39+ # This was a problem for `double-conversion` package when used in TH code.
40− #!${stdenv.shell}
40+ # Creating links from the `X.dll` to `libX.dll` works around this issue.
41− set -euo pipefail
41+ (
42− # unset the configureFlags.
42+ cd $REMOTE_ISERV
43− # configure should have run already
43+ for l in lib*.dll; do
44− # without restting it, wine might fail
44+ ln -s "$l" "''${l#lib}"
45− # due to a too large environment.
45+ done
46− unset configureFlags
46+ )
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 { enableProfiling = true; }}/bin/remote-iserv.exe tmp $PORT &
47+ WINEDLLOVERRIDES="winemac.drv=d" WINEDEBUG=warn-all,fixme-all,-menubuilder,-mscoree,-ole,-secur32,-winediag WINEPREFIX=$TMP ${wine}/bin/wine64 $REMOTE_ISERV/remote-iserv.exe tmp $PORT &
50 (>&2 echo "---| remote-iserv should have started on $PORT")
48 (>&2 echo "---| remote-iserv should have started on $PORT")
51 RISERV_PID="$!"
49 RISERV_PID="$!"
52 ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT"
50 ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT"
@@ -54,7 +52,7 @@ let
54 kill $RISERV_PID
52 kill $RISERV_PID
57− wineIservWrapper = symlinkJoin { name = "iserv-wrapper"; paths = [ wineIservWrapperVanilla wineIservWrapperProf ]; };
55+ wineIservWrapper = symlinkJoin { name = "iserv-wrapper"; paths = [ (wineIservWrapperScript false) (wineIservWrapperScript true) ]; };
59 ################################################################################
57 ################################################################################
60 # Build logic (TH support via remote iserv via wine)
58 # Build logic (TH support via remote iserv via wine)