mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
zlib
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,3 +13,6 @@
|
||||
[submodule "vendor/mach-sdk/sdk-linux-aarch64"]
|
||||
path = vendor/mach-sdk/sdk-linux-aarch64
|
||||
url = https://github.com/hexops/sdk-linux-aarch64.git
|
||||
[submodule "vendor/zlib"]
|
||||
path = vendor/zlib
|
||||
url = https://github.com/madler/zlib.git
|
||||
|
70
pkg/zlib/build.zig
Normal file
70
pkg/zlib/build.zig
Normal file
@ -0,0 +1,70 @@
|
||||
const std = @import("std");
|
||||
|
||||
/// Directories with our includes.
|
||||
const root = thisDir() ++ "../../../vendor/zlib/";
|
||||
const include_path = root;
|
||||
|
||||
pub const pkg = std.build.Pkg{
|
||||
.name = "zlib",
|
||||
.source = .{ .path = thisDir() ++ "/main.zig" },
|
||||
};
|
||||
|
||||
fn thisDir() []const u8 {
|
||||
return std.fs.path.dirname(@src().file) orelse ".";
|
||||
}
|
||||
|
||||
pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep {
|
||||
const lib = try buildLib(b, step);
|
||||
step.linkLibrary(lib);
|
||||
step.addIncludePath(include_path);
|
||||
return lib;
|
||||
}
|
||||
|
||||
pub fn buildLib(
|
||||
b: *std.build.Builder,
|
||||
step: *std.build.LibExeObjStep,
|
||||
) !*std.build.LibExeObjStep {
|
||||
const lib = b.addStaticLibrary("z", null);
|
||||
lib.setTarget(step.target);
|
||||
lib.setBuildMode(step.build_mode);
|
||||
|
||||
// Include
|
||||
lib.addIncludePath(include_path);
|
||||
|
||||
// Link
|
||||
lib.linkLibC();
|
||||
|
||||
// Compile
|
||||
var flags = std.ArrayList([]const u8).init(b.allocator);
|
||||
defer flags.deinit();
|
||||
|
||||
try flags.appendSlice(&.{
|
||||
"-DHAVE_SYS_TYPES_H",
|
||||
"-DHAVE_STDINT_H",
|
||||
"-DHAVE_STDDEF_H",
|
||||
"-DZ_HAVE_UNISTD_H",
|
||||
});
|
||||
|
||||
// C files
|
||||
lib.addCSourceFiles(srcs, flags.items);
|
||||
|
||||
return lib;
|
||||
}
|
||||
|
||||
const srcs = &.{
|
||||
root ++ "adler32.c",
|
||||
root ++ "compress.c",
|
||||
root ++ "crc32.c",
|
||||
root ++ "deflate.c",
|
||||
root ++ "gzclose.c",
|
||||
root ++ "gzlib.c",
|
||||
root ++ "gzread.c",
|
||||
root ++ "gzwrite.c",
|
||||
root ++ "inflate.c",
|
||||
root ++ "infback.c",
|
||||
root ++ "inftrees.c",
|
||||
root ++ "inffast.c",
|
||||
root ++ "trees.c",
|
||||
root ++ "uncompr.c",
|
||||
root ++ "zutil.c",
|
||||
};
|
1
vendor/zlib
vendored
Submodule
1
vendor/zlib
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 21767c654d31d2dccdde4330529775c6c5fd5389
|
Reference in New Issue
Block a user