From cc4834b2bceba51e5e93cdee2ec31ffdcbba064e Mon Sep 17 00:00:00 2001 From: Clover Date: Thu, 27 Aug 2026 19:12:48 -0500 Subject: [PATCH 1/5] fix build on Windows --- .gitignore | 2 ++ build.zig | 58 ++++++++++----------------------------------------- build.zig.zon | 10 ++++----- 3 files changed, 18 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index e73c965..726650e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ zig-cache/ +.zig-cache/ zig-out/ +zig-pkg/ diff --git a/build.zig b/build.zig index 49a63f4..7bd75a4 100644 --- a/build.zig +++ b/build.zig @@ -25,7 +25,8 @@ pub fn build(b: *std.Build) void { lib_mod.linkLibrary(zlib.artifact("z")); lib_mod.addCMacro("HAVE_CONFIG_H", "1"); - const lib = b.addStaticLibrary(.{ + const lib = b.addLibrary(.{ + .linkage = .static, .name = "archive", .root_module = lib_mod, }); @@ -47,6 +48,11 @@ pub fn build(b: *std.Build) void { .HAVE_UINT64_T = true, .HAVE_UINTMAX_T = true, .@"const" = .@"const", + .ARCHIVE_CRYPTO_MD5_WIN = is_windows, + .ARCHIVE_CRYPTO_SHA1_WIN = is_windows, + .ARCHIVE_CRYPTO_SHA256_WIN = is_windows, + .ARCHIVE_CRYPTO_SHA384_WIN = is_windows, + .ARCHIVE_CRYPTO_SHA512_WIN = is_windows, .BSDCAT_VERSION_STRING = version_string, .BSDCPIO_VERSION_STRING = version_string, .BSDTAR_VERSION_STRING = version_string, @@ -58,7 +64,6 @@ pub fn build(b: *std.Build) void { .HAVE_CHFLAGS = null, .HAVE_CHOWN = true, .HAVE_CHROOT = true, - .HAVE_CMTIME_S = null, .HAVE_COPYFILE_H = null, .HAVE_CTIME_R = !is_windows, .HAVE_CTYPE_H = true, @@ -97,15 +102,9 @@ pub fn build(b: *std.Build) void { .HAVE_ERRNO_H = true, .HAVE_EXPAT_H = null, .HAVE_EXT2FS_EXT2_FS_H = null, - .HAVE_EXTATTR_GET_FD = null, .HAVE_EXTATTR_GET_FILE = null, - .HAVE_EXTATTR_GET_LINK = null, - .HAVE_EXTATTR_LIST_FD = null, .HAVE_EXTATTR_LIST_FILE = null, - .HAVE_EXTATTR_LIST_LINK = null, .HAVE_EXTATTR_SET_FD = null, - .HAVE_EXTATTR_SET_LINK = null, - .HAVE_FACL = null, .HAVE_FCHDIR = true, .HAVE_FCHFLAGS = null, .HAVE_FCHMOD = !is_windows, @@ -164,14 +163,10 @@ pub fn build(b: *std.Build) void { .HAVE_LIBLZMA = null, .HAVE_LIBLZO2 = null, .HAVE_LIBMBEDCRYPTO = null, - .HAVE_LIBMD = true, .HAVE_LIBNETTLE = null, .HAVE_LIBPCRE = null, .HAVE_LIBPCRE2 = null, - .HAVE_LIBPCRE2_POSIX = null, .HAVE_LIBPCREPOSIX = null, - .HAVE_LIBREGEX = null, - .HAVE_LIBRICHACL = null, .HAVE_LIBXML2 = null, .HAVE_LIBXML_XMLREADER_H = null, .HAVE_LIBXML_XMLWRITER_H = null, @@ -196,12 +191,11 @@ pub fn build(b: *std.Build) void { .HAVE_LONG_LONG_INT = true, .HAVE_LSETEA = null, .HAVE_LSETXATTR = true, - .HAVE_LSTAT = true, + .HAVE_LSTAT = !is_windows, .HAVE_LSTAT_EMPTY_STRING_BUG = null, .HAVE_LUTIMES = true, .HAVE_LZ4HC_H = null, .HAVE_LZ4_H = null, - .HAVE_LZMA_FILTER_ARM64 = null, .HAVE_LZMA_H = null, .HAVE_LZMA_STREAM_ENCODER_MT = null, .HAVE_LZO_LZO1X_H = null, @@ -210,14 +204,8 @@ pub fn build(b: *std.Build) void { .HAVE_MBEDTLS_MD_H = null, .HAVE_MBEDTLS_PKCS5_H = null, .HAVE_MBRTOWC = true, - .HAVE_MBR_GID_TO_UUID = null, - .HAVE_MBR_UID_TO_UUID = null, - .HAVE_MBR_UUID_TO_ID = null, - .HAVE_MD5_H = true, .HAVE_MEMBERSHIP_H = null, .HAVE_MEMMOVE = true, - .HAVE_MEMSET = true, - .HAVE_MINIX_CONFIG_H = null, .HAVE_MKDIR = true, .HAVE_MKFIFO = true, .HAVE_MKNOD = true, @@ -242,27 +230,14 @@ pub fn build(b: *std.Build) void { .HAVE_POSIX_SPAWNP = true, .HAVE_PTHREAD_H = true, .HAVE_PWD_H = !is_windows, - .HAVE_READDIR_R = true, .HAVE_READLINK = true, .HAVE_READLINKAT = true, .HAVE_READPASSPHRASE = null, .HAVE_READPASSPHRASE_H = null, .HAVE_REGEX_H = true, - .HAVE_RICHACL_ALLOC = null, - .HAVE_RICHACL_EQUIV_MODE = null, - .HAVE_RICHACL_FREE = null, - .HAVE_RICHACL_GET_FD = null, - .HAVE_RICHACL_GET_FILE = null, - .HAVE_RICHACL_SET_FD = null, - .HAVE_RICHACL_SET_FILE = null, - .HAVE_RIPEMD_H = true, .HAVE_SELECT = true, .HAVE_SETENV = true, .HAVE_SETLOCALE = true, - .HAVE_SETXATTR = null, - .HAVE_SHA256_H = true, - .HAVE_SHA512_H = true, - .HAVE_SHA_H = true, .HAVE_SIGACTION = true, .HAVE_SIGNAL_H = true, .HAVE_SPAWN_H = true, @@ -280,11 +255,8 @@ pub fn build(b: *std.Build) void { .HAVE_STRFTIME = true, .HAVE_STRINGS_H = true, .HAVE_STRING_H = true, - .HAVE_STRNCPY_S = null, .HAVE_STRNLEN = true, .HAVE_STRRCHR = true, - .HAVE_STRUCT_RICHACE = null, - .HAVE_STRUCT_RICHACL = null, .HAVE_STRUCT_STATFS = null, .HAVE_STRUCT_STATFS_F_IOSIZE = null, .HAVE_STRUCT_STATFS_F_NAMEMAX = null, @@ -314,7 +286,6 @@ pub fn build(b: *std.Build) void { .HAVE_SYS_NDIR_H = null, .HAVE_SYS_PARAM_H = true, .HAVE_SYS_POLL_H = true, - .HAVE_SYS_QUEUE_H = true, .HAVE_SYS_RICHACL_H = null, .HAVE_SYS_SELECT_H = true, .HAVE_SYS_STATFS_H = is_linux, @@ -373,17 +344,9 @@ pub fn build(b: *std.Build) void { }), .LIBARCHIVE_VERSION_STRING = version_string, .LSTAT_FOLLOWS_SLASHED_SYMLINK = true, - .LT_OBJDIR = ".libs/", .MAJOR_IN_MKDEV = null, .MAJOR_IN_SYSMACROS = is_linux, .NTDDI_VERSION = null, - .PACKAGE = "libarchive", - .PACKAGE_BUGREPORT = "libarchive--discuss@googlegroups.com", - .PACKAGE_NAME = "libarchive", - .PACKAGE_STRING = b.fmt("libarchive {}", .{version}), - .PACKAGE_TARNAME = "libarchive", - .PACKAGE_URL = "", - .PACKAGE_VERSION = version_string, .SIZEOF_SHORT_CODE = .@" ", .SIZEOF_INT_CODE = .@" ", .SIZEOF_LONG_CODE = .@" ", @@ -557,13 +520,14 @@ pub fn build(b: *std.Build) void { }); if (is_windows) { - lib.linkSystemLibrary("bcrypt"); + lib.root_module.linkSystemLibrary("bcrypt", .{}); lib.root_module.addCSourceFiles(.{ .root = upstream.path("libarchive"), .files = &.{ "filter_fork_windows.c", "archive_windows.c", "archive_write_disk_windows.c", + "archive_umask.c", }, }); } else { @@ -578,7 +542,7 @@ pub fn build(b: *std.Build) void { } if (target.result.os.tag == .macos) { - lib.linkFramework("CoreServices"); + lib.root_module.linkFramework("CoreServices", .{}); } lib.root_module.addConfigHeader(config); diff --git a/build.zig.zon b/build.zig.zon index 6ba79f6..7189f8b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .libarchive, .fingerprint = 0x2cf9e5313e35d71, - .version = "3.8.1", + .version = "3.8.9", .paths = .{ "build.zig", "build.zig.zon", @@ -10,12 +10,12 @@ }, .dependencies = .{ .upstream = .{ - .url = "git+https://github.com/libarchive/libarchive.git?ref=v3.8.1#9525f90ca4bd14c7b335e2f8c84a4607b0af6bdf", - .hash = "N-V-__8AAKWgAwGJmkvJ0dRvaipQGmQGr-vjJR7sAa_X4zx1", + .url = "git+https://github.com/libarchive/libarchive.git?ref=v3.8.1#8e3167ca9840dc7b8d50d02db7db8595fc7d198e", + .hash = "N-V-__8AAL7rOAHsPl7WztZaVU01gjixtV8PAiVMO70smRzB", }, .zlib = .{ - .url = "git+https://github.com/allyourcodebase/zlib.git?ref=1.3.1#0918e87b7629b9c6a50a08edd0ce30d849758faf", - .hash = "zlib-1.3.1-AAAAACEMAAA0qyoSrfgBb_p25ItL4yRf_TBRk-26TYMF", + .url = "git+https://github.com/allyourcodebase/zlib.git?ref=v1.3.2#d3b5519d3b73616a6bfece0712f080029d2a9244", + .hash = "zlib-1.3.2-ZZQ7lc8NAAAHm9MDfplvwoesXvk4tVm6VCsiI8KnIbT0", }, }, } From 065c1673ea2a395222e65778210a810ebeb0e943 Mon Sep 17 00:00:00 2001 From: Clover Date: Thu, 27 Aug 2026 19:21:13 -0500 Subject: [PATCH 2/5] fix build on linux --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 7bd75a4..cdfbf91 100644 --- a/build.zig +++ b/build.zig @@ -411,6 +411,7 @@ pub fn build(b: *std.Build) void { "archive_entry_stat.c", "archive_entry_strmode.c", "archive_entry_xattr.c", + "archive_umask.c", "archive_time.c", "archive_hmac.c", "archive_match.c", @@ -527,7 +528,6 @@ pub fn build(b: *std.Build) void { "filter_fork_windows.c", "archive_windows.c", "archive_write_disk_windows.c", - "archive_umask.c", }, }); } else { From b1ab4bccc0bec7a21b708c721ffdc1485fd6f506 Mon Sep 17 00:00:00 2001 From: Clover Date: Thu, 27 Aug 2026 19:31:23 -0500 Subject: [PATCH 3/5] bump upstream libarchive to 3.8.9 --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 7189f8b..8380553 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -10,8 +10,8 @@ }, .dependencies = .{ .upstream = .{ - .url = "git+https://github.com/libarchive/libarchive.git?ref=v3.8.1#8e3167ca9840dc7b8d50d02db7db8595fc7d198e", - .hash = "N-V-__8AAL7rOAHsPl7WztZaVU01gjixtV8PAiVMO70smRzB", + .url = "git+https://github.com/libarchive/libarchive.git?ref=v3.8.9#701497fa91a60e70559b2512844f74971625da90", + .hash = "N-V-__8AAMrrOAEwlEQdoobrROT9HqnblW9U-SXUH7Es6vhv", }, .zlib = .{ .url = "git+https://github.com/allyourcodebase/zlib.git?ref=v1.3.2#d3b5519d3b73616a6bfece0712f080029d2a9244", From 16d7dfa72734bcf914a80926ffccc0981119238e Mon Sep 17 00:00:00 2001 From: Clover Date: Mon, 14 Sep 2026 15:15:04 -0500 Subject: [PATCH 4/5] github actions: bump Zig version --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 940b189..cde018c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: strategy: fail-fast: false matrix: - zig-version: ["0.14.0"] + zig-version: ["0.16.0"] os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} steps: From 7863dc6e5e743c6710624744916eaf0315bbfc8f Mon Sep 17 00:00:00 2001 From: Clover Date: Sat, 19 Sep 2026 13:48:42 -0500 Subject: [PATCH 5/5] ci: bump mlugg/setup-zig to v2 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cde018c..86e56b6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: uses: actions/checkout@v4 - name: Setup Zig - uses: mlugg/setup-zig@v1 + uses: mlugg/setup-zig@v2 with: version: ${{ matrix.zig-version }}