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:
parent
d91df53ee7
commit
416bbf29e6
1 changed files with 13 additions and 0 deletions
13
build.zig
13
build.zig
|
@ -47,6 +47,7 @@ pub fn ensureDeps(step: *std.build.Step) !void {
|
|||
const allocator = std.heap.page_allocator;
|
||||
ensureGit(allocator);
|
||||
try ensureSubmodule(allocator, "src/deps/facilio");
|
||||
try ensurePatch(allocator, "src/deps/facilio", "../0001-microsecond-logging.patch");
|
||||
ensureMake(allocator);
|
||||
try makeFacilioLibdump(allocator);
|
||||
}
|
||||
|
@ -121,6 +122,18 @@ fn ensureSubmodule(allocator: std.mem.Allocator, path: []const u8) !void {
|
|||
_ = 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 {
|
||||
const result = std.ChildProcess.exec(.{
|
||||
.allocator = allocator,
|
||||
|
|
Loading…
Add table
Reference in a new issue