workspace: add dosfstools
This adds dosfstools for its FAT32 fsck which is going to be used for
the FAT32 integration tests.
Change-Id: Ie4ae13ad3a63581868fea69fa7d91a27044f1d3b
Reviewed-on: https://review.monogon.dev/c/monogon/+/842
Tested-by: Jenkins CI
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/WORKSPACE b/WORKSPACE
index 6a47504..da64ef6 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -30,11 +30,11 @@
http_archive(
name = "io_bazel_rules_go",
- sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369",
patch_args = ["-p1"],
patches = [
- "//third_party/go/patches:rules_go_absolute_embedsrc.patch",
+ "//third_party/go/patches:rules_go_absolute_embedsrc.patch",
],
+ sha256 = "685052b498b6ddfe562ca7a97736741d87916fe536623afb7da2824c0211c369",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.33.0/rules_go-v0.33.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.33.0/rules_go-v0.33.0.zip",
@@ -55,7 +55,6 @@
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
-
load("//third_party/go:repositories.bzl", "go_repositories")
# gazelle:repository_macro third_party/go/repositories.bzl%go_repositories
@@ -299,6 +298,13 @@
urls = ["https://github.com/bonzini/qboot/archive/a5300c4949b8d4de2d34bedfaed66793f48ec948.tar.gz"],
)
+load("//third_party/dosfstools:external.bzl", "dosfstools_external")
+
+dosfstools_external(
+ name = "com_github_dosfstools_dosfstools",
+ version = "c888797b1d84ffbb949f147e3116e8bfb2e145a7",
+)
+
# Load musl toolchain Metropolis sysroot tarball into external repository.
load("//build/toolchain/musl-host-gcc:sysroot.bzl", "musl_sysroot_repositories")
diff --git a/third_party/dosfstools/BUILD b/third_party/dosfstools/BUILD
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/third_party/dosfstools/BUILD
diff --git a/third_party/dosfstools/dosfstools.bzl b/third_party/dosfstools/dosfstools.bzl
new file mode 100644
index 0000000..6202cfe
--- /dev/null
+++ b/third_party/dosfstools/dosfstools.bzl
@@ -0,0 +1,42 @@
+load("@rules_cc//cc:defs.bzl", "cc_binary")
+load("@dev_source_monogon//build/utils:template_file.bzl", "template_file")
+
+cc_binary(
+ name = "fsck",
+ srcs = [
+ "src/boot.c",
+ "src/boot.h",
+ "src/charconv.c",
+ "src/charconv.h",
+ "src/check.c",
+ "src/check.h",
+ "src/common.c",
+ "src/common.h",
+ "src/endian_compat.h",
+ "src/fat.c",
+ "src/fat.h",
+ "src/file.c",
+ "src/file.h",
+ "src/fsck.fat.c",
+ "src/fsck.fat.h",
+ "src/io.c",
+ "src/io.h",
+ "src/lfn.c",
+ "src/lfn.h",
+ "src/msdos_fs.h",
+ ":version.h",
+ ],
+ copts = ["-DHAVE_ENDIAN_H"],
+ visibility = ["//visibility:public"],
+ includes = ["."],
+)
+
+template_file(
+ name = "version.h",
+ src = "src/version.h.in",
+ substitutions = {
+ # ONCHANGE(//third_party/dosfstools:external.bzl): version needs to be kept in sync
+ "@PACKAGE_VERSION@": "unstable-2022-07-25",
+ "@RELEASE_DATE@": "2022-07-25",
+ },
+)
diff --git a/third_party/dosfstools/external.bzl b/third_party/dosfstools/external.bzl
new file mode 100644
index 0000000..459f725
--- /dev/null
+++ b/third_party/dosfstools/external.bzl
@@ -0,0 +1,14 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+def dosfstools_external(name, version):
+ sums = {
+ "c888797b1d84ffbb949f147e3116e8bfb2e145a7": "4a40b488c0c259c11fb54783fc6f01e5ee912582bb49d33d0d11b11f85a42e8d",
+ }
+
+ http_archive(
+ name = name,
+ sha256 = sums[version],
+ strip_prefix = "dosfstools-" + version,
+ build_file = "@//third_party/dosfstools:dosfstools.bzl",
+ urls = ["https://github.com/dosfstools/dosfstools/archive/%s.zip" % (version)],
+ )