@@ -9,7 +9,7 @@ const fs = std.fs;
9
9
const InstallDirectoryOptions = std .Build .InstallDirectoryOptions ;
10
10
const assert = std .debug .assert ;
11
11
12
- const zig_version = std.builtin.Version { .major = 0 , .minor = 11 , .patch = 0 };
12
+ const zig_version = std.SemanticVersion { .major = 0 , .minor = 11 , .patch = 0 };
13
13
const stack_size = 32 * 1024 * 1024 ;
14
14
15
15
pub fn build (b : * std.Build ) ! void {
@@ -30,6 +30,7 @@ pub fn build(b: *std.Build) !void {
30
30
const test_step = b .step ("test" , "Run all the tests" );
31
31
const skip_install_lib_files = b .option (bool , "no-lib" , "skip copying of lib/ files and langref to installation prefix. Useful for development" ) orelse false ;
32
32
const skip_install_langref = b .option (bool , "no-langref" , "skip copying of langref to the installation prefix" ) orelse skip_install_lib_files ;
33
+ const no_bin = b .option (bool , "no-bin" , "skip emitting compiler binary" ) orelse false ;
33
34
34
35
const docgen_exe = b .addExecutable (.{
35
36
.name = "docgen" ,
@@ -104,7 +105,7 @@ pub fn build(b: *std.Build) !void {
104
105
105
106
if (! skip_install_lib_files ) {
106
107
b .installDirectory (InstallDirectoryOptions {
107
- .source_dir = "lib" ,
108
+ .source_dir = .{ . path = "lib" } ,
108
109
.install_dir = .lib ,
109
110
.install_subdir = "zig" ,
110
111
.exclude_extensions = &[_ ][]const u8 {
@@ -166,6 +167,7 @@ pub fn build(b: *std.Build) !void {
166
167
exe .pie = pie ;
167
168
exe .sanitize_thread = sanitize_thread ;
168
169
exe .entitlements = entitlements ;
170
+ if (no_bin ) exe .emit_bin = .no_emit ;
169
171
170
172
exe .build_id = b .option (
171
173
std .Build .Step .Compile .BuildId ,
@@ -197,7 +199,7 @@ pub fn build(b: *std.Build) !void {
197
199
exe_options .addOption (bool , "llvm_has_xtensa" , llvm_has_xtensa );
198
200
exe_options .addOption (bool , "force_gpa" , force_gpa );
199
201
exe_options .addOption (bool , "only_c" , only_c );
200
- exe_options .addOption (bool , "omit_pkg_fetching_code " , only_c );
202
+ exe_options .addOption (bool , "only_core_functionality " , only_c );
201
203
202
204
if (link_libc ) {
203
205
exe .linkLibC ();
@@ -235,12 +237,12 @@ pub fn build(b: *std.Build) !void {
235
237
},
236
238
2 = > {
237
239
// Untagged development build (e.g. 0.10.0-dev.2025+ecf0050a9).
238
- var it = mem .split (u8 , git_describe , "-" );
240
+ var it = mem .splitScalar (u8 , git_describe , '-' );
239
241
const tagged_ancestor = it .first ();
240
242
const commit_height = it .next ().? ;
241
243
const commit_id = it .next ().? ;
242
244
243
- const ancestor_ver = try std .builtin . Version .parse (tagged_ancestor );
245
+ const ancestor_ver = try std .SemanticVersion .parse (tagged_ancestor );
244
246
if (zig_version .order (ancestor_ver ) != .gt ) {
245
247
std .debug .print ("Zig version '{}' must be greater than tagged ancestor '{}'\n " , .{ zig_version , ancestor_ver });
246
248
std .process .exit (1 );
@@ -280,7 +282,7 @@ pub fn build(b: *std.Build) !void {
280
282
// That means we also have to rely on stage1 compiled c++ files. We parse config.h to find
281
283
// the information passed on to us from cmake.
282
284
if (cfg .cmake_prefix_path .len > 0 ) {
283
- var it = mem .tokenize (u8 , cfg .cmake_prefix_path , ";" );
285
+ var it = mem .tokenizeScalar (u8 , cfg .cmake_prefix_path , ';' );
284
286
while (it .next ()) | path | {
285
287
b .addSearchPrefix (path );
286
288
}
@@ -354,7 +356,7 @@ pub fn build(b: *std.Build) !void {
354
356
test_cases_options .addOption (bool , "llvm_has_xtensa" , llvm_has_xtensa );
355
357
test_cases_options .addOption (bool , "force_gpa" , force_gpa );
356
358
test_cases_options .addOption (bool , "only_c" , only_c );
357
- test_cases_options .addOption (bool , "omit_pkg_fetching_code " , true );
359
+ test_cases_options .addOption (bool , "only_core_functionality " , true );
358
360
test_cases_options .addOption (bool , "enable_qemu" , b .enable_qemu );
359
361
test_cases_options .addOption (bool , "enable_wine" , b .enable_wine );
360
362
test_cases_options .addOption (bool , "enable_wasmtime" , b .enable_wasmtime );
@@ -469,9 +471,8 @@ pub fn build(b: *std.Build) !void {
469
471
.skip_non_native = skip_non_native ,
470
472
.skip_cross_glibc = skip_cross_glibc ,
471
473
.skip_libc = skip_libc ,
472
- // I observed a value of 3398275072 on my M1, and multiplied by 1.1 to
473
- // get this amount:
474
- .max_rss = 3738102579 ,
474
+ // I observed a value of 4572626944 on the M2 CI.
475
+ .max_rss = 5029889638 ,
475
476
}));
476
477
477
478
try addWasiUpdateStep (b , version );
@@ -487,7 +488,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
487
488
.cpu_arch = .wasm32 ,
488
489
.os_tag = .wasi ,
489
490
};
490
- target .cpu_features_add .addFeature (@enumToInt (std .Target .wasm .Feature .bulk_memory ));
491
+ target .cpu_features_add .addFeature (@intFromEnum (std .Target .wasm .Feature .bulk_memory ));
491
492
492
493
const exe = addCompilerStep (b , .ReleaseSmall , target );
493
494
@@ -506,7 +507,7 @@ fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
506
507
exe_options .addOption (bool , "enable_tracy_callstack" , false );
507
508
exe_options .addOption (bool , "enable_tracy_allocation" , false );
508
509
exe_options .addOption (bool , "value_tracing" , false );
509
- exe_options .addOption (bool , "omit_pkg_fetching_code " , true );
510
+ exe_options .addOption (bool , "only_core_functionality " , true );
510
511
511
512
const run_opt = b .addSystemCommand (&.{
512
513
"wasm-opt" ,
@@ -685,7 +686,7 @@ fn addCxxKnownPath(
685
686
if (! std .process .can_spawn )
686
687
return error .RequiredLibraryNotFound ;
687
688
const path_padded = b .exec (&.{ ctx .cxx_compiler , b .fmt ("-print-file-name={s}" , .{objname }) });
688
- var tokenizer = mem .tokenize (u8 , path_padded , "\r \n " );
689
+ var tokenizer = mem .tokenizeAny (u8 , path_padded , "\r \n " );
689
690
const path_unpadded = tokenizer .next ().? ;
690
691
if (mem .eql (u8 , path_unpadded , objname )) {
691
692
if (errtxt ) | msg | {
@@ -708,7 +709,7 @@ fn addCxxKnownPath(
708
709
}
709
710
710
711
fn addCMakeLibraryList (exe : * std.Build.Step.Compile , list : []const u8 ) void {
711
- var it = mem .tokenize (u8 , list , ";" );
712
+ var it = mem .tokenizeScalar (u8 , list , ';' );
712
713
while (it .next ()) | lib | {
713
714
if (mem .startsWith (u8 , lib , "-l" )) {
714
715
exe .linkSystemLibrary (lib ["-l" .len .. ]);
@@ -853,18 +854,18 @@ fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {
853
854
// .prefix = ZIG_LLVM_LINK_MODE parsed manually below
854
855
};
855
856
856
- var lines_it = mem .tokenize (u8 , config_h_text , "\r \n " );
857
+ var lines_it = mem .tokenizeAny (u8 , config_h_text , "\r \n " );
857
858
while (lines_it .next ()) | line | {
858
859
inline for (mappings ) | mapping | {
859
860
if (mem .startsWith (u8 , line , mapping .prefix )) {
860
- var it = mem .split (u8 , line , " \" " );
861
+ var it = mem .splitScalar (u8 , line , '"' );
861
862
_ = it .first (); // skip the stuff before the quote
862
863
const quoted = it .next ().? ; // the stuff inside the quote
863
864
@field (ctx , mapping .field ) = toNativePathSep (b , quoted );
864
865
}
865
866
}
866
867
if (mem .startsWith (u8 , line , "#define ZIG_LLVM_LINK_MODE " )) {
867
- var it = mem .split (u8 , line , " \" " );
868
+ var it = mem .splitScalar (u8 , line , '"' );
868
869
_ = it .next ().? ; // skip the stuff before the quote
869
870
const quoted = it .next ().? ; // the stuff inside the quote
870
871
ctx .llvm_linkage = if (mem .eql (u8 , quoted , "shared" )) .dynamic else .static ;
0 commit comments