pkg/libxml2: download using zig package manager

This commit is contained in:
Mitchell Hashimoto
2023-10-07 14:48:41 -07:00
parent d8da67fbcf
commit 6e550bbd6b
2 changed files with 10 additions and 5 deletions

View File

@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
const upstream_root = "../../vendor/libxml2"; const upstream = b.dependency("libxml2", .{});
const lib = b.addStaticLibrary(.{ const lib = b.addStaticLibrary(.{
.name = "xml2", .name = "xml2",
@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
}); });
lib.linkLibC(); lib.linkLibC();
lib.addIncludePath(.{ .path = upstream_root ++ "/include" }); lib.addIncludePath(upstream.path("include"));
lib.addIncludePath(.{ .path = "override/include" }); lib.addIncludePath(.{ .path = "override/include" });
if (target.isWindows()) { if (target.isWindows()) {
lib.addIncludePath(.{ .path = "override/config/win32" }); lib.addIncludePath(.{ .path = "override/config/win32" });
@ -96,14 +96,14 @@ pub fn build(b: *std.Build) !void {
inline for (srcs) |src| { inline for (srcs) |src| {
lib.addCSourceFile(.{ lib.addCSourceFile(.{
.file = .{ .path = upstream_root ++ "/" ++ src }, .file = upstream.path(src),
.flags = flags.items, .flags = flags.items,
}); });
} }
lib.installHeader("override/include/libxml/xmlversion.h", "libxml/xmlversion.h"); lib.installHeader("override/include/libxml/xmlversion.h", "libxml/xmlversion.h");
lib.installHeadersDirectoryOptions(.{ lib.installHeadersDirectoryOptions(.{
.source_dir = .{ .path = upstream_root ++ "/include" }, .source_dir = upstream.path("include"),
.install_dir = .header, .install_dir = .header,
.install_subdir = "", .install_subdir = "",
.include_extensions = &.{".h"}, .include_extensions = &.{".h"},

View File

@ -1,5 +1,10 @@
.{ .{
.name = "libxml2", .name = "libxml2",
.version = "2.11.5", .version = "2.11.5",
.dependencies = .{}, .dependencies = .{
.libxml2 = .{
.url = "https://github.com/GNOME/libxml2/archive/refs/tags/v2.11.5.tar.gz",
.hash = "122032442d95c3b428ae8e526017fad881e7dc78eab4d558e9a58a80bfbd65a64f7d",
},
},
} }