1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

added auto-patching for microsecond-logging

This commit is contained in:
Rene Schallner 2023-01-11 23:35:47 +01:00
parent d91df53ee7
commit 416bbf29e6

View file

@ -47,6 +47,7 @@ pub fn ensureDeps(step: *std.build.Step) !void {
const allocator = std.heap.page_allocator; const allocator = std.heap.page_allocator;
ensureGit(allocator); ensureGit(allocator);
try ensureSubmodule(allocator, "src/deps/facilio"); try ensureSubmodule(allocator, "src/deps/facilio");
try ensurePatch(allocator, "src/deps/facilio", "../0001-microsecond-logging.patch");
ensureMake(allocator); ensureMake(allocator);
try makeFacilioLibdump(allocator); try makeFacilioLibdump(allocator);
} }
@ -121,6 +122,18 @@ fn ensureSubmodule(allocator: std.mem.Allocator, path: []const u8) !void {
_ = try child.spawnAndWait(); _ = try child.spawnAndWait();
} }
fn ensurePatch(allocator: std.mem.Allocator, path: []const u8, patch: []const u8) !void {
if (std.process.getEnvVarOwned(allocator, "NO_ENSURE_SUBMODULES")) |no_ensure_submodules| {
defer allocator.free(no_ensure_submodules);
if (std.mem.eql(u8, no_ensure_submodules, "true")) return;
} else |_| {}
var child = std.ChildProcess.init(&.{ "git", "-C", path, "am", "-3", patch }, allocator);
child.cwd = sdkPath("/");
child.stderr = std.io.getStdErr();
child.stdout = std.io.getStdOut();
_ = try child.spawnAndWait();
}
fn ensureMake(allocator: std.mem.Allocator) void { fn ensureMake(allocator: std.mem.Allocator) void {
const result = std.ChildProcess.exec(.{ const result = std.ChildProcess.exec(.{
.allocator = allocator, .allocator = allocator,