]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.cryptoboring] misc/boring: update README for Bazel
authorJeff Grafton <jgrafton@google.com>
Fri, 5 Jan 2018 01:05:56 +0000 (17:05 -0800)
committerRuss Cox <rsc@golang.org>
Fri, 9 Feb 2018 22:10:48 +0000 (22:10 +0000)
Change-Id: I77e9f68f38dbeb4e22b9557aaad9eb92b7baf9cb
Reviewed-on: https://go-review.googlesource.com/86278
Reviewed-by: Russ Cox <rsc@golang.org>
misc/boring/README.md

index 698b6617f9085987e2f4413c282563a9ffe30ab7..405e36c9b545138e635c7a28cf46b8cf65ae5f64 100644 (file)
@@ -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.
-
-See https://gist.github.com/rsc/6f63d54886c9c50fa924597d7355bc93 for a minimal example.
-
-Note that in the example that the Bazel `WORKSPACE` file still refers to the release as "go1.8.3" not "go1.8.3b2".
+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()`.
+
+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")
+
+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