Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions GitRepoStep.zig
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn create(b: *std.build.Builder, opt: struct {
.branch = opt.branch,
.sha = opt.sha,
.path = if (opt.path) |p| (b.allocator.dupe(u8, p) catch @panic("memory")) else (std.fs.path.resolve(b.allocator, &[_][]const u8{
b.build_root,
b.build_root.path.?,
"dep",
name,
})) catch @panic("memory"),
Expand Down Expand Up @@ -140,7 +140,7 @@ fn checkSha(self: GitRepoStep) !void {
"rev-parse",
"HEAD",
},
.cwd = self.builder.build_root,
.cwd = self.builder.build_root.path.?,
.env_map = self.builder.env_map,
}) catch |e| break :blk .{ .failed = e };
try std.io.getStdErr().writer().writeAll(result.stderr);
Expand Down Expand Up @@ -183,7 +183,7 @@ fn run(builder: *std.build.Builder, argv: []const []const u8) !void {
child.stdin_behavior = .Ignore;
child.stdout_behavior = .Inherit;
child.stderr_behavior = .Inherit;
child.cwd = builder.build_root;
child.cwd = builder.build_root.path.?;
child.env_map = builder.env_map;

try child.spawn();
Expand Down
31 changes: 14 additions & 17 deletions awkbuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -15,32 +15,30 @@ pub fn addAwk(
.branch = null,
});

// const config_step = b.addWriteFile(
// b.pathJoin(&.{repo.path, "src", "config.h"}),
// "#define VERSION \"1.0\"",
// );
// config_step.step.dependOn(&repo.step);
// const config_step = b.addWriteFile(
// b.pathJoin(&.{repo.path, "src", "config.h"}),
// "#define VERSION \"1.0\"",
// );
// config_step.step.dependOn(&repo.step);

const exe = b.addExecutable("awk", null);
exe.setTarget(target);
exe.setBuildMode(mode);
const exe = b.addExecutable(.{ .name = "awk", .target = target, .optimize = mode });
_ = b.addInstallArtifact(exe);
//exe.install();
exe.step.dependOn(&repo.step);
// exe.step.dependOn(&config_step.step);
// exe.step.dependOn(&config_step.step);
const repo_path = repo.getPath(&exe.step);
var files = std.ArrayList([]const u8).init(b.allocator);
const sources = [_][]const u8 {
// "main.c", "cmph.c", "hash.c", "chm.c", "bmz.c", "bmz8.c", "brz.c", "fch.c",
// "bdz.c", "bdz_ph.c", "chd_ph.c", "chd.c", "jenkins_hash.c", "graph.c", "vqueue.c",
// "buffer_manager.c", "fch_buckets.c", "miller_rabin.c", "compressed_seq.c",
// "compressed_rank.c", "buffer_entry.c", "select.c", "cmph_structs.c",
const sources = [_][]const u8{
// "main.c", "cmph.c", "hash.c", "chm.c", "bmz.c", "bmz8.c", "brz.c", "fch.c",
// "bdz.c", "bdz_ph.c", "chd_ph.c", "chd.c", "jenkins_hash.c", "graph.c", "vqueue.c",
// "buffer_manager.c", "fch_buckets.c", "miller_rabin.c", "compressed_seq.c",
// "compressed_rank.c", "buffer_entry.c", "select.c", "cmph_structs.c",
};
for (sources) |src| {
files.append(b.pathJoin(&.{repo_path, "src", src})) catch unreachable;
files.append(b.pathJoin(&.{ repo_path, "src", src })) catch unreachable;
}

exe.addCSourceFiles(files.toOwnedSlice() catch unreachable, &[_][]const u8 {
exe.addCSourceFiles(files.toOwnedSlice() catch unreachable, &[_][]const u8{
"-std=c11",
});

Expand All @@ -61,4 +59,3 @@ pub fn addAwk(

return exe;
}

Loading