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.
23*f2694500SChristian SiggLLVM_COMMIT = "81d5412439efd0860c0a8dd51b831204f118d485"
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.
28*f2694500SChristian SiggLLVM_SHA256 = "50b3ef31b228ea0c96ae074005bfac087c56e6a4b1c147592dd33f41cad0706b"
299cc1ddd3SGeoffrey Martin-Noble
309cc1ddd3SGeoffrey Martin-Noblehttp_archive(
31*f2694500SChristian 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
38*f2694500SChristian Siggload("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure", "llvm_disable_optional_support_deps")
399cc1ddd3SGeoffrey Martin-Noble
40*f2694500SChristian Siggllvm_configure(name = "llvm-project")
419cc1ddd3SGeoffrey Martin-Noble
429cc1ddd3SGeoffrey Martin-Noble# Disables optional dependencies for Support like zlib and terminfo. You may
439cc1ddd3SGeoffrey Martin-Noble# instead want to configure them using the macros in the corresponding bzl
449cc1ddd3SGeoffrey Martin-Noble# files.
459cc1ddd3SGeoffrey Martin-Noblellvm_disable_optional_support_deps()
46