19cc1ddd3SGeoffrey Martin-Noble# This file is licensed under the Apache License v2.0 with LLVM Exceptions. 29cc1ddd3SGeoffrey Martin-Noble# See https://llvm.org/LICENSE.txt for license information. 39cc1ddd3SGeoffrey Martin-Noble# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 49cc1ddd3SGeoffrey Martin-Noble 59cc1ddd3SGeoffrey Martin-Noble"""An example WORKSPACE for configuring LLVM using http_archive.""" 69cc1ddd3SGeoffrey Martin-Noble 79cc1ddd3SGeoffrey Martin-Nobleworkspace(name = "http_archive_example") 89cc1ddd3SGeoffrey Martin-Noble 99cc1ddd3SGeoffrey Martin-Nobleload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 109cc1ddd3SGeoffrey Martin-Noble 118b86b3a8SGeoffrey Martin-NobleSKYLIB_VERSION = "1.0.3" 128b86b3a8SGeoffrey Martin-Noble 138b86b3a8SGeoffrey Martin-Noblehttp_archive( 148b86b3a8SGeoffrey Martin-Noble name = "bazel_skylib", 158b86b3a8SGeoffrey Martin-Noble sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", 168b86b3a8SGeoffrey Martin-Noble urls = [ 178b86b3a8SGeoffrey Martin-Noble "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), 188b86b3a8SGeoffrey Martin-Noble "https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), 198b86b3a8SGeoffrey Martin-Noble ], 208b86b3a8SGeoffrey Martin-Noble) 218b86b3a8SGeoffrey Martin-Noble 229cc1ddd3SGeoffrey Martin-Noble# Replace with the LLVM commit you want to use. 237381dec4SAiden GrossmanLLVM_COMMIT = "926f85db98aae66ab8f57b9981f47ddddb868c51" 249cc1ddd3SGeoffrey Martin-Noble 259cc1ddd3SGeoffrey Martin-Noble# The easiest way to calculate this for a new commit is to set it to empty and 269cc1ddd3SGeoffrey Martin-Noble# then run a bazel build and it will report the digest necessary to cache the 279cc1ddd3SGeoffrey Martin-Noble# archive and make the build reproducible. 287381dec4SAiden GrossmanLLVM_SHA256 = "c78c94b2a03b2cf6ef1ba035c31a6f1b0bb7913da8af5aa8d5c2061f6499d589" 299cc1ddd3SGeoffrey Martin-Noble 309cc1ddd3SGeoffrey Martin-Noblehttp_archive( 31f2694500SChristian Sigg name = "llvm-raw", 329cc1ddd3SGeoffrey Martin-Noble build_file_content = "# empty", 339cc1ddd3SGeoffrey Martin-Noble sha256 = LLVM_SHA256, 349cc1ddd3SGeoffrey Martin-Noble strip_prefix = "llvm-project-" + LLVM_COMMIT, 359cc1ddd3SGeoffrey Martin-Noble urls = ["https://github.com/llvm/llvm-project/archive/{commit}.tar.gz".format(commit = LLVM_COMMIT)], 369cc1ddd3SGeoffrey Martin-Noble) 379cc1ddd3SGeoffrey Martin-Noble 387381dec4SAiden Grossmanload("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure") 399cc1ddd3SGeoffrey Martin-Noble 40f2694500SChristian Siggllvm_configure(name = "llvm-project") 417381dec4SAiden Grossman 42*86d456adSKirillload("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") 43*86d456adSKirill 447381dec4SAiden Grossmanmaybe( 457381dec4SAiden Grossman http_archive, 467381dec4SAiden Grossman name = "llvm_zlib", 477381dec4SAiden Grossman build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD", 487381dec4SAiden Grossman sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731", 497381dec4SAiden Grossman strip_prefix = "zlib-ng-2.0.7", 507381dec4SAiden Grossman urls = [ 517381dec4SAiden Grossman "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip", 527381dec4SAiden Grossman ], 537381dec4SAiden Grossman) 547381dec4SAiden Grossman 557381dec4SAiden Grossmanmaybe( 567381dec4SAiden Grossman http_archive, 577381dec4SAiden Grossman name = "llvm_zstd", 587381dec4SAiden Grossman build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD", 597381dec4SAiden Grossman sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0", 607381dec4SAiden Grossman strip_prefix = "zstd-1.5.2", 617381dec4SAiden Grossman urls = [ 622fcfc975SJordan Rupprecht "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz", 637381dec4SAiden Grossman ], 647381dec4SAiden Grossman) 65