Skip to content
Closed
Show file tree
Hide file tree
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
21 changes: 12 additions & 9 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn getNasmFormat(target: std.Target) []const u8 {
}
}

fn addSourceFilesFromModule(b: *std.Build, upsteam: std.Build.LazyPath, step: *std.Build.Step.Compile, module: *const BoringSSLModule, nasm: *std.Build.Step.Compile) !void {
fn addSourceFilesFromModule(b: *std.Build, upsteam: std.Build.LazyPath, step: *std.Build.Step.Compile, module: *const BoringSSLModule, nasm: *std.Build.Step.Compile, pic: ?bool) !void {
var srcs_c = try std.ArrayList([]const u8).initCapacity(b.allocator, module.srcs.len);
var srcs_cpp = try std.ArrayList([]const u8).initCapacity(b.allocator, module.srcs.len);

Expand All @@ -70,17 +70,22 @@ fn addSourceFilesFromModule(b: *std.Build, upsteam: std.Build.LazyPath, step: *s
}
}

const cflags_cpp_pic = [_][]const u8{ "-DWIN32_LEAN_AND_MEAN", "-std=c++17", "-DNOMINMAX", "-fPIC" };
const cflags_cpp_no_pic = [_][]const u8{ "-DWIN32_LEAN_AND_MEAN", "-std=c++17", "-DNOMINMAX" };
const cflags_c_pic = [_][]const u8{ "-DWIN32_LEAN_AND_MEAN", "-DNOMINMAX", "-fPIC" };
const cflags_c_no_pic = [_][]const u8{ "-DWIN32_LEAN_AND_MEAN", "-DNOMINMAX" };

for (srcs_cpp.items) |item| {
step.root_module.addCSourceFile(.{
.file = upsteam.path(b, b.pathJoin(&.{item})),
.flags = &.{ "-DWIN32_LEAN_AND_MEAN", "-std=c++17", "-DNOMINMAX" },
.flags = if (pic orelse false) &cflags_cpp_pic else &cflags_cpp_no_pic,
});
}

for (srcs_c.items) |item| {
step.root_module.addCSourceFile(.{
.file = upsteam.path(b, b.pathJoin(&.{item})),
.flags = &.{ "-DWIN32_LEAN_AND_MEAN", "-DNOMINMAX" },
.flags = if (pic orelse false) &cflags_c_pic else &cflags_c_no_pic,
});
}

Expand Down Expand Up @@ -125,6 +130,7 @@ fn addSourceFilesFromModule(b: *std.Build, upsteam: std.Build.LazyPath, step: *s
pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const pic = b.option(bool, "pie", "Produce Position Independent Code");

const build_root = b.build_root.handle;

Expand Down Expand Up @@ -196,11 +202,6 @@ pub fn build(b: *std.Build) !void {
},
.system_dependencies = if (target.result.os.tag == .windows) &.{ "ws2_32", "dbghelp" } else &.{},
},
ModuleInfo{
.name = "decrepit",
.module = &build_source.decrepit,
.kind = .lib,
},
ModuleInfo{
.name = "crypto",
.module = &build_source.crypto,
Expand Down Expand Up @@ -282,6 +283,7 @@ pub fn build(b: *std.Build) !void {
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.pic = pic,
}),
});
break :blk mod;
Expand All @@ -292,6 +294,7 @@ pub fn build(b: *std.Build) !void {
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
.pic = pic,
}),
.linkage = .static,
});
Expand Down Expand Up @@ -319,7 +322,7 @@ pub fn build(b: *std.Build) !void {
mod.root_module.link_libcpp = true;

// Add the sources from the json module to the zig mod
try addSourceFilesFromModule(b, upstream_root, mod, module.module, nasm);
try addSourceFilesFromModule(b, upstream_root, mod, module.module, nasm, pic);

// Link to other boringssl modules
if (module.module_dependencies) |dependencies| {
Expand Down
6 changes: 3 additions & 3 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
.{
.name = .boringssl,
.version = "0.20260508.0",
.version = "0.20260526.0",
.fingerprint = 0x5f0947d235641b12,
.dependencies = .{
.boringssl = .{
.url = "https://github.com/google/boringssl/archive/d589045a772678d5ca131f4c8087d001b9258380.tar.gz",
.hash = "N-V-__8AAO-t0g0Vv4tDWScq8vnEbEMShTyCcdPEgt9syb7p",
.url = "https://github.com/google/boringssl/archive/190fa71435c8675b80d7883e5d01858db4c91180.tar.gz",
.hash = "N-V-__8AAJhc0w0H8yQ1jOqE3CHmQtOLsdy2qmZ5l4AsJya7",
},
.nasm = .{
.url = "git+https://github.com/allyourcodebase/nasm.git#d7356eadb2d7771542fe74e8fc0668bd78732b59",
Expand Down
Loading
Loading