diff --git a/README.md b/README.md index e56856e..3174216 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,27 @@ This is my experiments to learn Zig. Might amount to something. Might not. +A library and application to decompress or view squashfs archives. + ## Current State Overall works, but currently is completely single threaded and is missing some features. Extraction is slow. Only properly work on Linux, any other OSes probably won't work fully. + +## Build options + +> `-Duse_c_libs` + +Instead of using Zig's standard library for decompression + +> `Dversion` + +Sets the version of `unsquashfs` shown when `--version` is passed. + +## Capabilities + +Most features are present except for the following: + +* mod_time is not set on extraction +* xattrs are not applied on extraction +* Only zstd c library is implemented (all others result in error.TODO). +* When using Zig decompression libraries then lzo and lz4 compression types are unavailable. I don't _really_ plan on spending the time to find and validate a library since neither is popular. diff --git a/build.zig b/build.zig index e75861a..342648c 100644 --- a/build.zig +++ b/build.zig @@ -1,7 +1,6 @@ const std = @import("std"); pub fn build(b: *std.Build) !void { - const static_option = b.option(bool, "static_build", "Build static"); const use_c_libs_option = b.option(bool, "use_c_libs", "Use C versions of decompression libraries instead of the Zig standard library ones"); const version_string_option = b.option([]const u8, "version", "Version of the library/binary"); @@ -35,7 +34,6 @@ pub fn build(b: *std.Build) !void { exe_mod.addOptions("config", unsquashfs_options); const exe = b.addExecutable(.{ .name = "unsquashfs", - .linkage = if (static_option == true) .static else .dynamic, .root_module = exe_mod, }); diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 0000000..ec0ff6e --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +zig test -lc -lzstd src/test.zig diff --git a/src/decomp.zig b/src/decomp.zig index 975d0f8..7357a85 100644 --- a/src/decomp.zig +++ b/src/decomp.zig @@ -3,8 +3,9 @@ const std = @import("std"); const Reader = std.Io.Reader; +const builtin = @import("builtin"); -const config = @import("config"); +const config = if (builtin.is_test) .{ .use_c_libs = true } else @import("config"); const c = @cImport({ @cInclude("zstd.h");