@@ -38,7 +38,7 @@ pub fn build(b: *std.Build) void {
3838 }
3939
4040 const webui = build_webui (b , optimize , target , isStatic , enableTLS );
41- webui .linkLibrary (build_civetweb (b , optimize , target , isStatic , enableTLS ));
41+ // webui.linkLibrary(build_civetweb(b, optimize, target, isStatic, enableTLS));
4242
4343 webui .installHeader ("include/webui.h" , "webui.h" );
4444
@@ -143,6 +143,16 @@ fn build_webui(b: *Build, optimize: OptimizeMode, target: CrossTarget, is_static
143143 const name = "webui" ;
144144 const webui = if (is_static ) b .addStaticLibrary (.{ .name = name , .target = target , .optimize = optimize }) else b .addSharedLibrary (.{ .name = name , .target = target , .optimize = optimize });
145145
146+ const extra_flags = if (target .os_tag == .windows or (target .os_tag == null and builtin .os .tag == .windows ))
147+ "-DMUST_IMPLEMENT_CLOCK_GETTIME"
148+ else
149+ "" ;
150+
151+ const cflags = if (enable_tls )
152+ [_ ][]const u8 { "-DNDEBUG" , "-DNO_CACHING" , "-DNO_CGI" , "-DUSE_WEBSOCKET" , "-DWEBUI_TLS" , "-DNO_SSL_DL" , "-DOPENSSL_API_1_1" , extra_flags }
153+ else
154+ [_ ][]const u8 { "-DNDEBUG" , "-DNO_CACHING" , "-DNO_CGI" , "-DUSE_WEBSOCKET" , "-DNO_SSL" , extra_flags , "" , "" };
155+
146156 webui .addCSourceFile (.{
147157 .file = .{ .path = "src/webui.c" },
148158 .flags = if (enable_tls )
@@ -151,40 +161,25 @@ fn build_webui(b: *Build, optimize: OptimizeMode, target: CrossTarget, is_static
151161 &[_ ][]const u8 {"-DNO_SSL" },
152162 });
153163
154- webui .linkLibC ();
155-
156- webui .addIncludePath (.{ .path = "include" });
157-
158- return webui ;
159- }
160-
161- fn build_civetweb (b : * Build , optimize : OptimizeMode , target : CrossTarget , is_static : bool , enable_tls : bool ) * Compile {
162- const name = "civetweb" ;
163- const civetweb = if (is_static ) b .addStaticLibrary (.{ .name = name , .target = target , .optimize = optimize }) else b .addSharedLibrary (.{ .name = name , .target = target , .optimize = optimize });
164-
165- civetweb .addIncludePath (.{ .path = "include" });
166-
167- const extra_flags = if (target .os_tag == .windows or (target .os_tag == null and builtin .os .tag == .windows )) "-DMUST_IMPLEMENT_CLOCK_GETTIME" else "" ;
168-
169- const cflags = if (enable_tls ) [_ ][]const u8 { "-DNDEBUG" , "-DNO_CACHING" , "-DNO_CGI" , "-DUSE_WEBSOCKET" , "-DWEBUI_TLS" , "-DNO_SSL_DL" , "-DOPENSSL_API_1_1" , extra_flags } else [_ ][]const u8 { "-DNDEBUG" , "-DNO_CACHING" , "-DNO_CGI" , "-DUSE_WEBSOCKET" , "-DNO_SSL" , extra_flags , "" , "" };
170-
171- civetweb .addCSourceFile (.{
164+ webui .addCSourceFile (.{
172165 .file = .{ .path = "src/civetweb/civetweb.c" },
173166 .flags = & cflags ,
174167 });
175168
176- civetweb .linkLibC ();
169+ webui .linkLibC ();
170+
171+ webui .addIncludePath (.{ .path = "include" });
177172
178173 if (target .os_tag == .windows or (target .os_tag == null and builtin .os .tag == .windows )) {
179- civetweb .linkSystemLibrary ("ws2_32" );
174+ webui .linkSystemLibrary ("ws2_32" );
180175 if (enable_tls ) {
181- civetweb .linkSystemLibrary ("bcrypt" );
176+ webui .linkSystemLibrary ("bcrypt" );
182177 }
183178 }
184179 if (enable_tls ) {
185- civetweb .linkSystemLibrary ("ssl" );
186- civetweb .linkSystemLibrary ("crypto" );
180+ webui .linkSystemLibrary ("ssl" );
181+ webui .linkSystemLibrary ("crypto" );
187182 }
188183
189- return civetweb ;
184+ return webui ;
190185}
0 commit comments