core: build initramfs using generic initramfs rule
This chips away at three different things:
- it brings us closer to hermetic and cross-platform builds by not
depending on genrule/shell and lz4-the-tool
- it generalizes initramfs building (allowing for more than one to be
built, if necessary)
- sets the stage to use Bazel transitions [1] to force all included Go
binaries to be built in pure/static mode while allowing host Go
binaries to use cgo/dynamic linking if necessary, and hopefully also
allowing us to get rid of some BUILD patches that set pure='on' in
go_binary calls (notably needed in Cilium and some existing
third_party dependencies).
[1] - https://docs.bazel.build/versions/master/skylark/config.html#user-defined-transitions
Test Plan: build machinery change, covered by existing tests
X-Origin-Diff: phab/D554
GitOrigin-RevId: a5561eb5ca16e6529b9a4a2b98352f579c424222
diff --git a/WORKSPACE b/WORKSPACE
index 8d22468..b002958 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -32,8 +32,8 @@
# Pin slightly above 0.23.0 (and 0.23.1 prerelease at time of writing) to pull in this commit.
# This fixes https://github.com/bazelbuild/rules_go/issues/2499, which started manifesting at 0.22.4.
name = "io_bazel_rules_go",
- strip_prefix = "rules_go-c07100d793fc0cdb20bc4f0361c1d53987ba259b",
sha256 = "89501e6e6ae6308e82239f0c8e53dceaa428ad8de471a7f8be8b99a1717bb7d8",
+ strip_prefix = "rules_go-c07100d793fc0cdb20bc4f0361c1d53987ba259b",
urls = [
"https://github.com/bazelbuild/rules_go/archive/c07100d793fc0cdb20bc4f0361c1d53987ba259b.zip",
],
@@ -177,3 +177,13 @@
sha256 = "adf770dfd574a0d6026bfaa270cb6879b063957177a991d453ff1d302c02081f",
urls = ["https://curl.haxx.se/ca/cacert-2020-01-01.pem"],
)
+
+# lz4, the library and the tool.
+http_archive(
+ name = "com_github_lz4_lz4",
+ patch_args = ["-p1"],
+ patches = ["//third_party/lz4:build.patch"],
+ sha256 = "658ba6191fa44c92280d4aa2c271b0f4fbc0e34d249578dd05e50e76d0e5efcc",
+ strip_prefix = "lz4-1.9.2",
+ urls = ["https://github.com/lz4/lz4/archive/v1.9.2.tar.gz"],
+)