WORKSPACE 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. workspace(name = "carbon")
  5. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
  6. ###############################################################################
  7. # Python rules
  8. ###############################################################################
  9. rules_python_version = "0.8.1"
  10. # Add Bazel's python rules and set up pip.
  11. http_archive(
  12. name = "rules_python",
  13. sha256 = "cdf6b84084aad8f10bf20b46b77cb48d83c319ebe6458a18e9d2cebf57807cdd",
  14. strip_prefix = "rules_python-%s" % rules_python_version,
  15. url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/%s.tar.gz" % rules_python_version,
  16. )
  17. load("@rules_python//python:pip.bzl", "pip_install")
  18. # Create a central repo that knows about the pip dependencies.
  19. pip_install(
  20. name = "py_deps",
  21. requirements = "//github_tools:requirements.txt",
  22. )
  23. ###############################################################################
  24. # C++ rules
  25. ###############################################################################
  26. # Configure the bootstrapped Clang and LLVM toolchain for Bazel.
  27. load(
  28. "//bazel/cc_toolchains:clang_configuration.bzl",
  29. "configure_clang_toolchain",
  30. )
  31. configure_clang_toolchain(name = "bazel_cc_toolchain")
  32. ###############################################################################
  33. # Abseil libraries
  34. ###############################################################################
  35. abseil_version = "20211102.0"
  36. http_archive(
  37. name = "com_google_absl",
  38. sha256 = "dcf71b9cba8dc0ca9940c4b316a0c796be8fab42b070bb6b7cab62b48f0e66c4",
  39. strip_prefix = "abseil-cpp-%s" % abseil_version,
  40. urls = ["https://github.com/abseil/abseil-cpp/archive/refs/tags/%s.tar.gz" % abseil_version],
  41. )
  42. ###############################################################################
  43. # GoogleTest libraries
  44. ###############################################################################
  45. # Version as of 2021-12-07. Not a major release, but gets a clang-tidy fix.
  46. googletest_version = "4c5650f68866e3c2e60361d5c4c95c6f335fb64b"
  47. http_archive(
  48. name = "com_google_googletest",
  49. sha256 = "770e61fa13d51320736c2881ff6279212e4eab8a9100709fff8c44759f61d126",
  50. strip_prefix = "googletest-%s" % googletest_version,
  51. urls = ["https://github.com/google/googletest/archive/%s.tar.gz" % googletest_version],
  52. )
  53. ###############################################################################
  54. # Google Benchmark libraries
  55. ###############################################################################
  56. benchmark_version = "1.6.1"
  57. http_archive(
  58. name = "com_github_google_benchmark",
  59. sha256 = "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4",
  60. strip_prefix = "benchmark-%s" % benchmark_version,
  61. urls = ["https://github.com/google/benchmark/archive/refs/tags/v%s.tar.gz" % benchmark_version],
  62. )
  63. ###############################################################################
  64. # LLVM libraries
  65. ###############################################################################
  66. new_local_repository(
  67. name = "llvm-raw",
  68. build_file_content = "# empty",
  69. path = "third_party/llvm-project",
  70. )
  71. load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
  72. llvm_configure(
  73. name = "llvm-project",
  74. repo_mapping = {"@llvm_zlib": "@zlib"},
  75. targets = [
  76. "AArch64",
  77. "X86",
  78. ],
  79. )
  80. load("@llvm-raw//utils/bazel:terminfo.bzl", "llvm_terminfo_system")
  81. # We require successful detection and use of a system terminfo library.
  82. llvm_terminfo_system(name = "llvm_terminfo")
  83. load("@llvm-raw//utils/bazel:zlib.bzl", "llvm_zlib_system")
  84. # We require successful detection and use of a system zlib library.
  85. llvm_zlib_system(name = "zlib")
  86. ###############################################################################
  87. # Flex/Bison rules
  88. ###############################################################################
  89. rules_m4_version = "0.2.1"
  90. http_archive(
  91. name = "rules_m4",
  92. sha256 = "eaa674cd84546038ecbcc49cdd346134a20961a41fa1a541e80d8bf4b470c34d",
  93. strip_prefix = "rules_m4-%s" % rules_m4_version,
  94. urls = ["https://github.com/jmillikin/rules_m4/archive/v%s.tar.gz" %
  95. rules_m4_version],
  96. )
  97. load("@rules_m4//m4:m4.bzl", "m4_register_toolchains")
  98. # When building M4, disable all compiler warnings as we can't realistically fix
  99. # them anyways.
  100. m4_register_toolchains(extra_copts = ["-w"])
  101. # TODO: Can switch to a normal release version when it includes:
  102. # https://github.com/jmillikin/rules_flex/commit/1f1d9c306c2b4b8be2cb899a3364b84302124e77
  103. rules_flex_version = "1f1d9c306c2b4b8be2cb899a3364b84302124e77"
  104. http_archive(
  105. name = "rules_flex",
  106. sha256 = "a4e99a0a241c8a5aa238e81724ea3529722522c3702fd3aa674add5eb9807002",
  107. strip_prefix = "rules_flex-%s" % rules_flex_version,
  108. urls = ["https://github.com/jmillikin/rules_flex/archive/%s.tar.gz" %
  109. rules_flex_version],
  110. )
  111. load("@rules_flex//flex:flex.bzl", "flex_register_toolchains")
  112. # When building Flex, disable all compiler warnings as we can't realistically
  113. # fix them anyways.
  114. flex_register_toolchains(extra_copts = ["-w"])
  115. # TODO: Can switch to a normal release version when it includes:
  116. # https://github.com/jmillikin/rules_bison/commit/478079b28605a38000eaf83719568d756b3383a0
  117. rules_bison_version = "478079b28605a38000eaf83719568d756b3383a0"
  118. http_archive(
  119. name = "rules_bison",
  120. sha256 = "6bc2d382e4ffccd66e60a74521c24722fc8fdfe9af49ff182f79bb5994fa1ba4",
  121. strip_prefix = "rules_bison-%s" % rules_bison_version,
  122. urls = ["https://github.com/jmillikin/rules_bison/archive/%s.tar.gz" %
  123. rules_bison_version],
  124. )
  125. load("@rules_bison//bison:bison.bzl", "bison_register_toolchains")
  126. # When building Bison, disable all compiler warnings as we can't realistically
  127. # fix them anyways.
  128. bison_register_toolchains(extra_copts = ["-w"])
  129. ###############################################################################
  130. # Protocol buffers - for structured fuzzer testing.
  131. ###############################################################################
  132. # TODO: `rules_proto` pulls in a version of `rules_cc` with a frozenset bug.
  133. rules_cc_version = "0.0.1"
  134. http_archive(
  135. name = "rules_cc",
  136. sha256 = "4dccbfd22c0def164c8f47458bd50e0c7148f3d92002cdb459c2a96a68498241",
  137. urls = ["https://github.com/bazelbuild/rules_cc/releases/download/%s/rules_cc-%s.tar.gz" % (rules_cc_version, rules_cc_version)],
  138. )
  139. rules_proto_version = "4.0.0-3.20.0"
  140. http_archive(
  141. name = "rules_proto",
  142. sha256 = "e017528fd1c91c5a33f15493e3a398181a9e821a804eb7ff5acdd1d2d6c2b18d",
  143. strip_prefix = "rules_proto-%s" % rules_proto_version,
  144. urls = [
  145. "https://github.com/bazelbuild/rules_proto/archive/refs/tags/%s.tar.gz" % rules_proto_version,
  146. ],
  147. )
  148. load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
  149. rules_proto_dependencies()
  150. rules_proto_toolchains()
  151. ###############################################################################
  152. # libprotobuf_mutator - for structured fuzzer testing.
  153. ###############################################################################
  154. libprotobuf_mutator_version = "1.0"
  155. http_archive(
  156. name = "com_google_libprotobuf_mutator",
  157. build_file = "@//:third_party/libprotobuf_mutator/BUILD.txt",
  158. sha256 = "792f250fb546bde8590e72d64311ea00a70c175fd77df6bb5e02328fa15fe28e",
  159. strip_prefix = "libprotobuf-mutator-%s" % libprotobuf_mutator_version,
  160. urls = ["https://github.com/google/libprotobuf-mutator/archive/v%s.tar.gz" % libprotobuf_mutator_version],
  161. )
  162. ###############################################################################
  163. # Example conversion repositories
  164. ###############################################################################
  165. local_repository(
  166. name = "brotli",
  167. path = "third_party/examples/brotli/original",
  168. )
  169. new_local_repository(
  170. name = "woff2",
  171. build_file = "third_party/examples/woff2/BUILD.original",
  172. path = "third_party/examples/woff2/original",
  173. workspace_file = "third_party/examples/woff2/WORKSPACE.original",
  174. )
  175. local_repository(
  176. name = "woff2_carbon",
  177. path = "third_party/examples/woff2/carbon",
  178. )