xref: /llvm-project/utils/bazel/examples/submodule/WORKSPACE (revision c0d1d0405cb9f55ec12dfb0cec9c5639d3b357d8)
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 a git submodule."""
69cc1ddd3SGeoffrey Martin-Noble
79cc1ddd3SGeoffrey Martin-Nobleworkspace(name = "submodule_example")
89cc1ddd3SGeoffrey Martin-Noble
98b86b3a8SGeoffrey Martin-NobleSKYLIB_VERSION = "1.0.3"
108b86b3a8SGeoffrey Martin-Noble
11*c0d1d040SKirillload("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
12*c0d1d040SKirill
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
2281d54124SChristian Siggnew_local_repository(
2381d54124SChristian Sigg    name = "llvm-raw",
2481d54124SChristian Sigg    build_file_content = "# empty",
259cc1ddd3SGeoffrey Martin-Noble    # Or wherever your submodule is located.
2681d54124SChristian Sigg    path = "third_party/llvm-project",
279cc1ddd3SGeoffrey Martin-Noble)
289cc1ddd3SGeoffrey Martin-Noble
297381dec4SAiden Grossmanload("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
30d08f8960SGeoffrey Martin-Noble
3181d54124SChristian Siggllvm_configure(name = "llvm-project")
327381dec4SAiden Grossman
33*c0d1d040SKirillload("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
34*c0d1d040SKirill
357381dec4SAiden Grossmanmaybe(
367381dec4SAiden Grossman    http_archive,
377381dec4SAiden Grossman    name = "llvm_zlib",
387381dec4SAiden Grossman    build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
397381dec4SAiden Grossman    sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
407381dec4SAiden Grossman    strip_prefix = "zlib-ng-2.0.7",
417381dec4SAiden Grossman    urls = [
427381dec4SAiden Grossman        "https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
437381dec4SAiden Grossman    ],
447381dec4SAiden Grossman)
457381dec4SAiden Grossman
467381dec4SAiden Grossmanmaybe(
477381dec4SAiden Grossman    http_archive,
487381dec4SAiden Grossman    name = "llvm_zstd",
497381dec4SAiden Grossman    build_file = "@llvm-raw//utils/bazel/third_party_build:zstd.BUILD",
507381dec4SAiden Grossman    sha256 = "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0",
517381dec4SAiden Grossman    strip_prefix = "zstd-1.5.2",
527381dec4SAiden Grossman    urls = [
532fcfc975SJordan Rupprecht        "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz",
547381dec4SAiden Grossman    ],
557381dec4SAiden Grossman)
56