mirror of https://github.com/golang/go.git
[dev.cryptoboring] misc/boring: update README for Bazel
Change-Id: I77e9f68f38dbeb4e22b9557aaad9eb92b7baf9cb Reviewed-on: https://go-review.googlesource.com/86278 Reviewed-by: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
c3d83ee31c
commit
528dad8c72
|
|
@ -68,15 +68,31 @@ and should need no other modifications.
|
|||
|
||||
## Building from Bazel
|
||||
|
||||
Using an alternate toolchain from Bazel is not as clean as it might be.
|
||||
Today, as of Bazel 0.5.3 and the bazelbuild/rules_go tag 0.5.3,
|
||||
it is necessary to define a `go-boringcrypto.bzl` file that duplicates
|
||||
some of the rules_go internal guts and then invoke its `go_repositories` rule
|
||||
instead of the standard one.
|
||||
Starting from [bazelbuild/rules_go](https://github.com/bazelbuild/rules_go)
|
||||
tag 0.7.1, simply download the BoringCrypto-enabled Go SDK using
|
||||
`go_download_sdk()` before calling `go_register_toolchains()`.
|
||||
|
||||
See https://gist.github.com/rsc/6f63d54886c9c50fa924597d7355bc93 for a minimal example.
|
||||
For example, to use Go 1.9.3 with BoringCrypto on Linux, use the following lines
|
||||
in `WORKSPACE`:
|
||||
```python
|
||||
load("@io_bazel_rules_go//go:def.bzl", "go_rules_dependencies", "go_download_sdk", "go_register_toolchains")
|
||||
|
||||
Note that in the example that the Bazel `WORKSPACE` file still refers to the release as "go1.8.3" not "go1.8.3b2".
|
||||
go_rules_dependencies()
|
||||
|
||||
go_download_sdk(
|
||||
name = "go_sdk",
|
||||
sdks = {
|
||||
"linux_amd64": ("go1.9.3b4.linux-amd64.tar.gz", "db1997b2454a2f27669b849d2d2cafb247a55128d53da678f06cb409310d6660"),
|
||||
},
|
||||
urls = ["https://storage.googleapis.com/go-boringcrypto/{}"],
|
||||
)
|
||||
|
||||
go_register_toolchains()
|
||||
```
|
||||
|
||||
**Note**: you must *not* enable `pure` mode, since cgo must be enabled. To
|
||||
ensure that binaries are linked with BoringCrypto, you can set `pure = "off"` on
|
||||
all relevant `go_binary` rules.
|
||||
|
||||
## Caveat
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue