@@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
13
13
const CONFIG_MEM_DEBUG = b .option (bool , "CONFIG_MEM_DEBUG" , "compile with MEM_DEBUG flag defined for tcc" ) orelse false ;
14
14
15
15
switch (target .result .os .tag ) {
16
- .windows , .macos , .linux = > {},
16
+ .windows , .macos , .linux , .dragonfly , .freebsd , .netbsd , .openbsd = > {},
17
17
else = > if (no_fail ) return else @panic ("Unsupported OS" ),
18
18
}
19
19
switch (target .result .cpu .arch ) {
@@ -32,8 +32,10 @@ pub fn build(b: *std.Build) !void {
32
32
{
33
33
const c2str_exe = b .addExecutable (.{
34
34
.name = "config-tcc" ,
35
- .target = build_native_target ,
36
- .optimize = .Debug ,
35
+ .root_module = b .createModule (.{
36
+ .target = build_native_target ,
37
+ .optimize = .Debug ,
38
+ }),
37
39
});
38
40
39
41
c2str_exe .linkLibC ();
@@ -50,10 +52,13 @@ pub fn build(b: *std.Build) !void {
50
52
c2str_step .dependOn (& run_exe .step );
51
53
}
52
54
53
- const lib = b .addStaticLibrary (.{
55
+ const lib = b .addLibrary (.{
54
56
.name = "libtinycc" ,
55
- .target = target ,
56
- .optimize = optimize ,
57
+ .linkage = .static ,
58
+ .root_module = b .createModule (.{
59
+ .target = target ,
60
+ .optimize = optimize ,
61
+ }),
57
62
});
58
63
lib .linkLibC ();
59
64
lib .addIncludePath (b .path ("src/config" ));
@@ -117,6 +122,7 @@ pub fn build(b: *std.Build) !void {
117
122
try C_SOURCES .append (file );
118
123
},
119
124
.linux = > {},
125
+ .dragonfly , .freebsd , .netbsd , .openbsd = > {},
120
126
else = > unreachable ,
121
127
}
122
128
@@ -143,6 +149,10 @@ pub fn build(b: *std.Build) !void {
143
149
if (target .result .abi == .musl )
144
150
try FLAGS .append ("-DCONFIG_TCC_MUSL" );
145
151
},
152
+ .dragonfly = > try FLAGS .append ("-DTARGETOS_DragonFly" ),
153
+ .freebsd = > try FLAGS .append ("-DTARGETOS_FreeBSD" ),
154
+ .netbsd = > try FLAGS .append ("-DTARGETOS_NetBSD" ),
155
+ .openbsd = > try FLAGS .append ("-DTARGETOS_OpenBSD" ),
146
156
else = > unreachable ,
147
157
}
148
158
@@ -162,9 +172,11 @@ pub fn build(b: *std.Build) !void {
162
172
b .installArtifact (lib );
163
173
164
174
const unit_tests = b .addTest (.{
165
- .root_source_file = b .path ("src/lib.zig" ),
166
- .target = target ,
167
- .optimize = optimize ,
175
+ .root_module = b .createModule (.{
176
+ .root_source_file = b .path ("src/lib.zig" ),
177
+ .target = target ,
178
+ .optimize = optimize ,
179
+ }),
168
180
});
169
181
unit_tests .linkLibrary (lib );
170
182
0 commit comments