remove llvm
This commit is contained in:
parent
895123cfa1
commit
bd2a511637
@ -75,39 +75,6 @@ TARGET_CONFIGS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
def toolchain_repositories():
|
def toolchain_repositories():
|
||||||
# We need llvm-ar for now, so get it.
|
|
||||||
llvm_patch_cmds = [
|
|
||||||
"mv bin/llvm-ar .",
|
|
||||||
"rm -r include lib libexec share bin",
|
|
||||||
"echo 'def noop(): pass' > noop.bzl",
|
|
||||||
]
|
|
||||||
|
|
||||||
llvm_build_file_content = """
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
|
||||||
exports_files(glob["**"])
|
|
||||||
"""
|
|
||||||
http_archive(
|
|
||||||
name = "com_github_ziglang_zig_llvm_tools_macos_x86_64",
|
|
||||||
# sha256 = "",
|
|
||||||
patch_cmds = llvm_patch_cmds,
|
|
||||||
build_file_content = llvm_build_file_content,
|
|
||||||
strip_prefix = "clang+llvm-11.0.0-x86_64-apple-darwin",
|
|
||||||
urls = [
|
|
||||||
"https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
http_archive(
|
|
||||||
name = "com_github_ziglang_zig_llvm_tools_linux_x86_64",
|
|
||||||
sha256 = "829f5fb0ebda1d8716464394f97d5475d465ddc7bea2879c0601316b611ff6db",
|
|
||||||
patch_cmds = llvm_patch_cmds,
|
|
||||||
build_file_content = llvm_build_file_content,
|
|
||||||
strip_prefix = "clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04",
|
|
||||||
urls = [
|
|
||||||
"https://github.com/llvm/llvm-project/releases/download/llvmorg-11.0.0/clang+llvm-11.0.0-x86_64-linux-gnu-ubuntu-20.04.tar.xz",
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
zig_repository(
|
zig_repository(
|
||||||
name = "com_github_ziglang_zig",
|
name = "com_github_ziglang_zig",
|
||||||
|
|
||||||
@ -118,13 +85,6 @@ exports_files(glob["**"])
|
|||||||
"macos-x86_64": "2d410a4d5ababb61a1deccca724357fda4ed0277b722fc45ea10adf2ed215c5e",
|
"macos-x86_64": "2d410a4d5ababb61a1deccca724357fda4ed0277b722fc45ea10adf2ed215c5e",
|
||||||
},
|
},
|
||||||
|
|
||||||
# version = "0.7.1",
|
|
||||||
# url_format = "https://ziglang.org/download/{version}/zig-{host_platform}-{version}.tar.xz",
|
|
||||||
# host_platform_sha256 = {
|
|
||||||
# "macos-x86_64": "845cb17562978af0cf67e3993f4e33330525eaf01ead9386df9105111e3bc519",
|
|
||||||
# "linux-x86_64": "18c7b9b200600f8bcde1cd8d7f1f578cbc3676241ce36d771937ce19a8159b8d",
|
|
||||||
# },
|
|
||||||
|
|
||||||
host_platform_include_root = {
|
host_platform_include_root = {
|
||||||
"macos-x86_64": "lib/zig/",
|
"macos-x86_64": "lib/zig/",
|
||||||
"linux-x86_64": "lib/",
|
"linux-x86_64": "lib/",
|
||||||
@ -146,7 +106,7 @@ exec "{zig}" "{zig_tool}" "$@"
|
|||||||
ZIG_TOOLS = [
|
ZIG_TOOLS = [
|
||||||
"c++",
|
"c++",
|
||||||
"cc",
|
"cc",
|
||||||
"build-lib", # https://github.com/ziglang/zig/issues/7915
|
"ar",
|
||||||
# List of ld tools: https://github.com/ziglang/zig/blob/0cfa39304b18c6a04689bd789f5dc4d035ec43b0/src/main.zig#L2962-L2966
|
# List of ld tools: https://github.com/ziglang/zig/blob/0cfa39304b18c6a04689bd789f5dc4d035ec43b0/src/main.zig#L2962-L2966
|
||||||
# and also: https://github.com/ziglang/zig/issues/3257
|
# and also: https://github.com/ziglang/zig/issues/3257
|
||||||
"ld.lld", # ELF
|
"ld.lld", # ELF
|
||||||
@ -155,25 +115,17 @@ ZIG_TOOLS = [
|
|||||||
"wasm-ld", # WebAssembly
|
"wasm-ld", # WebAssembly
|
||||||
]
|
]
|
||||||
|
|
||||||
TOOLS = ZIG_TOOLS + [
|
|
||||||
"llvm-ar",
|
|
||||||
]
|
|
||||||
|
|
||||||
BUILD = """
|
BUILD = """
|
||||||
load("@zig-cc-bazel-exceptions//zig-toolchains:defs.bzl", "zig_build_macro")
|
load("@zig-cc-bazel-exceptions//zig-toolchains:defs.bzl", "zig_build_macro")
|
||||||
load("@{llvm_tools_repo}//:noop.bzl", "noop")
|
|
||||||
noop()
|
|
||||||
package(default_visibility = ["//visibility:public"])
|
package(default_visibility = ["//visibility:public"])
|
||||||
zig_build_macro(absolute_path={absolute_path}, zig_include_root={zig_include_root})
|
zig_build_macro(absolute_path={absolute_path}, zig_include_root={zig_include_root})
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def _zig_repository_impl(repository_ctx):
|
def _zig_repository_impl(repository_ctx):
|
||||||
if repository_ctx.os.name.lower().startswith("mac os"):
|
if repository_ctx.os.name.lower().startswith("mac os"):
|
||||||
llvm_tools_repo = "com_github_ziglang_zig_llvm_tools_macos_x86_64"
|
|
||||||
host_platform = "macos-x86_64"
|
host_platform = "macos-x86_64"
|
||||||
else:
|
else:
|
||||||
host_platform = "linux-x86_64"
|
host_platform = "linux-x86_64"
|
||||||
llvm_tools_repo = "com_github_ziglang_zig_llvm_tools_linux_x86_64"
|
|
||||||
|
|
||||||
zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform]
|
zig_include_root = repository_ctx.attr.host_platform_include_root[host_platform]
|
||||||
zig_sha256 = repository_ctx.attr.host_platform_sha256[host_platform]
|
zig_sha256 = repository_ctx.attr.host_platform_sha256[host_platform]
|
||||||
@ -189,10 +141,6 @@ def _zig_repository_impl(repository_ctx):
|
|||||||
sha256 = zig_sha256,
|
sha256 = zig_sha256,
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO Use llvm-ar for host platform until we have https://github.com/ziglang/zig/issues/7915
|
|
||||||
llvm_tools_dir = str(repository_ctx.path("")) + "/../" + llvm_tools_repo
|
|
||||||
repository_ctx.symlink(llvm_tools_dir + "/llvm-ar", ZIG_TOOL_PATH.format(zig_tool="llvm-ar"))
|
|
||||||
|
|
||||||
for zig_tool in ZIG_TOOLS:
|
for zig_tool in ZIG_TOOLS:
|
||||||
repository_ctx.file(
|
repository_ctx.file(
|
||||||
ZIG_TOOL_PATH.format(zig_tool=zig_tool),
|
ZIG_TOOL_PATH.format(zig_tool=zig_tool),
|
||||||
@ -202,7 +150,7 @@ def _zig_repository_impl(repository_ctx):
|
|||||||
absolute_path = json.encode(str(repository_ctx.path("")))
|
absolute_path = json.encode(str(repository_ctx.path("")))
|
||||||
repository_ctx.file(
|
repository_ctx.file(
|
||||||
"BUILD",
|
"BUILD",
|
||||||
BUILD.format(absolute_path=absolute_path, llvm_tools_repo=llvm_tools_repo, zig_include_root=json.encode(zig_include_root)),
|
BUILD.format(absolute_path=absolute_path, zig_include_root=json.encode(zig_include_root)),
|
||||||
)
|
)
|
||||||
|
|
||||||
zig_repository = repository_rule(
|
zig_repository = repository_rule(
|
||||||
|
Loading…
Reference in New Issue
Block a user