-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.zig
71 lines (58 loc) · 2.31 KB
/
build.zig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const std = @import("std");
const builtin = @import("builtin");
const bearssl = @import("zig-bearssl");
pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{
.default_target = try std.zig.CrossTarget.parse(.{
.arch_os_abi = if (builtin.os.tag == .windows)
"native-native-gnu" // on windows, use gnu by default
else
"native-linux-musl", // glibc has some problems by-default, use musl instead
}),
});
const gurl = b.addExecutable(.{
.name = "gurl",
.root_source_file = .{
.path = "src/main.zig",
},
.target = target,
.optimize = optimize,
.link_libc = true,
});
const gurl_test = b.addTest(.{
.root_source_file = .{
.path = "src/main.zig",
},
.target = target,
.optimize = optimize,
.link_libc = true,
});
const zig_network_dep = b.dependency("zig-network", .{});
const zig_args_dep = b.dependency("zig-args", .{});
const known_folders_dep = b.dependency("known-folders", .{});
const bearssl_dep = b.dependency("zig-bearssl", .{});
const zig_network = zig_network_dep.module("network");
const zig_args = zig_args_dep.module("args");
const known_folders = known_folders_dep.module("known-folders");
const zig_bearssl = bearssl_dep.module("bearssl");
for ([_]*std.Build.Step.Compile{ gurl, gurl_test }) |module| {
bearssl.bearssl.linkBearSSL(bearssl_dep.builder.build_root.path orelse ".", module, target);
module.addModule("zig-network", zig_network);
module.addModule("zig-args", zig_args);
module.addModule("known-folders", known_folders);
module.addModule("zig-bearssl", zig_bearssl);
}
if (optimize != .Debug) {
gurl.strip = true;
}
b.installArtifact(gurl);
const gurl_exec = b.addRunArtifact(gurl);
gurl_exec.addArgs(&[_][]const u8{
"gemini://gemini.circumlunar.space/",
});
const run_step = b.step("run", "Runs gurl with gemini://gemini.circumlunar.space/");
run_step.dependOn(&gurl_exec.step);
const test_step = b.step("test", "Runs the test suite with queries to gemini.circumlunar.space");
test_step.dependOn(&gurl_test.step);
}