Skip to content

Commit 916a757

Browse files
committed
update to zig 0.14.0
1 parent febfc21 commit 916a757

File tree

2 files changed

+48
-38
lines changed

2 files changed

+48
-38
lines changed

build.zig

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ pub fn build(b: *std.Build) void {
77
const target = b.standardTargetOptions(.{});
88
const optimize = b.standardOptimizeOption(.{});
99

10+
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode") orelse .static;
11+
const strip = b.option(bool, "strip", "Omit debug information");
12+
const pic = b.option(bool, "pie", "Produce Position Independent Code");
13+
1014
// Most of these config options have not been tested.
1115

1216
const minimum = b.option(bool, "minimum", "build a minimally sized library (default=false)") orelse false;
@@ -203,55 +207,60 @@ pub fn build(b: *std.Build) void {
203207
config_header.addValues(.{ .XML_THREAD_LOCAL = ._Thread_local });
204208
}
205209

206-
const xml_lib = b.addStaticLibrary(.{
210+
const xml_lib = b.addLibrary(.{
211+
.linkage = linkage,
207212
.name = "xml",
208-
.target = target,
209-
.optimize = optimize,
210213
.version = version,
211-
.link_libc = true,
214+
.root_module = b.createModule(.{
215+
.target = target,
216+
.optimize = optimize,
217+
.link_libc = true,
218+
.strip = strip,
219+
.pic = pic,
220+
}),
212221
});
213222
b.installArtifact((xml_lib));
214-
xml_lib.addConfigHeader(config_header);
215-
xml_lib.addConfigHeader(xml_version_header);
223+
xml_lib.root_module.addConfigHeader(config_header);
224+
xml_lib.root_module.addConfigHeader(xml_version_header);
216225
xml_lib.installHeader(xml_version_header.getOutput(), "libxml/xmlversion.h");
217-
xml_lib.addIncludePath(upstream.path("include"));
218-
xml_lib.addCSourceFiles(.{ .files = xml_src, .root = upstream.path(""), .flags = xml_flags });
226+
xml_lib.root_module.addIncludePath(upstream.path("include"));
227+
xml_lib.root_module.addCSourceFiles(.{ .files = xml_src, .root = upstream.path(""), .flags = xml_flags });
219228
xml_lib.installHeadersDirectory(upstream.path("include/libxml"), "libxml", .{});
220229
if (target.result.os.tag != .windows) xml_lib.root_module.addCMacro("HAVE_PTHREAD_H", "1");
221230
if (target.result.os.tag == .windows) xml_lib.root_module.addCMacro("LIBXML_STATIC", "1");
222-
if (c14n) xml_lib.addCSourceFile(.{ .file = upstream.path("c14n.c"), .flags = xml_flags });
223-
if (catalog) xml_lib.addCSourceFile(.{ .file = upstream.path("catalog.c"), .flags = xml_flags });
224-
if (debug) xml_lib.addCSourceFile(.{ .file = upstream.path("debugXML.c"), .flags = xml_flags });
225-
if (ftp) xml_lib.addCSourceFile(.{ .file = upstream.path("nanoftp.c"), .flags = xml_flags });
226-
if (html) xml_lib.addCSourceFiles(.{ .files = &.{ "HTMLparser.c", "HTMLtree.c" }, .root = upstream.path(""), .flags = xml_flags });
227-
if (http) xml_lib.addCSourceFile(.{ .file = upstream.path("nanohttp.c"), .flags = xml_flags });
228-
if (legacy) xml_lib.addCSourceFile(.{ .file = upstream.path("legacy.c"), .flags = xml_flags });
229-
if (lzma) xml_lib.addCSourceFile(.{ .file = upstream.path("xzlib.c"), .flags = xml_flags });
230-
// if (modules) xml_lib.addCSourceFile(.{ .file = upstream.path("xmlmodule.c"), .flags = xml_flags });
231-
if (output) xml_lib.addCSourceFile(.{ .file = upstream.path("xmlsave.c"), .flags = xml_flags });
232-
if (pattern) xml_lib.addCSourceFile(.{ .file = upstream.path("pattern.c"), .flags = xml_flags });
233-
if (reader) xml_lib.addCSourceFile(.{ .file = upstream.path("xmlreader.c"), .flags = xml_flags });
234-
if (regexps) xml_lib.addCSourceFiles(.{ .files = &.{ "xmlregexp.c", "xmlunicode.c" }, .root = upstream.path(""), .flags = xml_flags });
235-
if (schemas) xml_lib.addCSourceFiles(.{ .files = &.{ "relaxng.c", "xmlschemas.c", "xmlschemastypes.c" }, .root = upstream.path(""), .flags = xml_flags });
236-
if (schematron) xml_lib.addCSourceFile(.{ .file = upstream.path("schematron.c"), .flags = xml_flags });
237-
if (writer) xml_lib.addCSourceFile(.{ .file = upstream.path("xmlwriter.c"), .flags = xml_flags });
238-
if (xinclude) xml_lib.addCSourceFile(.{ .file = upstream.path("xinclude.c"), .flags = xml_flags });
239-
if (xpath) xml_lib.addCSourceFile(.{ .file = upstream.path("xpath.c"), .flags = xml_flags });
240-
if (xptr) xml_lib.addCSourceFiles(.{ .files = &.{ "xlink.c", "xpointer.c" }, .root = upstream.path(""), .flags = xml_flags });
231+
if (c14n) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("c14n.c"), .flags = xml_flags });
232+
if (catalog) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("catalog.c"), .flags = xml_flags });
233+
if (debug) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("debugXML.c"), .flags = xml_flags });
234+
if (ftp) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("nanoftp.c"), .flags = xml_flags });
235+
if (html) xml_lib.root_module.addCSourceFiles(.{ .files = &.{ "HTMLparser.c", "HTMLtree.c" }, .root = upstream.path(""), .flags = xml_flags });
236+
if (http) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("nanohttp.c"), .flags = xml_flags });
237+
if (legacy) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("legacy.c"), .flags = xml_flags });
238+
if (lzma) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xzlib.c"), .flags = xml_flags });
239+
// if (modules) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xmlmodule.c"), .flags = xml_flags });
240+
if (output) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xmlsave.c"), .flags = xml_flags });
241+
if (pattern) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("pattern.c"), .flags = xml_flags });
242+
if (reader) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xmlreader.c"), .flags = xml_flags });
243+
if (regexps) xml_lib.root_module.addCSourceFiles(.{ .files = &.{ "xmlregexp.c", "xmlunicode.c" }, .root = upstream.path(""), .flags = xml_flags });
244+
if (schemas) xml_lib.root_module.addCSourceFiles(.{ .files = &.{ "relaxng.c", "xmlschemas.c", "xmlschemastypes.c" }, .root = upstream.path(""), .flags = xml_flags });
245+
if (schematron) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("schematron.c"), .flags = xml_flags });
246+
if (writer) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xmlwriter.c"), .flags = xml_flags });
247+
if (xinclude) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xinclude.c"), .flags = xml_flags });
248+
if (xpath) xml_lib.root_module.addCSourceFile(.{ .file = upstream.path("xpath.c"), .flags = xml_flags });
249+
if (xptr) xml_lib.root_module.addCSourceFiles(.{ .files = &.{ "xlink.c", "xpointer.c" }, .root = upstream.path(""), .flags = xml_flags });
241250
if (readline) {
242-
xml_lib.linkSystemLibrary("readline");
251+
xml_lib.root_module.linkSystemLibrary("readline", .{});
243252
xml_lib.root_module.addCMacro("HAVE_LIBREADLINE", "1");
244253
}
245254
if (history) {
246-
xml_lib.linkSystemLibrary("history");
255+
xml_lib.root_module.linkSystemLibrary("history", .{});
247256
xml_lib.root_module.addCMacro("HAVE_LIBHISTORY", "1");
248257
}
249-
if (zlib) xml_lib.linkSystemLibrary("zlib");
250-
if (lzma) xml_lib.linkSystemLibrary("lzma");
251-
if (icu) xml_lib.linkSystemLibrary("icu-i18n");
252-
if (iconv) xml_lib.linkSystemLibrary("iconv");
253-
if (target.result.os.tag == .windows) xml_lib.linkSystemLibrary("bcrypt");
254-
if (http and target.result.os.tag == .windows) xml_lib.linkSystemLibrary("ws2_32");
258+
if (zlib) xml_lib.root_module.linkSystemLibrary("zlib", .{});
259+
if (lzma) xml_lib.root_module.linkSystemLibrary("lzma", .{});
260+
if (icu) xml_lib.root_module.linkSystemLibrary("icu-i18n", .{});
261+
if (iconv) xml_lib.root_module.linkSystemLibrary("iconv", .{});
262+
if (target.result.os.tag == .windows) xml_lib.root_module.linkSystemLibrary("bcrypt", .{});
263+
if (http and target.result.os.tag == .windows) xml_lib.root_module.linkSystemLibrary("ws2_32", .{});
255264
}
256265

257266
pub const xml_src: []const []const u8 = &.{

build.zig.zon

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.{
2-
.name = "libxml2",
2+
.name = .libxml2,
33
.version = "2.13.5",
4-
.minimum_zig_version = "0.12.0",
4+
.minimum_zig_version = "0.14.0",
55
.dependencies = .{
66
.libxml2 = .{
77
.url = "git+https://gitlab.gnome.org/GNOME/libxml2.git?ref=v2.13.5#de918d45e1b2276a28a4cd32bcf556bef65284e4",
8-
.hash = "122044c83fabebb35476b6f32a8fc5cc896e2c9420d7e9930a9b982ad3eb55bb7fdf",
8+
.hash = "N-V-__8AALhJnQFEyD-r67NUdrbzKo_FzIluLJQg1-mTCpuY",
99
},
1010
},
1111
.paths = .{
@@ -14,4 +14,5 @@
1414
"LICENSE",
1515
"README.md",
1616
},
17+
.fingerprint = 0xf268267b866377a8, // Changing this has security and trust implications.
1718
}

0 commit comments

Comments
 (0)