Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ziglibcbuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,16 @@ pub fn addLibc(builder: *std.build.Builder, opt: ZigLibcOptions) *std.build.LibE
.only_gnu => "c-only-gnu",
//.full => "c",
.full => "cguana", // use cguana to avoid passing in '-lc' to zig which will
// cause it to add the system libc headers
// cause it to add the system libc headers
};
const trace_options = builder.addOptions();
trace_options.addOption(bool, "enabled", opt.trace);

const modules_options = builder.addOptions();
modules_options.addOption(bool, "glibcstart", switch (opt.start) { .glibc => true, else => false });
modules_options.addOption(bool, "glibcstart", switch (opt.start) {
.glibc => true,
else => false,
});
const index = relpath("src" ++ std.fs.path.sep_str ++ "lib.zig");
const lib = switch (opt.link) {
.static => builder.addStaticLibrary(.{
Expand All @@ -83,12 +86,14 @@ pub fn addLibc(builder: *std.build.Builder, opt: ZigLibcOptions) *std.build.LibE
},
}),
};

lib.bundle_compiler_rt = true;
// TODO: not sure if this is reallly needed or not, but it shouldn't hurt
// anything except performance to enable it
lib.force_pic = true;
lib.addOptions("modules", modules_options);
lib.addOptions("trace_options", trace_options);
const c_flags = [_][]const u8 {
const c_flags = [_][]const u8{
"-std=c11",
};
const include_cstd = switch (opt.variant) {
Expand Down