Skip to content

Commit

Permalink
update build script
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoff-it committed Jul 26, 2024
1 parent 75552a4 commit 3338e0e
Showing 1 changed file with 29 additions and 31 deletions.
60 changes: 29 additions & 31 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,36 +29,34 @@ pub fn build(b: *std.Build) !void {
test_step.dependOn(&run_fuzz_unit_tests.step);

if (b.option(bool, "fuzz", "Generate an executable for AFL++ (persistent mode) plus extra tooling") orelse false) {
return;
const scripty_fuzz = b.addExecutable(.{
.name = "scriptyfuzz",
.root_source_file = b.path("src/fuzz.zig"),
.target = target,
.optimize = .Debug,
.single_threaded = true,
});

scripty_fuzz.root_module.addImport("scripty", scripty);
b.installArtifact(scripty_fuzz);

const afl_obj = b.addObject(.{
.name = "scriptyfuzz-afl",
.root_source_file = b.path("src/fuzz/afl.zig"),
// .target = b.resolveTargetQuery(.{ .cpu_model = .baseline }),
.target = target,
.optimize = .Debug,
});

afl_obj.root_module.addImport("scripty", scripty);
afl_obj.root_module.stack_check = false; // not linking with compiler-rt
afl_obj.root_module.link_libc = true; // afl runtime depends on libc
// afl_obj.root_module.fuzz = true;

const afl_fuzz = afl.addInstrumentedExe(b, target, optimize, afl_obj);
b.getInstallStep().dependOn(
&b.addInstallBinFile(afl_fuzz, "scriptyfuzz-afl").step,
);
// fuzz.dependOn(&b.addInstallArtifact(afl_fuzz, .{}).step);
}

const scripty_fuzz = b.addExecutable(.{
.name = "scriptyfuzz",
.root_source_file = b.path("src/fuzz.zig"),
.target = target,
.optimize = .Debug,
.single_threaded = true,
});

scripty_fuzz.root_module.addImport("scripty", scripty);
b.installArtifact(scripty_fuzz);

const afl_obj = b.addObject(.{
.name = "scriptyfuzz-afl",
.root_source_file = b.path("src/fuzz/afl.zig"),
// .target = b.resolveTargetQuery(.{ .cpu_model = .baseline }),
.target = target,
.optimize = .Debug,
});

afl_obj.root_module.addImport("scripty", scripty);
afl_obj.root_module.stack_check = false; // not linking with compiler-rt
afl_obj.root_module.link_libc = true; // afl runtime depends on libc
// afl_obj.root_module.fuzz = true;

const afl_fuzz = afl.addInstrumentedExe(b, target, optimize, afl_obj);
b.getInstallStep().dependOn(
&b.addInstallBinFile(afl_fuzz, "scriptyfuzz-afl").step,
);
// fuzz.dependOn(&b.addInstallArtifact(afl_fuzz, .{}).step);
}

0 comments on commit 3338e0e

Please sign in to comment.