build-system: Replace deprecated usages of addStaticLibrary with addLibrary (#8029)

Hi there, this is just a low-hanging fruit and it also prepares the way
for the future 0.15, which removes addStaticLibrary.
Please, let me know what to do on the `// TODO` comments.
This commit is contained in:
Jayson Reis
2025-07-22 23:47:18 +02:00
committed by GitHub
parent c903754b70
commit acc2ea724f
19 changed files with 110 additions and 55 deletions

View File

@ -4,10 +4,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "breakpad",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibCpp();
lib.addIncludePath(b.path("vendor"));

View File

@ -12,10 +12,13 @@ pub fn build(b: *std.Build) !void {
});
const imgui = b.dependency("imgui", .{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "cimgui",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
lib.linkLibCpp();

View File

@ -64,10 +64,13 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
const libxml2_iconv_enabled = options.libxml2_iconv_enabled;
const freetype_enabled = options.freetype_enabled;
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "fontconfig",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
if (target.result.os.tag != .windows) {

View File

@ -61,10 +61,13 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
const libpng_enabled = options.libpng_enabled;
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "freetype",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
if (target.result.os.tag.isDarwin()) {

View File

@ -40,10 +40,13 @@ fn buildGlslang(
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
) !*std.Build.Step.Compile {
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "glslang",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
lib.linkLibCpp();

View File

@ -92,10 +92,13 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
.@"enable-libpng" = true,
});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "harfbuzz",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
lib.linkLibCpp();

View File

@ -12,10 +12,13 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "highway",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibCpp();
lib.addIncludePath(upstream.path(""));

View File

@ -30,10 +30,13 @@ pub fn build(b: *std.Build) !void {
});
{
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "intl",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
lib.addIncludePath(b.path(""));

View File

@ -4,10 +4,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "png",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
if (target.result.os.tag == .linux) {

View File

@ -6,10 +6,13 @@ pub fn build(b: *std.Build) !void {
const upstream = b.dependency("libxml2", .{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "xml2",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();

View File

@ -12,10 +12,13 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "macos",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.addCSourceFile(.{

View File

@ -57,10 +57,13 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
const target = options.target;
const optimize = options.optimize;
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "oniguruma",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
const t = target.result;
lib.linkLibC();

View File

@ -12,10 +12,13 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "sentry",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
if (target.result.os.tag.isDarwin()) {

View File

@ -4,10 +4,13 @@ pub fn build(b: *std.Build) !void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "simdutf",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibCpp();
lib.addIncludePath(b.path("vendor"));

View File

@ -35,10 +35,13 @@ fn buildSpirvCross(
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
) !*std.Build.Step.Compile {
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "spirv_cross",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
lib.linkLibCpp();

View File

@ -7,10 +7,13 @@ pub fn build(b: *std.Build) !void {
const module = b.addModule("utf8proc", .{ .root_source_file = .{ .path = "main.zig" } });
const upstream = b.dependency("utf8proc", .{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "utf8proc",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();

View File

@ -4,10 +4,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "utfcpp",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibCpp();

View File

@ -4,10 +4,13 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "z",
.root_module = b.createModule(.{
.target = target,
.optimize = optimize,
}),
.linkage = .static,
});
lib.linkLibC();
if (target.result.os.tag.isDarwin()) {

View File

@ -18,7 +18,7 @@ pub fn initStatic(
b: *std.Build,
deps: *const SharedDeps,
) !GhosttyLib {
const lib = b.addStaticLibrary(.{
const lib = b.addLibrary(.{
.name = "ghostty",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main_c.zig"),
@ -28,6 +28,7 @@ pub fn initStatic(
.omit_frame_pointer = deps.config.strip,
.unwind_tables = if (deps.config.strip) .none else .sync,
}),
.linkage = .static,
});
lib.linkLibC();