@@ -6,12 +6,10 @@ const macos_private_framework = "/Applications/Xcode.app/Contents/Developer/Plat
66pub fn build (b : * Build ) ! void {
77 const optimize = b .standardOptimizeOption (.{});
88 const target = b .standardTargetOptions (.{});
9- const skip_zigfetch = b .option (bool , "skip-zigfetch" , "Skip zig fetch" ) orelse false ;
10- const vendor_libcurl = b .option (bool , "vendor-libcurl" , "Static link libcurl" ) orelse false ;
119 var all_tests = std .ArrayList (* Build .Step ).init (b .allocator );
1210
1311 try addModules (b , target , optimize , & all_tests );
14- try buildBinaries (b , optimize , target , & all_tests , skip_zigfetch , vendor_libcurl );
12+ try buildBinaries (b , optimize , target , & all_tests );
1513 try buildExamples (b , optimize , target , & all_tests );
1614
1715 const test_all_step = b .step ("test" , "Run all tests" );
@@ -102,7 +100,7 @@ fn buildExamples(
102100 "simargs-demo" ,
103101 "pretty-table-demo" ,
104102 }) | name | {
105- try buildBinary (b , .{ .ex = name }, optimize , target , all_tests , false , false );
103+ try buildBinary (b , .{ .ex = name }, optimize , target , all_tests );
106104 }
107105}
108106
@@ -111,8 +109,6 @@ fn buildBinaries(
111109 optimize : std.builtin.Mode ,
112110 target : std.Build.ResolvedTarget ,
113111 all_tests : * std .ArrayList (* Build.Step ),
114- skip_zigfetch : bool ,
115- vendor_libcurl : bool ,
116112) ! void {
117113 inline for (.{
118114 "zigfetch" ,
@@ -132,8 +128,6 @@ fn buildBinaries(
132128 optimize ,
133129 target ,
134130 all_tests ,
135- skip_zigfetch ,
136- vendor_libcurl ,
137131 );
138132 }
139133
@@ -147,16 +141,12 @@ fn buildBinary(
147141 optimize : std.builtin.Mode ,
148142 target : std.Build.ResolvedTarget ,
149143 all_tests : * std .ArrayList (* Build.Step ),
150- skip_zigfetch : bool ,
151- vendor_libcurl : bool ,
152144) ! void {
153145 if (makeCompileStep (
154146 b ,
155147 source ,
156148 optimize ,
157149 target ,
158- skip_zigfetch ,
159- vendor_libcurl ,
160150 )) | exe | {
161151 var deps = b .modules .iterator ();
162152 while (deps .next ()) | dep | {
@@ -200,8 +190,6 @@ fn makeCompileStep(
200190 comptime source : Source ,
201191 optimize : std.builtin.Mode ,
202192 target : std.Build.ResolvedTarget ,
203- skip_zigfetch : bool ,
204- vendor_libcurl : bool ,
205193) ? * Build.Step.Compile {
206194 const name = comptime source .name ();
207195 const path = comptime source .path ();
@@ -236,28 +224,13 @@ fn makeCompileStep(
236224 }
237225 exe .linkLibC ();
238226 } else if (std .mem .eql (u8 , name , "zigfetch" )) {
239- if (skip_zigfetch ) {
240- return null ;
241- }
242- const host_os = @import ("builtin" ).os .tag ;
243- const build_os = target .result .os .tag ;
244- if (host_os != build_os ) { // don't support cross compile
245- return null ;
246- }
247- if (host_os == .linux or host_os == .macos ) {
248- const dep_curl = b .dependency ("curl" , .{
249- .link_vendor = vendor_libcurl ,
250- .target = target ,
251- .optimize = optimize ,
252- });
253- if (! vendor_libcurl ) {
254- exe .linkSystemLibrary ("curl" );
255- }
256- exe .root_module .addImport ("curl" , dep_curl .module ("curl" ));
257- exe .linkLibC ();
258- } else {
259- return null ;
260- }
227+ const dep_curl = b .dependency ("curl" , .{
228+ .link_vendor = true ,
229+ .target = target ,
230+ .optimize = optimize ,
231+ });
232+ exe .root_module .addImport ("curl" , dep_curl .module ("curl" ));
233+ exe .linkLibC ();
261234 } else if (std .mem .eql (u8 , name , "pidof" )) {
262235 // only build for macOS
263236 if (is_darwin ) {
0 commit comments