Skip to content

Commit 9fc8399

Browse files
committed
Update to zig 0.14
1 parent c6bcc8e commit 9fc8399

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
zig-version:
18-
- 0.13.0
18+
- 0.14.0
1919
- master # Let's test master while it works so that breaking it is deliberate decision
2020
os:
2121
- ubuntu-latest

build.zig

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub fn build(b: *std.Build) void {
44
const target = b.standardTargetOptions(.{});
55
const optimize = b.standardOptimizeOption(.{});
66

7-
const shared = b.option(bool, "shared", "Build as a shared library") orelse false;
7+
const linkage = b.option(std.builtin.LinkMode, "linkage", "How the library shall be linked") orelse .static;
88
const strip = b.option(bool, "strip", "Omit debug information");
99
const pic = b.option(bool, "pie", "Produce Position Independent Code");
1010

@@ -35,35 +35,34 @@ pub fn build(b: *std.Build) void {
3535

3636
const upstream = b.dependency("capstone", .{});
3737

38-
const capstone = std.Build.Step.Compile.create(b, .{
38+
const capstone = b.addLibrary(.{
3939
.name = "capstone",
40-
.kind = .lib,
41-
.linkage = if (shared) .dynamic else .static,
42-
.root_module = .{
40+
.linkage = linkage,
41+
.root_module = b.createModule(.{
4342
.target = target,
4443
.optimize = optimize,
4544
.pic = pic,
4645
.strip = strip,
4746
.link_libc = true,
48-
},
47+
}),
4948
});
5049
b.installArtifact(capstone);
5150
capstone.addIncludePath(upstream.path("include"));
5251
capstone.installHeadersDirectory(upstream.path("include/capstone"), "capstone", .{});
5352
capstone.installHeader(upstream.path("include/platform.h"), "capstone/platform.h");
5453
capstone.addCSourceFiles(.{ .root = upstream.path(""), .files = common_sources });
5554

56-
if (build_diet) capstone.defineCMacro("CAPSTONE_DIET", null);
57-
if (use_default_alloc) capstone.defineCMacro("CAPSTONE_USE_SYS_DYN_MEM", null);
58-
if (x86_reduce) capstone.defineCMacro("CAPSTONE_X86_REDUCE", null);
59-
if (x86_att_disable) capstone.defineCMacro("CAPSTONE_X86_ATT_DISABLE", null);
60-
if (osx_kernel_support) capstone.defineCMacro("CAPSTONE_HAS_OSXKERNEL", null);
61-
if (optimize == .Debug) capstone.defineCMacro("CAPSTONE_DEBUG", null);
55+
if (build_diet) capstone.root_module.addCMacro("CAPSTONE_DIET", "");
56+
if (use_default_alloc) capstone.root_module.addCMacro("CAPSTONE_USE_SYS_DYN_MEM", "");
57+
if (x86_reduce) capstone.root_module.addCMacro("CAPSTONE_X86_REDUCE", "");
58+
if (x86_att_disable) capstone.root_module.addCMacro("CAPSTONE_X86_ATT_DISABLE", "");
59+
if (osx_kernel_support) capstone.root_module.addCMacro("CAPSTONE_HAS_OSXKERNEL", "");
60+
if (optimize == .Debug) capstone.root_module.addCMacro("CAPSTONE_DEBUG", "");
6261

6362
var it = supported_architectures.iterator();
6463
while (it.next()) |key| {
6564
// std.log.info("Enabling CAPSTONE_HAS_{s}", .{key.macroName()});
66-
capstone.defineCMacro(b.fmt("CAPSTONE_HAS_{s}", .{key.macroName()}), null);
65+
capstone.root_module.addCMacro(b.fmt("CAPSTONE_HAS_{s}", .{key.macroName()}), "");
6766
capstone.addCSourceFiles(.{
6867
.root = upstream.path(b.fmt("arch/{s}", .{key.subdirectory()})),
6968
.files = key.sources(),

build.zig.zon

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
.{
2-
.name = "capstone",
2+
.name = .capstone,
33
.version = "5.0.1",
4-
.minimum_zig_version = "0.13.0",
4+
.minimum_zig_version = "0.14.0",
5+
.fingerprint = 0xc2a7c096815463b6,
56

67
.dependencies = .{
78
.capstone = .{
89
.url = "https://github.com/capstone-engine/capstone/archive/refs/tags/5.0.1.tar.gz",
9-
.hash = "12203db27899cf191689d4c4a37497e0bfb5e9e185ac8bb968792c5d138d64a75119",
10+
.hash = "N-V-__8AAOy5SwM9sniZzxkWidTEo3SX4L-16eGFrIu5aHks",
1011
},
1112
},
1213

0 commit comments

Comments
 (0)