mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
e4764cc426
changelog_begin changelog_end Co-authored-by: Moritz Kiefer <moritz.kiefer@purelyfunctional.org>
56 lines
2.1 KiB
Diff
56 lines
2.1 KiB
Diff
diff --git a/haskell/c2hs.bzl b/haskell/c2hs.bzl
|
|
index 96dfd503..0fad061c 100644
|
|
--- a/haskell/c2hs.bzl
|
|
+++ b/haskell/c2hs.bzl
|
|
@@ -95,7 +95,8 @@ def _c2hs_library_impl(ctx):
|
|
"""
|
|
# Include libdir in include path just like hsc2hs does.
|
|
libdir=$({ghc} --print-libdir)
|
|
- {c2hs} -C-I$libdir/include "$@"
|
|
+ # GHC >=9 on Windows stores the includes outside of libdir
|
|
+ {c2hs} -C-I$libdir/include -C-I$libdir/../include "$@"
|
|
""".format(
|
|
ghc = hs.tools.ghc.path,
|
|
c2hs = c2hs_exe.path,
|
|
diff --git a/haskell/private/actions/compile.bzl b/haskell/private/actions/compile.bzl
|
|
index ee5f3d02..a89e815b 100644
|
|
--- a/haskell/private/actions/compile.bzl
|
|
+++ b/haskell/private/actions/compile.bzl
|
|
@@ -82,16 +82,34 @@ def _process_hsc_file(hs, cc, hsc_flags, hsc_inputs, hsc_file):
|
|
if hs.env.get("PATH") == None and hs.toolchain.is_windows:
|
|
hs.env["PATH"] = ""
|
|
|
|
- hs.actions.run(
|
|
+ hs.actions.run_shell(
|
|
inputs = depset(transitive = [
|
|
depset(cc.hdrs),
|
|
depset([hsc_file]),
|
|
depset(cc.files),
|
|
depset(hsc_inputs),
|
|
+ depset(hs.toolchain.bindir),
|
|
]),
|
|
outputs = [hs_out],
|
|
mnemonic = "HaskellHsc2hs",
|
|
- executable = hs.tools.hsc2hs,
|
|
+ command =
|
|
+ # cpp (called via c2hs) gets very unhappy if the mingw bin dir is
|
|
+ # not in PATH so we add it to PATH explicitely.
|
|
+ (
|
|
+ """
|
|
+ export PATH=$PATH:{mingw_bin}
|
|
+ """.format(mingw_bin = paths.dirname(cc.tools.cc)) if hs.toolchain.is_windows else ""
|
|
+ ) +
|
|
+ """
|
|
+ # Include libdir in include path just like hsc2hs does.
|
|
+ libdir=$({ghc} --print-libdir)
|
|
+ # GHC >=9 on Windows stores the includes outside of libdir
|
|
+ {hsc2hs} -C-I$libdir/include -C-I$libdir/../include "$@"
|
|
+ """.format(
|
|
+ ghc = hs.tools.ghc.path,
|
|
+ hsc2hs = hs.tools.hsc2hs.path,
|
|
+ ),
|
|
+
|
|
arguments = [args],
|
|
env = hs.env,
|
|
)
|