mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Now that LLVM 12 has been released we no longer have any need to bootstrap LLVM to get the desired featureset. LLVM 12 is available widely, including in Homebrew across multiple platforms and in the GitHub action runners. Sadly, the Linux distribution builds of LLVM-12 are largely broken and not as useful for us. The Homebrew Linux install was also broken originally, but I've worked extensively with the Homebrew folks to get the Linux install into a really good shape. It should now work reliably. There are two primary bugs in Linux LLVM packages that need to be fixed before we can just use them: - https://bugs.llvm.org/show_bug.cgi?id=43604 - https://bugs.llvm.org/show_bug.cgi?id=46321 Once those are addressed and point releases with the fixes widely available we can further simplify things. Even with the need to use Homebrew installs, using the released LLVM has the extra advantage of making it easy to properly support Darwin ARM and I've added that configuration so that I can test things there. Last but not least, this will significantly shrink our build outputs which should allow building much more in continuous integration on GitHub actions without exceeding the action cache size limits. I've even added several tweaks and adjustments to the compile and build flags to improve the build performance and reduce the build output size. Once this is landed and stable, we can consider adding the refactoring tooling back to our CI. One of the biggest downsides of this path is that our CI has to download and install the LLVM toolchain from Homebrew on each run. This is pretty slow (takes a couple of minutes). But it is a fixed overhead -- it won't get worse over time. Eventually, we can either look at a much fancier action configuration to avoid this or hopefully the Debian packages will get updated and we can move back to those. The bootstrapping has served us long enough at this point. We can resurrect it if we ever find a compelling reason for breaking off of the latest LLVM release as our host toolchain. Co-authored-by: Jon Meow <46229924+jonmeow@users.noreply.github.com>
126 lines
4.1 KiB
Python
126 lines
4.1 KiB
Python
# Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
# Exceptions. See /LICENSE for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
workspace(name = "carbon")
|
|
|
|
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
# Add Bazel's python rules and set up pip.
|
|
http_archive(
|
|
name = "rules_python",
|
|
sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
|
|
url = "https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz",
|
|
)
|
|
|
|
load("@rules_python//python:pip.bzl", "pip_install")
|
|
|
|
# Create a central repo that knows about the pip dependencies.
|
|
pip_install(
|
|
name = "py_deps",
|
|
requirements = "//github_tools:requirements.txt",
|
|
)
|
|
|
|
# Configure the bootstrapped Clang and LLVM toolchain for Bazel.
|
|
load("//bazel/cc_toolchains:clang_configuration.bzl", "configure_clang_toolchain")
|
|
|
|
configure_clang_toolchain(name = "bazel_cc_toolchain")
|
|
|
|
local_repository(
|
|
name = "llvm_bazel",
|
|
path = "third_party/llvm-bazel/llvm-bazel",
|
|
)
|
|
|
|
load("@llvm_bazel//:configure.bzl", "llvm_configure")
|
|
|
|
llvm_configure(
|
|
name = "llvm-project",
|
|
src_path = "third_party/llvm-project",
|
|
src_workspace = "@carbon//:WORKSPACE",
|
|
targets = [
|
|
"AArch64",
|
|
"X86",
|
|
],
|
|
)
|
|
|
|
load("@llvm_bazel//:terminfo.bzl", "llvm_terminfo_system")
|
|
|
|
# We require successful detection and use of a system terminfo library.
|
|
llvm_terminfo_system(name = "llvm_terminfo")
|
|
|
|
load("@llvm_bazel//:zlib.bzl", "llvm_zlib_system")
|
|
|
|
# We require successful detection and use of a system zlib library.
|
|
llvm_zlib_system(name = "llvm_zlib")
|
|
|
|
# TODO(chandlerc): Replace this with an upstream release once the pull request
|
|
# with our needed functionality lands:
|
|
# https://github.com/jmillikin/rules_m4/pull/7
|
|
#
|
|
# Until then, this is pulling from that pull request's commit.
|
|
http_archive(
|
|
name = "rules_m4",
|
|
sha256 = "4d34917214e8890ad770bdf0c319c41c9201fffd770938b41a1d641d4b27e05c",
|
|
strip_prefix = "rules_m4-add-extra-copts",
|
|
urls = ["https://github.com/chandlerc/rules_m4/archive/add-extra-copts.zip"],
|
|
)
|
|
|
|
load("@rules_m4//m4:m4.bzl", "m4_register_toolchains")
|
|
|
|
# When building M4, disable all compiler warnings as we can't realistically fix
|
|
# them anyways.
|
|
m4_register_toolchains(extra_copts = ["-w"])
|
|
|
|
# TODO(chandlerc): Replace this with an upstream release once the pull request
|
|
# with our needed functionality lands:
|
|
# https://github.com/jmillikin/rules_flex/pull/5
|
|
#
|
|
# Until then, this is pulling from that pull request's commit.
|
|
http_archive(
|
|
name = "rules_flex",
|
|
sha256 = "fd97c3ae23926507be1b95158a683cd41c628d201e852a325d38b5e9f821b752",
|
|
strip_prefix = "rules_flex-add-extra-copts",
|
|
urls = ["https://github.com/chandlerc/rules_flex/archive/add-extra-copts.zip"],
|
|
)
|
|
|
|
load("@rules_flex//flex:flex.bzl", "flex_register_toolchains")
|
|
|
|
# When building Flex, disable all compiler warnings as we can't realistically
|
|
# fix them anyways.
|
|
flex_register_toolchains(extra_copts = ["-w"])
|
|
|
|
# TODO(chandlerc): Replace this with an upstream release once the pull request
|
|
# with our needed functionality lands:
|
|
# https://github.com/jmillikin/rules_bison/pull/7
|
|
#
|
|
# Until then, this is pulling from that pull request's commit.
|
|
http_archive(
|
|
name = "rules_bison",
|
|
sha256 = "c6e926f15214d903966dc950d759ec69116db67f148be114c119e4def0551eaa",
|
|
strip_prefix = "rules_bison-add-extra-copts",
|
|
urls = ["https://github.com/chandlerc/rules_bison/archive/add-extra-copts.zip"],
|
|
)
|
|
|
|
load("@rules_bison//bison:bison.bzl", "bison_register_toolchains")
|
|
|
|
# When building Bison, disable all compiler warnings as we can't realistically
|
|
# fix them anyways.
|
|
bison_register_toolchains(extra_copts = ["-w"])
|
|
|
|
local_repository(
|
|
name = "brotli",
|
|
path = "third_party/examples/brotli/original",
|
|
)
|
|
|
|
new_local_repository(
|
|
name = "woff2",
|
|
build_file = "third_party/examples/woff2/BUILD.original",
|
|
path = "third_party/examples/woff2/original",
|
|
workspace_file = "third_party/examples/woff2/WORKSPACE.original",
|
|
)
|
|
|
|
local_repository(
|
|
name = "woff2_carbon",
|
|
path = "third_party/examples/woff2/carbon",
|
|
)
|