| 1 |
# This file is licensed under the Apache License v2.0 with LLVM Exceptions. |
| 2 |
# See https://llvm.org/LICENSE.txt for license information. |
| 3 |
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 4 |
|
| 5 |
"""An example WORKSPACE for configuring LLVM using a git submodule.""" |
| 6 |
|
| 7 |
workspace(name = "submodule_example") |
| 8 |
|
| 9 |
SKYLIB_VERSION = "1.0.3" |
| 10 |
|
| 11 |
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") |
| 12 |
|
| 13 |
http_archive( |
| 14 |
name = "bazel_skylib", |
| 15 |
sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", |
| 16 |
urls = [ |
| 17 |
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), |
| 18 |
"https://github.com/bazelbuild/bazel-skylib/releases/download/{version}/bazel-skylib-{version}.tar.gz".format(version = SKYLIB_VERSION), |
| 19 |
], |
| 20 |
) |
| 21 |
|
| 22 |
new_local_repository( |
| 23 |
name = "llvm-raw", |
| 24 |
build_file_content = "# empty", |
| 25 |
# Or wherever your submodule is located. |
| 26 |
path = "third_party/llvm-project", |
| 27 |
) |
| 28 |
|
| 29 |
load("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure") |
| 30 |
|
| 31 |
llvm_configure(name = "llvm-project") |
| 32 |
|
| 33 |
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") |
| 34 |
|
| 35 |
maybe( |
| 36 |
http_archive, |
| 37 |
name = "llvm_zlib", |
| 38 |
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD", |
| 39 |
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731", |
| 40 |
strip_prefix = "zlib-ng-2.0.7", |
| 41 |
urls = [ |
| 42 |
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip", |
| 43 |
], |
| 44 |
) |
| 45 |
|
| 46 |
maybe( |
| 47 |
http_archive, |
| 48 |
name = "llvm_zstd", |
| 49 |
build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD", |
| 50 |
sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0", |
| 51 |
strip_prefix = "zstd-1.5.2", |
| 52 |
urls = [ |
| 53 |
"https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz", |
| 54 |
], |
| 55 |
) |