daml/bazel_tools/haskell-hazel-include-paths.patch
Shayne Fletcher ee5079d9d3 Ghc lib 8.8.0.20190723 (#2279)
* Upgrade ghc-lib

* Patch bazel_tools : hazel-include-paths patch, no-isystem patch.

* Provide "haskell_c2hs" for package name to cabal_haskell_package

* Package name haskell_c2hs => c2hs.

* Switch to less hacky patch for include dirs
2019-07-25 08:59:34 +00:00

39 lines
1.8 KiB
Diff

From 094c0a1a37f8131e457b24bdc2f37cd36bde00c0 Mon Sep 17 00:00:00 2001
From: Andreas Herrmann <andreas.herrmann@tweag.io>
Date: Wed, 24 Jul 2019 09:41:43 +0200
Subject: [PATCH] Hazel: Fix includeDirs
Hazel was adding bogus -I/<include-dir> flags, when instead it should be
-Iexternal/haskell_<package_name>/<include-dir>.
---
hazel/third_party/cabal2bazel/bzl/cabal_package.bzl | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/hazel/third_party/cabal2bazel/bzl/cabal_package.bzl b/hazel/third_party/cabal2bazel/bzl/cabal_package.bzl
index 0e8238d8..1e177311 100644
--- a/hazel/third_party/cabal2bazel/bzl/cabal_package.bzl
+++ b/hazel/third_party/cabal2bazel/bzl/cabal_package.bzl
@@ -453,6 +453,12 @@ def _get_build_attrs(
] +
install_includes,
)
- ghcopts += ["-I" + native.package_name() + "/" + d for d in build_info.includeDirs]
+ # repository_name starts with @, strip that bit off. Adding the include
+ # directories to the cc_library below alone is not sufficient. The includes
+ # attribute ends up in -isystem include flags. However, some Haskell
+ # libraries attempt to include headers using #include "" syntax instead of
+ # #include <>.
+ includeOpts = ["-I" + paths.join("external", native.repository_name()[1:], native.package_name(), i) for i in build_info.includeDirs]
+ ghcopts += includeOpts
for xs in deps.values():
xs.append(cbits_name)
@@ -474,6 +480,7 @@ def _get_build_attrs(
srcs = build_info.cSources,
includes = build_info.includeDirs,
copts = ([o for o in build_info.ccOptions if not o.startswith("-D")] +
+ includeOpts +
[
"-D__GLASGOW_HASKELL__=" + ghc_version_string,
"-w",