@@ -18,7 +18,7 @@ let
1818
1919 configureFlags = lib.optional hostPlatform.isWindows "--disable-split-sections";
2020
21− wineIservWrapperVanilla = writeScriptBin "iserv-wrapper" ''
21+ wineIservWrapperScript = enableProfiling: writeScriptBin ("iserv-wrapper" + lib.optionalString enableProfiling "-prof") ''
2222 #!${stdenv.shell}
2323 set -euo pipefail
2424 # unset the configureFlags.
@@ -28,25 +28,23 @@ let
2828 unset configureFlags
2929 PORT=$((5000 + $RANDOM % 5000))
3030 (>&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 &
32− (>&2 echo "---| remote-iserv should have started on $PORT")
33− RISERV_PID="$!"
34− ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT"
35− (>&2 echo "---> killing remote-iserv...")
36− kill $RISERV_PID
37− '';
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 { enableProfiling = true; }}/bin/remote-iserv.exe tmp $PORT &
31+ REMOTE_ISERV=$(mktemp -d)
32+ ln -s ${if enableProfiling then remote-iserv.override { inherit enableProfiling; } else remote-iserv}/bin/* $REMOTE_ISERV
33+ # See coment in comp-builder.nix for where this comes from and why it's here
34+ for p in $pkgsHostTargetAsString; do
35+ find "$p" -iname '*.dll' -exec ln -s {} $REMOTE_ISERV \;
36+ find "$p" -iname '*.dll.a' -exec ln -s {} $REMOTE_ISERV \;
37+ done
38+ # Some DLLs have a `lib` prefix but we attempt to load them without the prefix.
39+ # This was a problem for `double-conversion` package when used in TH code.
40+ # Creating links from the `X.dll` to `libX.dll` works around this issue.
41+ (
42+ cd $REMOTE_ISERV
43+ for l in lib*.dll; do
44+ ln -s "$l" "''${l#lib}"
45+ done
46+ )
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 &
5048 (>&2 echo "---| remote-iserv should have started on $PORT")
5149 RISERV_PID="$!"
5250 ${iserv-proxy}/bin/iserv-proxy $@ 127.0.0.1 "$PORT"
@@ -54,7 +52,7 @@ let
5452 kill $RISERV_PID
5553 '';
5654
57− wineIservWrapper = symlinkJoin { name = "iserv-wrapper"; paths = [ wineIservWrapperVanilla wineIservWrapperProf ]; };
55+ wineIservWrapper = symlinkJoin { name = "iserv-wrapper"; paths = [ (wineIservWrapperScript false) (wineIservWrapperScript true) ]; };
5856
5957 ################################################################################
6058 # Build logic (TH support via remote iserv via wine)