A bit of README cleanup

Added allow_lzo build option due to lzo build issues
This commit is contained in:
Caleb J. Gardner
2026-02-11 06:56:20 -06:00
parent b8189490eb
commit fd9e3d595b
4 changed files with 22 additions and 10 deletions
+5 -2
View File
@@ -16,7 +16,10 @@ const Table = @import("table.zig").Table;
const MetadataReader = @import("util/metadata.zig");
const OffsetFile = @import("util/offset_file.zig");
const config = if (builtin.is_test) .{ .use_c_libs = true } else @import("config");
const config = if (builtin.is_test) .{
.use_c_libs = true,
.allow_lzo = false,
} else @import("config");
/// Information about a fragment section. Multiple fragments are contained in the block described by a single FragEntry.
/// The offset into the block and fragment size is stored in the file's inode.
@@ -79,7 +82,7 @@ pub fn initAdvanced(alloc: std.mem.Allocator, fil: File, offset: u64, threads: u
.xz => Decomp.xzDecompress,
.zstd => Decomp.zstdDecompress,
.lz4 => if (config.use_c_libs) Decomp.cLz4 else return error.Lz4Unsupported,
.lzo => if (config.use_c_libs) Decomp.cLzo else return error.LzoUnsupported,
.lzo => if (config.use_c_libs and config.allow_lzo) Decomp.lzoDecompress else return error.LzoUnsupported,
},
.super = super,
+7 -3
View File
@@ -5,15 +5,19 @@ const std = @import("std");
const Reader = std.Io.Reader;
const builtin = @import("builtin");
const config = if (builtin.is_test) .{ .use_c_libs = true } else @import("config");
const config = if (builtin.is_test) .{
.use_c_libs = true,
.allow_lzo = false,
} else @import("config");
const c = @cImport({
if (config.use_c_libs) {
@cInclude("zlib.h");
@cInclude("lzma.h");
@cInclude("lzo/minilzo.h");
@cInclude("lz4.h");
@cInclude("zstd.h");
if (config.allow_lzo)
@cInclude("lzo/minilzo.h");
}
});
@@ -176,7 +180,7 @@ pub const zstdDecompress = if (config.use_c_libs) cZstd else zigZstd;
pub fn zigZstd(alloc: std.mem.Allocator, in: []u8, out: []u8) anyerror!usize {
var rdr: Reader = .fixed(in);
const buf = try alloc.alloc(u8, std.compress.zstd.default_window_len + std.compress.zstd.block_size_max);
const buf = try alloc.alloc(u8, 1024 * 1024);
defer alloc.free(buf);
var decomp = std.compress.zstd.Decompress.init(&rdr, buf, .{});
return decomp.reader.readSliceShort(out) catch |err| {