WORKSPACE 8.3 KB

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