Skip to content

Commit

Permalink
fix: use new build.zig from capstone dep
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraTenshi committed Jul 26, 2024
1 parent dcb3a63 commit 2a9cb8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 40 deletions.
39 changes: 1 addition & 38 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,9 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});

const arm = b.option(bool, "arm", "Controls -DCAPSTONE_HAS_ARM") orelse true;
const arm64 = b.option(bool, "arm64", "Controls -DCAPSTONE_HAS_ARM64") orelse true;
const mips = b.option(bool, "mips", "Controls -DCAPSTONE_HAS_MIPS") orelse true;
const powerpc = b.option(bool, "powerpc", "Controls -DCAPSTONE_HAS_POWERPC") orelse true;
const x86 = b.option(bool, "x86", "Controls -DCAPSTONE_HAS_X86") orelse true;
const sparc = b.option(bool, "sparc", "Controls -DCAPSTONE_HAS_SPARC") orelse true;
const sysz = b.option(bool, "sysz", "Controls -DCAPSTONE_HAS_SYSZ") orelse true;
const xcore = b.option(bool, "xcore", "Controls -DCAPSTONE_HAS_XCORE") orelse true;
const m68k = b.option(bool, "m68k", "Controls -DCAPSTONE_HAS_M68K") orelse true;
const tms320c64x = b.option(bool, "tms320c64x", "Controls -DCAPSTONE_HAS_TMS320C64X") orelse true;
const m680x = b.option(bool, "m680x", "Controls -DCAPSTONE_HAS_M680X") orelse true;
const evm = b.option(bool, "evm", "Controls -DCAPSTONE_HAS_EVM") orelse true;
const wasm = b.option(bool, "wasm", "Controls -DCAPSTONE_HAS_WASM") orelse true;
const mos65xx = b.option(bool, "mos65xx", "Controls -DCAPSTONE_HAS_MOS65XX") orelse true;
const bpf = b.option(bool, "bpf", "Controls -DCAPSTONE_HAS_BPF") orelse true;
const riscv = b.option(bool, "riscv", "Controls -DCAPSTONE_HAS_RISCV") orelse true;
const sh = b.option(bool, "sh", "Controls -DCAPSTONE_HAS_SH") orelse true;
const tricore = b.option(bool, "tricore", "Controls -DCAPSTONE_HAS_TRICORE") orelse true;

const capstone = b.dependency("capstone", .{
.target = target,
.optimize = optimize,
.arm = arm,
.arm64 = arm64,
.mips = mips,
.powerpc = powerpc,
.x86 = x86,
.sparc = sparc,
.sysz = sysz,
.xcore = xcore,
.m68k = m68k,
.tms320c64x = tms320c64x,
.m680x = m680x,
.evm = evm,
.wasm = wasm,
.mos65xx = mos65xx,
.bpf = bpf,
.riscv = riscv,
.sh = sh,
.tricore = tricore,
});
const compiled_capstone = capstone.artifact("capstone");

Expand All @@ -67,7 +30,7 @@ pub fn build(b: *std.Build) void {
},
});
mod.addLibraryPath(compiled_capstone.getEmittedBin().dirname());
mod.linkSystemLibrary("capstone", .{ .needed = true, .preferred_link_mode = .static });
mod.linkLibrary(capstone.artifact("capstone"));
mod.addIncludePath(compiled_capstone.getEmittedIncludeTree());

const mod_test = b.addTest(.{
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

.dependencies = .{
.capstone = .{
.url = "https://github.com/allyourcodebase/capstone/archive/main.tar.gz",
.hash = "1220c76dfd839d7ac6ae03dfd88aca1c00314dc9417efe9964898af7db5548109aec",
.url = "git+https://github.com/allyourcodebase/capstone.git?ref=main#a9067fbeaf0049b812a249c237e62408c3fd3df7",
.hash = "122062cee55ea063b596d72f2d32fc3ab60551ffc1433533ab2d79f07062d4565720",
},
},

Expand Down

0 comments on commit 2a9cb8b

Please sign in to comment.