Skip to content

Commit 675b170

Browse files
committed
libxml updated for 0.17.0-dev.389+f5a1968f6
1 parent 2528fad commit 675b170

6 files changed

Lines changed: 81 additions & 1 deletion

File tree

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
zig-version: [0.15.2]
17+
zig-version: [master]
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
runs-on: ${{ matrix.os }}
2020
steps:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.zig-cache
22
zig-cache
33
zig-out
4+
zig-pkg

build.zig

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,31 @@ pub fn build(b: *std.Build) void {
227227
}
228228
}
229229

230+
const translate_c = b.addTranslateC(.{
231+
// libxml2 is modular, and the TranslateC step assumes there is a single
232+
// header for everything, so we'll make our own. There is a minimal
233+
// libxml.h header, but it just seems to be some common stuff, like the
234+
// version of the library.
235+
//
236+
// The fact that you need to include the right header _and_ set an
237+
// *_ENABLED defined is an interesting design decision. libxml2.h
238+
// shouldn't collide with any of the other headers, and we retain the
239+
// modularity with all the options passed in as macros.
240+
.root_source_file = b.path("include/libxml2.h"),
241+
.target = target,
242+
.optimize = optimize,
243+
});
244+
245+
const xml_module = b.addModule("xml", .{
246+
.root_source_file = b.path("src/root.zig"),
247+
.target = target,
248+
.optimize = optimize,
249+
.imports = &.{
250+
.{ .name = "c", .module = translate_c.createModule() },
251+
},
252+
});
253+
xml_module.linkLibrary(xml_lib);
254+
230255
const xmllint = b.addExecutable(.{
231256
.name = "xmllint",
232257
.root_module = b.createModule(.{

build.zig.zon

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
"build.zig.zon",
2929
"LICENSE",
3030
"README.md",
31+
"src",
32+
"include",
3133
},
3234
.fingerprint = 0xf268267b866377a8, // Changing this has security and trust implications.
3335
}

include/libxml2.h

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#ifndef _LIBXML2_H_
2+
#define _LIBXML2_H_
3+
4+
#include "libxml/c14n.h"
5+
#include "libxml/catalog.h"
6+
#include "libxml/chvalid.h"
7+
#include "libxml/debugXML.h"
8+
#include "libxml/dict.h"
9+
#include "libxml/encoding.h"
10+
#include "libxml/entities.h"
11+
#include "libxml/globals.h"
12+
#include "libxml/hash.h"
13+
#include "libxml/HTMLparser.h"
14+
#include "libxml/HTMLtree.h"
15+
#include "libxml/list.h"
16+
#include "libxml/nanoftp.h"
17+
#include "libxml/nanohttp.h"
18+
#include "libxml/parser.h"
19+
#include "libxml/parserInternals.h"
20+
#include "libxml/pattern.h"
21+
#include "libxml/relaxng.h"
22+
#include "libxml/SAX.h"
23+
#include "libxml/SAX2.h"
24+
#include "libxml/schemasInternals.h"
25+
#include "libxml/schematron.h"
26+
#include "libxml/threads.h"
27+
#include "libxml/tree.h"
28+
#include "libxml/uri.h"
29+
#include "libxml/valid.h"
30+
#include "libxml/xinclude.h"
31+
#include "libxml/xlink.h"
32+
#include "libxml/xmlautomata.h"
33+
#include "libxml/xmlerror.h"
34+
#include "libxml/xmlexports.h"
35+
#include "libxml/xmlIO.h"
36+
#include "libxml/xmlmemory.h"
37+
#include "libxml/xmlmodule.h"
38+
#include "libxml/xmlreader.h"
39+
#include "libxml/xmlregexp.h"
40+
#include "libxml/xmlsave.h"
41+
#include "libxml/xmlschemas.h"
42+
#include "libxml/xmlschemastypes.h"
43+
#include "libxml/xmlstring.h"
44+
#include "libxml/xmlunicode.h"
45+
#include "libxml/xmlwriter.h"
46+
#include "libxml/xpath.h"
47+
#include "libxml/xpathInternals.h"
48+
#include "libxml/xpointer.h"
49+
50+
51+
#endif

src/root.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub const c = @import("c");

0 commit comments

Comments
 (0)