daml/3rdparty/haskell/BUILD.old-time
Moritz Kiefer 756b2c9e49
Switch to GHC 8.6.5 (#683)
This might improve our Windows build times a bit as the 8.6.4 bindist
was a messed up in various ways.
2019-04-25 17:22:38 +02:00

49 lines
1.7 KiB
Python

# vim: ft=python
# By default 'old-time' fails to build on Windows and is very much inhermetic on
# Linux/Darwin. The reasons are described here: https://github.com/FormationAI/hazel/issues/80
#
# In order to work around this we use a cabal-like 'package.bzl' generated on
# Linux ('old-time-package.bzl') and tweak it to introduce a C dependency on
# the generated network headers. Those are generated by 'configure' using the
# proper Bazel CC toolchain.
load("@ai_formation_hazel//third_party/cabal2bazel:bzl/cabal_package.bzl",
"cabal_haskell_package",
"hazel_symlink")
load("@hazel_base_repository//:extra-libs.bzl",
"extra_libs",
)
load("@os_info//:os_info.bzl", "is_windows")
load("@com_github_digital_asset_daml//3rdparty/haskell:old-time-package.bzl", "package")
genrule(
name = "old-time-include-gen",
cmd = "PATH=`dirname $(CC)`:$${PATH} $(location configure) && cp include/HsTimeConfig.h $@",
outs = [ "include/HsTimeConfig.h"],
srcs = [ "configure", "include/HsTimeConfig.h.in", "install-sh", "config.sub", "config.guess"],
toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"],
)
cc_library(
name = "old-time-include",
srcs = [ ":old-time-include-gen"],
)
extra_libs_with_headers = extra_libs + {"old-time-headers": ":old-time-include"}
# Make a buildable target for easier debugging of the package.bzl file
hazel_symlink(
name = "bzl",
src = "@com_github_digital_asset_daml//3rdparty/haskell:old-time-package.bzl",
out = "package-bzl",
)
cabal_haskell_package(
package,
"8.6.5",
"@io_tweag_rules_haskell_ghc_windows_amd64" if is_windows else "@io_tweag_rules_haskell_ghc-nixpkgs",
extra_libs_with_headers,
)