Skip to content

Commit f548001

Browse files
authored
Merge branch 'marler8997:master' into all_arch
2 parents 68ed570 + 6e645c4 commit f548001

File tree

5 files changed

+691
-369
lines changed

5 files changed

+691
-369
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ cp zig-out/bin/zigup BIN_PATH
5050

5151
# Building Zigup
5252

53-
Zigup is currently built/tested using zig 0.11.0.
53+
Zigup is currently built/tested using zig 0.12.0.
5454

5555
# TODO
5656

build.zig

+6-2
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,19 @@ pub fn build(b: *std.Build) !void {
1111
//var github_release_step = b.step("github-release", "Build the github-release binaries");
1212
//try addGithubReleaseExe(b, github_release_step, ziget_repo, "x86_64-linux", .std);
1313

14-
const target = if (b.option([]const u8, "ci_target", "the CI target being built")) |ci_target|
14+
const maybe_ci_target = b.option([]const u8, "ci_target", "the CI target being built");
15+
const target = if (maybe_ci_target) |ci_target|
1516
b.resolveTargetQuery(try std.zig.CrossTarget.parse(.{ .arch_os_abi = ci_target_map.get(ci_target) orelse {
1617
std.log.err("unknown ci_target '{s}'", .{ci_target});
1718
std.process.exit(1);
1819
} }))
1920
else
2021
b.standardTargetOptions(.{});
2122

22-
const optimize = b.standardOptimizeOption(.{});
23+
// Compile in ReleaseSafe on Windows for faster extraction
24+
const optimize: std.builtin.OptimizeMode = if (
25+
(maybe_ci_target != null) and (target.result.os.tag == .windows)
26+
) .ReleaseSafe else b.standardOptimizeOption(.{});
2327

2428
const win32exelink_mod: ?*std.Build.Module = blk: {
2529
if (target.result.os.tag == .windows) {

unzip.zig

+3-1
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,7 @@ pub fn main() !void {
7878
const zip_file = std.fs.cwd().openFile(zip_file_arg, .{}) catch |err|
7979
fatal("open '{s}' failed: {s}", .{zip_file_arg, @errorName(err)});
8080
defer zip_file.close();
81-
try @import("zip.zig").pipeToFileSystem(out_dir, zip_file);
81+
try @import("zip.zig").extract(out_dir, zip_file.seekableStream(), .{
82+
.allow_backslashes = true,
83+
});
8284
}

zigup.zig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ fn installCompiler(allocator: Allocator, compiler_dir: []const u8, url: []const
10101010
var timer = try std.time.Timer.start();
10111011
var archive_file = try std.fs.openFileAbsolute(archive_absolute, .{});
10121012
defer archive_file.close();
1013-
try zip.pipeToFileSystem(installing_dir_opened, archive_file);
1013+
try zip.extract(installing_dir_opened, archive_file.seekableStream(), .{});
10141014
const time = timer.read();
10151015
loginfo("extracted archive in {d:.2} s", .{@as(f32, @floatFromInt(time)) / @as(f32, @floatFromInt(std.time.ns_per_s))});
10161016
}

0 commit comments

Comments
 (0)