-
Notifications
You must be signed in to change notification settings - Fork 7
/
workspace_setup.bzl
63 lines (53 loc) · 3.78 KB
/
workspace_setup.bzl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Do not change the filename; it is part of the user interface.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def hedron_make_cc_https_easy():
"""Setup a WORKSPACE so you can easily make https requests from C++.
Ensures you have CPR, whose interface you want to use...
... and its dependencies: curl, boringssl, and hedron_std_filesystem_backport.
"""
# Unified setup for users' WORKSPACES and this workspace when used standalone.
# See invocations in:
# README.md (for users)
# WORKSPACE (for working on this repo standalone)
maybe(
http_archive,
name = "cpr",
patches = ["@hedron_make_cc_https_easy//:cpr.patch"], # Switches to hedron_std_filesystem_backport (see https://github.com/libcpr/cpr/pull/929#issuecomment-1653008950) and removes version-define header from unbrella header <cpr/cpr.h>, since it's generated by cmake and we don't need it. If needed, could hack it in like https://github.com/curoky/tame/blob/c8926a2cd569848137ebb971a95057cb117055c3/recipes/c/cpr/default/BUILD
build_file = "@hedron_make_cc_https_easy//:cpr.BUILD",
url = "https://github.com/libcpr/cpr/archive/1.10.5.tar.gz",
sha256 = "c8590568996cea918d7cf7ec6845d954b9b95ab2c4980b365f582a665dea08d8",
strip_prefix = "cpr-1.10.5",
)
# Like many other libraries, CPR (temporarily) needs to backfill std::filesystem on Apple platforms.
# This is public API; we'll eliminate the shim only when it's obsolete.
maybe(
http_archive,
name = "hedron_std_filesystem_backport",
url = "https://github.com/hedronvision/bazel-cc-filesystem-backport/archive/495bba1ed1ae4becef754f6682fe675b1823cb7c.tar.gz",
sha256 = "2f3a8465f7e00d30bcc41959bc0628905829884ab46c4dddd2ece02613f401fb",
strip_prefix = "bazel-cc-filesystem-backport-495bba1ed1ae4becef754f6682fe675b1823cb7c",
)
# hedron_backport_std_filesystem is called in transitive_workspace_setup
# CPR wraps libcurl
# Note: libcurl updates are auto-PRd but not auto-merged, because the defines required to build it change frequently enough that you need to manually keep curl.BUILD in sync with https://github.com/curl/curl/commits/master/CMakeLists.txt. @cpsauer is responsible.
maybe(
http_archive,
name = "curl",
build_file = "@hedron_make_cc_https_easy//:curl.BUILD",
url = "https://github.com/curl/curl/archive/curl-8_8_0.tar.gz",
sha256 = "eb2f17efd68013945ffde1cb0ca61bf46709db86f400c76e84463aef453ed74e",
strip_prefix = "curl-curl-8_8_0",
)
# libcurl needs to bundle an SSL library on Android. We're using boringssl because it has easy Bazel support. Despite it's Google-only orientation, it's also used in, e.g., Envoy. But if LibreSSL had Bazel wrappings, we'd probably consider it.
# We're pointing our own mirror of google/boringssl:master-with-bazel to get Renovate auto-update. Otherwise, Renovate will keep moving us back to master, which doesn't support Bazel.
# https://bugs.chromium.org/p/boringssl/issues/detail?id=542 tracks having bazel on the boringssl master branch.
# https://github.com/renovatebot/renovate/issues/18492 tracks Renovate support for non-default branches.
# OPTIMNOTE: Boringssl's BUILD files should really be using assembly on Windows, if we add support https://bugs.chromium.org/p/boringssl/issues/detail?id=531
maybe(
http_archive,
name = "boringssl",
url = "https://github.com/hedronvision/boringssl/archive/8436f9ae16e28ce580d6c16d91758b42da1021fe.tar.gz",
sha256 = "fafd96960d62c6b5359b8a643005006ba1cb321d09e360551ecaeae7bb802f15",
strip_prefix = "boringssl-8436f9ae16e28ce580d6c16d91758b42da1021fe",
)