diff --git a/.gitmodules b/.gitmodules index c14084b..d0f5d42 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "umoci"] path = umoci url = https://github.com/opencontainers/umoci.git +[submodule "skopeo"] + path = skopeo + url = https://github.com/containers/skopeo.git diff --git a/build.zig b/build.zig index 3e50a83..6253716 100644 --- a/build.zig +++ b/build.zig @@ -11,7 +11,6 @@ pub fn build(b: *std.Build) void { // means any target is allowed, and the default is native. Other options // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); - // target.result.abi = .musl; // Standard optimization options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not @@ -33,7 +32,11 @@ pub fn build(b: *std.Build) void { // .code_model = .medium, }); - const cpu_arch = target.query.cpu_arch orelse target.result.cpu.arch; + const go_cpu_arch = switch (target.query.cpu_arch orelse target.result.cpu.arch) { + .x86_64 => "amd64", + .aarch64 => "arm64", + else => @panic("unimplemented"), + }; const umoci = b.addSystemCommand(&[_][]const u8{ "go", "build", @@ -51,11 +54,27 @@ pub fn build(b: *std.Build) void { "0", ); - umoci.setEnvironmentVariable("GOARCH", switch (cpu_arch) { - .x86_64 => "amd64", - .aarch64 => "arm64", - else => @panic("unimplemented"), + umoci.setEnvironmentVariable("GOARCH", go_cpu_arch); + + const skopeo = b.addSystemCommand(&[_][]const u8{ + "go", + "build", + "-gcflags", + "", + "-tags", + "containers_image_openpgp", + "-o", }); + skopeo.setCwd(std.Build.LazyPath.relative("skopeo")); + const skopeo_output = skopeo.addOutputFileArg("skopeo"); + skopeo.addArg("./cmd/skopeo"); + + skopeo.setEnvironmentVariable( + "CGO_ENABLED", + "0", + ); + skopeo.setEnvironmentVariable("GOARCH", go_cpu_arch); + skopeo.setEnvironmentVariable("DISABLE_DOCS", "1"); const dockerc = b.addExecutable(.{ .name = "dockerc", @@ -69,10 +88,15 @@ pub fn build(b: *std.Build) void { "runtime", .{ .root_source_file = runtime.getEmittedBin() }, ); + dockerc.root_module.addAnonymousImport( "umoci", .{ .root_source_file = umoci_output }, ); + dockerc.root_module.addAnonymousImport( + "skopeo", + .{ .root_source_file = skopeo_output }, + ); dockerc.root_module.addImport("clap", clap.module("clap")); diff --git a/skopeo b/skopeo new file mode 160000 index 0000000..7001d70 --- /dev/null +++ b/skopeo @@ -0,0 +1 @@ +Subproject commit 7001d7014e8f7f0223671ced5fa2a2dab47873be diff --git a/src/tools/skopeo b/src/tools/skopeo deleted file mode 100755 index 8126fbd..0000000 --- a/src/tools/skopeo +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:940ddef87b0b2ff8a9d3bf8657549160a8e42b89f7b3a59e2d04c0b5ed2e05a8 -size 35204913