This commit is contained in:
Nils
2024-08-09 21:31:25 +00:00
parent dbd1613886
commit 688be51f4f
7 changed files with 95 additions and 21 deletions

View File

@@ -7,4 +7,20 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- run: zig fmt --check .
- run: zig fmt --check .
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: actions/setup-go@v5
with:
go-version: '1.22.6'
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- run: sudo apt install autoconf libtool pkg-config make libzstd-dev libfuse3-dev
- run: zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux-musl
- run: zig-out/bin/dockerc --image docker://hello-world --output enlo
- run: ./enlo

3
.gitmodules vendored
View File

@@ -6,7 +6,8 @@
url = https://github.com/containers/skopeo.git
[submodule "crun"]
path = crun
url = https://github.com/containers/crun.git
url = https://github.com/NilsIrl/crun.git
branch = dockerc
[submodule "squashfs-tools"]
path = squashfs-tools
url = https://github.com/plougher/squashfs-tools.git

View File

@@ -57,7 +57,7 @@ pub fn build(b: *std.Build) void {
fuse_fss.addIncludePath(b.path("zstd/lib"));
fuse_fss.addIncludePath(b.path("libfuse/include"));
fuse_fss.addIncludePath(b.path("libfuse/build"));
fuse_fss.addIncludePath(b.path("libfuse_include"));
fuse_fss.addCSourceFiles(.{
.files = &[_][]const u8{
@@ -137,6 +137,13 @@ pub fn build(b: *std.Build) void {
.target = target,
});
const cc = std.fmt.allocPrint(
b.allocator,
// TODO: find exact zig location
"zig cc --target={s}",
.{target.result.zigTriple(b.allocator) catch @panic("OOM")},
) catch @panic("OOM");
const squashfuse_autogen = b.addSystemCommand(&[_][]const u8{
"./autogen.sh",
});
@@ -172,21 +179,6 @@ pub fn build(b: *std.Build) void {
overlayfs_configure.setCwd(b.path("fuse-overlayfs"));
overlayfs_configure.step.dependOn(&overlayfs_autogen.step);
const libfuse_mkdir_build = b.addSystemCommand(&[_][]const u8{
"mkdir",
"-p",
"build",
});
libfuse_mkdir_build.setCwd(b.path("libfuse"));
const configure_libfuse = b.addSystemCommand(&[_][]const u8{
"meson",
"setup",
"..",
});
configure_libfuse.setCwd(b.path("libfuse/build"));
configure_libfuse.step.dependOn(&libfuse_mkdir_build.step);
const runtime = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.link_libc = true,
@@ -195,6 +187,7 @@ pub fn build(b: *std.Build) void {
runtime.addImport("zstd", zstd);
runtime.addImport("fuse-overlayfs", fuse_fss);
runtime.addIncludePath(b.path("crun_include"));
runtime.addIncludePath(b.path("crun"));
runtime.addIncludePath(b.path("crun/src"));
runtime.addIncludePath(b.path("crun/libocispec/src"));
@@ -297,6 +290,10 @@ pub fn build(b: *std.Build) void {
"--disable-caps",
"--disable-seccomp",
});
crun_configure.setEnvironmentVariable(
"CC",
cc,
);
crun_configure.setCwd(b.path("crun"));
crun_configure.step.dependOn(&crun_autogen.step);
@@ -320,12 +317,10 @@ pub fn build(b: *std.Build) void {
runtime_x86_64.step.dependOn(&squashfuse_make_generate_swap.step);
runtime_x86_64.step.dependOn(&overlayfs_configure.step);
runtime_x86_64.step.dependOn(&libocspec_generate_files.step);
runtime_x86_64.step.dependOn(&configure_libfuse.step);
runtime_aarch64.step.dependOn(&squashfuse_make_generate_swap.step);
runtime_aarch64.step.dependOn(&overlayfs_configure.step);
runtime_aarch64.step.dependOn(&libocspec_generate_files.step);
runtime_aarch64.step.dependOn(&configure_libfuse.step);
}
const go_cpu_arch = switch (target.query.cpu_arch orelse target.result.cpu.arch) {

2
crun

Submodule crun updated: 05c4ea1941...fe982fafdd

View File

@@ -0,0 +1,3 @@
#ifndef GIT_VERSION
# define GIT_VERSION "dockerc-hash"
#endif

View File

@@ -0,0 +1,44 @@
/*
* Autogenerated by the Meson build system.
* Do not edit, your changes will be lost.
*/
#pragma once
// not available in musl
// #define HAVE_BACKTRACE
#define HAVE_COPY_FILE_RANGE
#define HAVE_FALLOCATE
#define HAVE_FDATASYNC
#define HAVE_FORK
#define HAVE_FSTATAT
#define HAVE_ICONV
#define HAVE_OPENAT
#define HAVE_PIPE2
#define HAVE_POSIX_FALLOCATE
#define HAVE_READLINKAT
#define HAVE_SETXATTR
#define HAVE_SPLICE
#define HAVE_STRUCT_STAT_ST_ATIM
#undef HAVE_STRUCT_STAT_ST_ATIMESPEC
#define HAVE_UTIMENSAT
#define HAVE_VMSPLICE
#define PACKAGE_VERSION "3.17.0"

View File

@@ -0,0 +1,15 @@
/*
* Autogenerated by the Meson build system.
* Do not edit, your changes will be lost.
*/
#pragma once
#define FUSE_HOTFIX_VERSION 0
#define FUSE_MAJOR_VERSION 3
#define FUSE_MINOR_VERSION 17
#define LIBFUSE_BUILT_WITH_VERSIONED_SYMBOLS 1