Skip to content
Draft
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
hashtree/
zig-out/
.zig-cache/
.zig-cache/zig-pkg/
.zig-cache/
zig-pkg/
14 changes: 7 additions & 7 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ pub fn build(b: *std.Build) void {
}),
});

const assembly_flags_default = &.{ "-g", "-fpic" };
var assembly_flags = std.ArrayList([]const u8).init(b.allocator);
assembly_flags.appendSlice(assembly_flags_default) catch unreachable;
const assembly_flags_default: []const []const u8 = &.{ "-g", "-fpic" };
var assembly_flags = std.ArrayListUnmanaged([]const u8).empty;
assembly_flags.appendSlice(b.allocator, assembly_flags_default) catch unreachable;

if (!target.result.cpu.arch.isAARCH64()) {
assembly_flags.append("-fno-integrated-as") catch unreachable;
assembly_flags.append(b.allocator, "-fno-integrated-as") catch unreachable;
}

// Add the assembly and C source files
// Only arm64 and x86 architectures have optimized assembly implementations.
// All other architectures will use the generic fallback C implementation.

lib.addCSourceFiles(.{
lib.root_module.addCSourceFiles(.{
.root = upstream.path("src"),
.files = if (target.result.cpu.arch.isArm() or target.result.cpu.arch.isAARCH64())
&[_][]const u8{
Expand All @@ -50,7 +50,7 @@ pub fn build(b: *std.Build) void {
.flags = assembly_flags.items,
});

lib.addCSourceFiles(.{
lib.root_module.addCSourceFiles(.{
.root = upstream.path("src"),
.files = &[_][]const u8{
"hashtree.c",
Expand All @@ -62,7 +62,7 @@ pub fn build(b: *std.Build) void {
"-Werror",
},
});
lib.addIncludePath(upstream.path("src"));
lib.root_module.addIncludePath(upstream.path("src"));

lib.installHeader(upstream.path("src/hashtree.h"), "hashtree.h");
b.installArtifact(lib);
Expand Down
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.version = "0.1.0",
.dependencies = .{
.hashtree = .{
.url = "git+https://github.com/offchainlabs/hashtree#f733b7698511b5498b722421a30ddf7e5066497c",
.hash = "N-V-__8AANPhDADGDLYAKqml8U-1jREHVH_-5vi9Mcwsf6oi",
.url = "git+https://github.com/lodekeeper-z/hashtree#c7588605b811de790a45d5dfafafc0e712854528",
.hash = "N-V-__8AAD7KDwAJhkERKP7udCdwtbZyt7nOUr8-MibaEgCN",
},
},
.fingerprint = 0xf963e115bea813b0,
Expand Down
Loading