pkg/harfbuzz: download source using zig package manager

This commit is contained in:
Mitchell Hashimoto 2023-10-07 14:51:25 -07:00
parent 965fabeb6e
commit 8ec6828713
No known key found for this signature in database
GPG Key ID: 523D5DC389D273BC
2 changed files with 9 additions and 5 deletions

View File

@ -14,6 +14,7 @@ pub fn build(b: *std.Build) !void {
.@"enable-libpng" = true,
});
const macos = b.dependency("macos", .{ .target = target, .optimize = optimize });
const upstream = b.dependency("harfbuzz", .{});
const module = b.addModule("harfbuzz", .{
.source_file = .{ .path = "main.zig" },
@ -23,8 +24,6 @@ pub fn build(b: *std.Build) !void {
},
});
const upstream_root = "../../vendor/harfbuzz";
const lib = b.addStaticLibrary(.{
.name = "harfbuzz",
.target = target,
@ -32,7 +31,7 @@ pub fn build(b: *std.Build) !void {
});
lib.linkLibC();
lib.linkLibCpp();
lib.addIncludePath(.{ .path = upstream_root ++ "/src" });
lib.addIncludePath(upstream.path("src"));
const freetype_dep = b.dependency("freetype", .{ .target = target, .optimize = optimize });
lib.linkLibrary(freetype_dep.artifact("freetype"));
@ -65,11 +64,11 @@ pub fn build(b: *std.Build) !void {
}
lib.addCSourceFile(.{
.file = .{ .path = upstream_root ++ "/src/harfbuzz.cc" },
.file = upstream.path("src/harfbuzz.cc"),
.flags = flags.items,
});
lib.installHeadersDirectoryOptions(.{
.source_dir = .{ .path = upstream_root ++ "/src" },
.source_dir = upstream.path("src"),
.install_dir = .header,
.install_subdir = "",
.include_extensions = &.{".h"},

View File

@ -2,6 +2,11 @@
.name = "harfbuzz",
.version = "2.13.2",
.dependencies = .{
.harfbuzz = .{
.url = "https://github.com/harfbuzz/harfbuzz/archive/refs/tags/8.2.1.tar.gz",
.hash = "12203c1b09a2cf778367376076301322235816598eaf0639da08b233ab852548df92",
},
.freetype = .{ .path = "../freetype" },
.macos = .{ .path = "../macos" },
.apple_sdk = .{ .path = "../apple-sdk" },