Skip to content

Commit

Permalink
remove zarc in favor us custom unzip implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
marler8997 committed Apr 22, 2024
1 parent 24bcacc commit be89e33
Show file tree
Hide file tree
Showing 6 changed files with 592 additions and 19 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,4 @@ Zigup is currently built/tested using zig 0.11.0.

# Dependencies

The windows target depends on https://github.com/SuperAuguste/zarc to extract zip files. This repo might point to my fork if there are needed changes pending the acceptance of a PR: https://github.com/marler8997/zarc.

On linux and macos, zigup depends on `tar` to extract the compiler archive files (this may change in the future).
3 changes: 0 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ fn addZigupExe(

if (target.result.os.tag == .windows) {
exe.root_module.addImport("win32exelink", win32exelink_mod.?);
if (b.lazyDependency("zarc", .{})) |zarc_dep| {
exe.root_module.addImport("zarc", zarc_dep.module("zarc"));
}
}

return exe;
Expand Down
9 changes: 1 addition & 8 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
.name = "zigup",
.version = "0.0.1",

.dependencies = .{
.zarc = .{
.url = "https://github.com/marler8997/zarc/archive/6ed370681d0e0c5d8ef32ad63e440d0b3effc8a8.tar.gz",
.hash = "1220a69ceaac42e5a3593161c3b4ab1ce7dbc574b1a80398a7cb3100fbfa07baf372",
.lazy = true,
},
},

.paths = .{
"LICENSE",
"README.md",
Expand All @@ -19,5 +11,6 @@
"test.zig",
"win32exelink.zig",
"zigup.zig",
"zip.zig",
},
}
9 changes: 3 additions & 6 deletions zigup.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;

const zip = @import("zip.zig");

const ArrayList = std.ArrayList;
const Allocator = mem.Allocator;

const zarc = @import("zarc");

const fixdeletetree = @import("fixdeletetree.zig");

const arch = switch (builtin.cpu.arch) {
Expand Down Expand Up @@ -1007,10 +1007,7 @@ fn installCompiler(allocator: Allocator, compiler_dir: []const u8, url: []const
var timer = try std.time.Timer.start();
var archive_file = try std.fs.openFileAbsolute(archive_absolute, .{});
defer archive_file.close();
const reader = archive_file.reader();
var archive = try zarc.zip.load(allocator, reader);
defer archive.deinit(allocator);
_ = try archive.extract(reader, installing_dir_opened, .{});
try zip.pipeToFileSystem(installing_dir_opened, archive_file);
const time = timer.read();
loginfo("extracted archive in {d:.2} s", .{@as(f32, @floatFromInt(time)) / @as(f32, @floatFromInt(std.time.ns_per_s))});
}
Expand Down
Loading

0 comments on commit be89e33

Please sign in to comment.