WORKSPACE 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
  7. ###############################################################################
  8. # C++ rules
  9. ###############################################################################
  10. # Configure the bootstrapped Clang and LLVM toolchain for Bazel.
  11. load(
  12. "//bazel/cc_toolchains:clang_configuration.bzl",
  13. "clang_register_toolchains",
  14. )
  15. clang_register_toolchains(name = "bazel_cc_toolchain")
  16. ###############################################################################
  17. # LLVM libraries
  18. ###############################################################################
  19. # We pin to specific upstream commits and try to track top-of-tree reasonably
  20. # closely rather than pinning to a specific release.
  21. llvm_version = "3d51010a3350660160981c6b8e624dcc87c208a3"
  22. http_archive(
  23. name = "llvm-raw",
  24. build_file_content = "# empty",
  25. patch_args = ["-p1"],
  26. patches = [
  27. "@carbon//bazel/patches/llvm:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
  28. "@carbon//bazel/patches/llvm:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
  29. "@carbon//bazel/patches/llvm:0003_Add_library_for_clangd.patch",
  30. ],
  31. sha256 = "efbca707a6eb1c714b849de120309070eef282660c0f4be5b68efef62cc95cf5",
  32. strip_prefix = "llvm-project-{0}".format(llvm_version),
  33. urls = ["https://github.com/llvm/llvm-project/archive/{0}.tar.gz".format(llvm_version)],
  34. )
  35. load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
  36. llvm_configure(
  37. name = "llvm-project",
  38. targets = [
  39. "AArch64",
  40. "X86",
  41. ],
  42. )
  43. # Dependencies copied from
  44. # https://github.com/llvm/llvm-project/blob/main/utils/bazel/WORKSPACE.
  45. maybe(
  46. http_archive,
  47. name = "llvm_zlib",
  48. build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
  49. sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
  50. strip_prefix = "zlib-ng-2.0.7",
  51. urls = [
  52. "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
  53. ],
  54. )
  55. maybe(
  56. http_archive,
  57. name = "llvm_zstd",
  58. build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
  59. sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
  60. strip_prefix = "zstd-1.5.2",
  61. urls = [
  62. "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
  63. ],
  64. )
  65. ###############################################################################
  66. # libprotobuf_mutator - for structured fuzzer testing.
  67. ###############################################################################
  68. libprotobuf_mutator_version = "1.1"
  69. http_archive(
  70. name = "com_google_libprotobuf_mutator",
  71. build_file = "@//:third_party/libprotobuf_mutator/BUILD.txt",
  72. sha256 = "fd299fd72c5cf664259d9bd43a72cb74dc6a8b9604d107fe2d2e90885aeb7c16",
  73. strip_prefix = "libprotobuf-mutator-{0}".format(libprotobuf_mutator_version),
  74. urls = ["https://github.com/google/libprotobuf-mutator/archive/v{0}.tar.gz".format(libprotobuf_mutator_version)],
  75. )
  76. ###############################################################################
  77. # Example conversion repositories
  78. ###############################################################################
  79. local_repository(
  80. name = "brotli",
  81. path = "third_party/examples/brotli/original",
  82. )
  83. new_local_repository(
  84. name = "woff2",
  85. build_file = "third_party/examples/woff2/BUILD.original",
  86. path = "third_party/examples/woff2/original",
  87. workspace_file = "third_party/examples/woff2/WORKSPACE.original",
  88. )
  89. local_repository(
  90. name = "woff2_carbon",
  91. path = "third_party/examples/woff2/carbon",
  92. )
  93. ###############################################################################
  94. # Treesitter rules
  95. ###############################################################################
  96. http_archive(
  97. name = "rules_nodejs",
  98. sha256 = "d124665ea12f89153086746821cf6c9ef93ab88360a50c1aeefa1fe522421704",
  99. strip_prefix = "rules_nodejs-6.0.0-beta1",
  100. url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.0.0-beta1/rules_nodejs-v6.0.0-beta1.tar.gz",
  101. )
  102. load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
  103. nodejs_register_toolchains(
  104. name = "nodejs",
  105. node_version = DEFAULT_NODE_VERSION,
  106. )
  107. http_archive(
  108. name = "rules_tree_sitter",
  109. sha256 = "a09f177a2b8acb2f8a84def6ca0c41a5bd26b25634aa7313f22ade6c54e57ca1",
  110. strip_prefix = "rules_tree_sitter-bc3a2131053207de7dfd9b24046b811ce770e35d",
  111. urls = ["https://github.com/Maan2003/rules_tree_sitter/archive/bc3a2131053207de7dfd9b24046b811ce770e35d.tar.gz"],
  112. )
  113. load("@rules_tree_sitter//tree_sitter:tree_sitter.bzl", "tree_sitter_register_toolchains")
  114. tree_sitter_register_toolchains()