Skip to content

Commit

Permalink
Building the most strightforward tests with GHC Bindist compiled with…
Browse files Browse the repository at this point in the history
… Hadrian
  • Loading branch information
GuillaumeGen authored and avdv committed Mar 29, 2023
1 parent 487535b commit 171af7b
Show file tree
Hide file tree
Showing 14 changed files with 592 additions and 15 deletions.
12 changes: 8 additions & 4 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -418,14 +418,18 @@ rules_haskell_asterius_toolchains(
)

load(
"@rules_haskell//haskell:ghc_bindist.bzl",
"haskell_register_ghc_bindists",
"@rules_haskell//haskell:ghc_bindist_hadrian.bzl",
"haskell_register_ghc_bindists_hadrian",
)

haskell_register_ghc_bindists(
haskell_register_ghc_bindists_hadrian(
url = "file:///home/guillaume/ExternalPrograms/ghc/_build/bindist/ghc-9.2.5-x86_64-unknown-linux.tar.xz",
sha256 = "e27724de38998dd6c3fb46ac5df4cf6818d779c1b749ea1afcd0b64e55b8217e",
strip_prefix = "ghc-9.2.5-x86_64-unknown-linux",
version = "9.2.5",
target = "x86_64-unknown-linux",
cabalopts = test_cabalopts,
ghcopts = test_ghcopts,
version = test_ghc_version,
)

register_toolchains(
Expand Down
2 changes: 1 addition & 1 deletion examples/split.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ index a60b284..1941c2f 100644
Library
ghc-options: -Wall
- build-depends: base <4.12
+ build-depends: base <5
+ build-depends: base <6
exposed-modules: Data.List.Split, Data.List.Split.Internals
default-language: Haskell2010
Hs-source-dirs: src
Expand Down
1 change: 1 addition & 0 deletions haskell/c2hs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def _c2hs_library_impl(ctx):
depset(cc.files),
depset(hs.toolchain.bindir),
depset(hs.toolchain.libdir),
depset(hs.toolchain.includedir),
set.to_depset(version_macro_headers),
inputs,
]),
Expand Down
21 changes: 21 additions & 0 deletions haskell/ghc.BUILD.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ load(
"haskell_import",
"haskell_toolchain",
)
load(
"@rules_haskell//haskell:ghc_bindist_hadrian.bzl",
"copy_filegroups_to_this_package",
)

package(default_visibility = ["//visibility:public"])

Expand All @@ -24,6 +28,11 @@ filegroup(
srcs = glob(["bin/*"]),
)

filegroup(
name = "include",
srcs = glob(["include/**"]),
)

filegroup(
name = "lib",
srcs = glob(["lib/**"]),
Expand All @@ -34,6 +43,18 @@ filegroup(
srcs = glob(["%{docdir}/**"]),
)

# Since Bazel regular rules generate files in the "execroots" and GHC requires some files to be next to each other,
# one has to move all the files coming from the GHC bindist tarball to an execroot.
# These copied versions of the files are the 'generated_*_filegroup' targets.

%{generated_bin_filegroup}

%{generated_lib_filegroup}

%{generated_include_filegroup}

%{generated_docdir_filegroup}

# Expose embedded MinGW toolchain when on Windows.

filegroup(
Expand Down
Loading

0 comments on commit 171af7b

Please sign in to comment.