diff --git a/3rdparty/haskell/BUILD.ghc-lib-parser b/3rdparty/haskell/BUILD.ghc-lib-parser index cc38d97e2286..05878b7326c1 100644 --- a/3rdparty/haskell/BUILD.ghc-lib-parser +++ b/3rdparty/haskell/BUILD.ghc-lib-parser @@ -52,7 +52,7 @@ haskell_library( "-I/compiler", "-I/compiler/utils" ], package_name = "ghc-lib-parser", - version = "8.8.0.20190704-selective-optimizations-off", + version = "8.8.0.20190723", ) cc_library( diff --git a/WORKSPACE b/WORKSPACE index 6729f0958fa6..506e1cf47aa3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -464,12 +464,12 @@ HASKELL_LSP_COMMIT = "d73e2ccb518724e6766833ee3d7e73289cbe0018" HASKELL_LSP_HASH = "36b92431039e6289eb709b8872f5010a57d4a45e637e1c1c945bdb3128586081" -GHC_LIB_VERSION = "8.8.0.20190704" +GHC_LIB_VERSION = "8.8.0.20190723" http_archive( name = "haskell_ghc__lib__parser", build_file = "//3rdparty/haskell:BUILD.ghc-lib-parser", - sha256 = "4a427e093f1711b28b6cf9dd6123e94c9e45589992d67274af626ecfa720308e", + sha256 = "139c5b58d179a806640f8b56bc3fe8c70a893191dbfd111a593544e7ac71086b", strip_prefix = "ghc-lib-parser-{}".format(GHC_LIB_VERSION), urls = ["https://digitalassetsdk.bintray.com/ghc-lib/ghc-lib-parser-{}.tar.gz".format(GHC_LIB_VERSION)], ) @@ -520,7 +520,7 @@ hazel_repositories( # Read [Working on ghc-lib] for ghc-lib update # instructions at # https://github.com/DACH-NY/daml/blob/master/ghc-lib/working-on-ghc-lib.md. - hazel_ghclibs(GHC_LIB_VERSION, "4a427e093f1711b28b6cf9dd6123e94c9e45589992d67274af626ecfa720308e", "0e4eda986fd3af0e18a2c89719e584d21dce136bcfdad3d0a9effcc6b654c842") + + hazel_ghclibs(GHC_LIB_VERSION, "139c5b58d179a806640f8b56bc3fe8c70a893191dbfd111a593544e7ac71086b", "7cfbe3bd12fb38685b86096ad666790326020308138eaf49198631b8792f5b2a") + # Support for Hlint: # - Requires haskell-src-exts 1.21.0 so override hazel/packages.bzl. @@ -528,7 +528,7 @@ hazel_repositories( # - To build the library : `bazel build @haskell_hlint//:lib` # We'll be using it via the library, not the binary. hazel_hackage("haskell-src-exts", "1.21.0", "95dac187824edfa23b6a2363880b5e113df8ce4a641e8a0f76e6d45aaa699ff3") + - hazel_github_external("digital-asset", "hlint", "af5633e777d870819a58a1b1b53be678c0d9fa1a", "b8d91b9770ca6307705bb8449fd980579bb57d8abe84a9472c1431a2a277b87d") + + hazel_github_external("digital-asset", "hlint", "ba2fcd7d926ca6d365a4d0b2c6bc001f84d022b6", "c2693600d7b5912c763907d76eb91fc432a74355e5646313ba1097513340d8fe") + hazel_github_external("awakesecurity", "proto3-wire", "43d8220dbc64ef7cc7681887741833a47b61070f", "1c3a7fbf4ab3308776675c6202583f9750de496757f3ad4815e81edd122d75e1") + hazel_github_external("awakesecurity", "proto3-suite", "dd01df7a3f6d0f1ea36125a67ac3c16936b53da0", "59ea7b876b14991347918eefefe24e7f0e064b5c2cc14574ac4ab5d6af6413ca") + hazel_hackage("happy", "1.19.10", "22eb606c97105b396e1c7dc27e120ca02025a87f3e44d2ea52be6a653a52caed") + diff --git a/bazel_tools/haskell-hazel-include-paths.patch b/bazel_tools/haskell-hazel-include-paths.patch new file mode 100644 index 000000000000..915d18ec7b97 --- /dev/null +++ b/bazel_tools/haskell-hazel-include-paths.patch @@ -0,0 +1,38 @@ +From 094c0a1a37f8131e457b24bdc2f37cd36bde00c0 Mon Sep 17 00:00:00 2001 +From: Andreas Herrmann +Date: Wed, 24 Jul 2019 09:41:43 +0200 +Subject: [PATCH] Hazel: Fix includeDirs + +Hazel was adding bogus -I/ flags, when instead it should be +-Iexternal/haskell_/. +--- + 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", diff --git a/bazel_tools/haskell-no-isystem.patch b/bazel_tools/haskell-no-isystem.patch new file mode 100644 index 000000000000..497b805f4adc --- /dev/null +++ b/bazel_tools/haskell-no-isystem.patch @@ -0,0 +1,13 @@ +diff --git a/haskell/cc.bzl b/haskell/cc.bzl +index cd42613..6c3e53a 100644 +--- a/haskell/cc.bzl ++++ b/haskell/cc.bzl +@@ -59,7 +59,7 @@ def cc_interop_info(ctx): + ] + [ + f + for include in cc_ctx.system_includes.to_list() +- for f in ["-isystem", include] ++ for f in ["-I", include] + ], + ) + diff --git a/compiler/hie-core/src/Development/IDE/GHC/CPP.hs b/compiler/hie-core/src/Development/IDE/GHC/CPP.hs index 1ac759fc3c20..5f1bf9896bbe 100644 --- a/compiler/hie-core/src/Development/IDE/GHC/CPP.hs +++ b/compiler/hie-core/src/Development/IDE/GHC/CPP.hs @@ -24,6 +24,9 @@ import Module import DynFlags import Panic import FileCleanup +#ifndef GHC_STABLE +import LlvmCodeGen (LlvmVersion (..)) +#endif import System.Directory import System.FilePath @@ -130,7 +133,12 @@ getBackendDefs :: DynFlags -> IO [String] getBackendDefs dflags | hscTarget dflags == HscLlvm = do llvmVer <- figureLlvmVersion dflags return $ case llvmVer of +#ifdef GHC_STABLE Just n -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format n ] +#else + Just (LlvmVersion n) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (n,0) ] + Just (LlvmVersionOld m n) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m,n) ] +#endif _ -> [] where format (major, minor) diff --git a/deps.bzl b/deps.bzl index ef7ba1f910c3..e23c96d8bc9e 100644 --- a/deps.bzl +++ b/deps.bzl @@ -47,6 +47,7 @@ def daml_deps(): "@com_github_digital_asset_daml//bazel_tools:haskell-ghci-grpc.patch", "@com_github_digital_asset_daml//bazel_tools:haskell_public_ghci_repl_wrapper.patch", "@com_github_digital_asset_daml//bazel_tools:haskell-windows-library-dirs.patch", + "@com_github_digital_asset_daml//bazel_tools:haskell-no-isystem.patch", ], patch_args = ["-p1"], sha256 = rules_haskell_sha256, @@ -66,6 +67,10 @@ def daml_deps(): strip_prefix = "rules_haskell-{}/hazel".format(rules_haskell_version), urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version], sha256 = rules_haskell_sha256, + patches = [ + "@com_github_digital_asset_daml//bazel_tools:haskell-hazel-include-paths.patch", + ], + patch_args = ["-p2"], ) if "com_github_madler_zlib" not in native.existing_rules():