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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to configure separate GHC workspaces for different operating systes. This allows to use different GHC distributions on e.g. Linux and Windows.
- Loading branch information
Showing
3 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
load("@bazel_tools//tools/cpp:lib_cc_configure.bzl", "get_cpu_value") | ||
|
||
default_ghc_workspaces = { | ||
"k8": "@ghc", | ||
"darwin": "@ghc", | ||
"x64_windows": "@ghc_windows", | ||
} | ||
|
||
def get_ghc_workspace(ghc_workspaces, repository_ctx): | ||
"""Return the GHC workspace appropriate for the current OS.""" | ||
cpu_value = get_cpu_value(repository_ctx) | ||
if cpu_value not in ghc_workspaces: | ||
fail("No known GHC workspace for CPU {} in {}".format( | ||
cpu_value, ghc_workspaces)) | ||
return ghc_workspaces[cpu_value] | ||
|
||
|
||
def get_executable_name(name, repository_ctx): | ||
"""Return the executable name for the current platform. | ||
On Windows, appends `.exe` to `name`. Otherwise, returns `name`. | ||
""" | ||
if get_cpu_value(repository_ctx) == "x64_windows": | ||
return "%s.exe"%name | ||
else: | ||
return name |