This repository has been archived by the owner on Jun 18, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBUILD.ghc
51 lines (43 loc) · 1.46 KB
/
BUILD.ghc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Template for a GHC bindist that is compatible with Hazel.
package(default_visibility = [ "//visibility:public" ])
load("@io_tweag_rules_haskell//haskell:haskell.bzl", "haskell_toolchain")
load("@io_tweag_rules_haskell//haskell:c2hs.bzl", "c2hs_toolchain")
filegroup(
name = "bin",
srcs = glob(["bin/*"]),
)
# Provide the GHC executable separately, so that it can be used in a
# repository rule to compile Hazel. (Repository rules can't use "generated" files,
# including filegroups, but are allowed to use files provided via
# `exports_files`.
exports_files(["bin/ghc"])
filegroup(
name = "lib",
srcs = glob(["lib/**/*.so*", "lib/**/*.a"]),
)
filegroup(
name = "include",
srcs = glob(["include/*.h"]),
)
cc_library(
name = "threaded-rts",
srcs = glob(["lib/ghc-*/rts/libHSrts_thr-ghc*." + ext for ext in ["so", "dylib"]]),
hdrs = glob(["lib/ghc-*/include/**/*.h"]),
strip_include_prefix = glob(["lib/ghc-*/include"], exclude_directories=0)[0],
)
# TODO: detect this more automatically.
cc_library(
name = "unix-includes",
hdrs = glob(["lib/ghc-*/unix-*/include/*.h"]),
strip_include_prefix = glob(["lib/ghc-*/unix-*/include"], exclude_directories=0)[0],
)
haskell_toolchain(
name = "ghc",
version = "8.2.2",
tools = ":bin",
locale_archive = select({
# For some reason glibcLocales is not available on Darwin.
"@bazel_tools//src/conditions:darwin": None,
"//conditions:default": "@glib_locales//:locale-archive",
}),
)