mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-29 13:17:14 +09:00
Add a build option to remove the freestanding libc
This commit is contained in:
@@ -70,6 +70,7 @@ jobs:
|
||||
zig build -Dtarget=aarch64-freebsd
|
||||
zig build -Dtarget=wasm32-wasi
|
||||
zig build -Dtarget=wasm32-freestanding
|
||||
zig build -Dtarget=wasm32-freestanding -Dwasm_freestanding_libc=false
|
||||
zig build -Doptimize=ReleaseFast
|
||||
rm -fr zig-cache zig-out
|
||||
|
||||
|
||||
@@ -201,6 +201,11 @@ pub fn build(b: *std.Build) !void {
|
||||
const enable_benchmarks = b.option(bool, "enable_benchmarks", "Whether tests should be benchmarks.") orelse false;
|
||||
const benchmarks_iterations = b.option(u32, "iterations", "Number of iterations for benchmarks.") orelse 200;
|
||||
const wasm_max_memory = b.option(u64, "wasm_max_memory", "Maximum WebAssembly linear memory size in bytes.") orelse null;
|
||||
const wasm_freestanding_libc = b.option(
|
||||
bool,
|
||||
"wasm_freestanding_libc",
|
||||
"Include the built-in libc compatibility layer for wasm32-freestanding.",
|
||||
) orelse true;
|
||||
var build_static = b.option(bool, "static", "Build libsodium as a static library.") orelse true;
|
||||
var build_shared = b.option(bool, "shared", "Build libsodium as a shared library.") orelse true;
|
||||
|
||||
@@ -283,7 +288,7 @@ pub fn build(b: *std.Build) !void {
|
||||
"-Werror=vla",
|
||||
};
|
||||
|
||||
if (wasm_freestanding) {
|
||||
if (wasm_freestanding and wasm_freestanding_libc) {
|
||||
lib.root_module.addCSourceFiles(.{
|
||||
.files = &.{wasm_libc_path ++ "/libc.c"},
|
||||
.flags = flags,
|
||||
|
||||
Reference in New Issue
Block a user