1 # Copyright 2013 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # Define an "os_include" variable that points at the OS-specific generated
6 # headers. These were generated by running the configure script offline.
7 if (is_linux || is_chromeos || is_android || is_nacl || is_fuchsia || is_tizen) {
15 import("//third_party/libxml/libxml_visibility.gni")
17 config("libxml_config") {
18 # Define LIBXML_STATIC as nothing to match how libxml.h (an internal header)
19 # defines LIBXML_STATIC, otherwise we get the macro redefined warning from
20 # GCC. ("defines" does "-DFOO" which defines the macro FOO as 1.)
21 cflags = [ "-DLIBXML_STATIC=" ]
25 "$os_include/include",
29 config("libxml_warnings") {
32 "/wd4018", # Signed/unsigned mismatch in comparison.
33 "/wd4267", # TODO(brucedawson): http://crbug.com/554200 fix C4267
34 "/wd4311", # and C4311 warnings.
39 # libxml passes `const unsigned char*` through `const char*`.
42 # pattern.c and uri.c both have an intentional `for (...);` /
43 # `while(...);` loop. I submitted a patch to move the `'` to its own
44 # line, but until that's landed suppress the warning:
47 # debugXML.c compares array 'arg' to NULL.
48 "-Wno-tautological-pointer-compare",
50 # threads.c attempts to forward declare a pthread_equal which doesn't
51 # match the prototype in pthreads.h
52 "-Wno-ignored-attributes",
54 # libxml casts from int to long to void*.
55 "-Wno-int-to-void-pointer-cast",
57 # libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
59 "-Wno-incompatible-pointer-types",
61 # trio_is_special_quantity and trio_is_negative are only
62 # used with certain preprocessor defines set.
63 "-Wno-unused-function",
65 # Comparison between xmlElementType and xmlXPathTypeVal.
66 # TODO(hans): See if we can fix upstream (http://crbug.com/763944).
69 } else if (is_linux || is_chromeos) {
71 # gcc spits out a bunch of warnings about passing too many arguments to
73 "-Wno-format-extra-args",
78 # Please keep in sync with //build/linux/unbundle/libxml.gn.
79 static_library("xml_reader") {
80 # Do not expand this visibility list without first consulting with the
83 "//base/test:test_support",
84 "//components/policy/core/common:unit_tests",
85 "//services/data_decoder:*",
88 visibility += [ "//components/wifi" ]
91 "chromium/xml_reader.cc",
92 "chromium/xml_reader.h",
98 configs += [ ":libxml_config" ]
101 # Please keep in sync with //build/linux/unbundle/libxml.gn.
102 static_library("xml_writer") {
103 # The XmlWriter is considered safe to use from any target.
106 "chromium/xml_writer.cc",
107 "chromium/xml_writer.h",
113 configs += [ ":libxml_config" ]
116 # Please keep in sync with //build/linux/unbundle/libxml.gn.
117 static_library("libxml_utils") {
118 # Do not expand this visibility list without first consulting with the
123 "//base/test:test_support",
124 "//services/data_decoder:lib",
125 "//services/data_decoder:xml_parser_fuzzer_deps",
128 "chromium/libxml_utils.cc",
129 "chromium/libxml_utils.h",
132 public_deps = [ "//third_party/icu:icuuc" ]
133 public_configs = [ ":libxml_config" ]
136 static_library("libxml") {
137 # Do not expand this visibility list without first consulting with the
143 "//chromecast/internal",
144 "//testing/libfuzzer/*",
145 "//third_party/blink/renderer/*",
146 "//third_party/fontconfig",
147 "//third_party/libxslt",
148 "//third_party/maldoca/*",
151 foreach(tgt, ios_libxml_visibility_additions) {
152 visibility += [ "//ios_internal/$tgt" ]
156 output_name = "libxml2"
158 # Commented out sources are libxml2 files we do not want to include. They are
159 # here to make it easy to identify files which are new.
179 "src/include/libxml/HTMLparser.h",
180 "src/include/libxml/HTMLtree.h",
181 "src/include/libxml/SAX.h",
182 "src/include/libxml/SAX2.h",
183 "src/include/libxml/c14n.h",
184 "src/include/libxml/catalog.h",
185 "src/include/libxml/chvalid.h",
186 "src/include/libxml/debugXML.h",
187 "src/include/libxml/dict.h",
188 "src/include/libxml/encoding.h",
189 "src/include/libxml/entities.h",
190 "src/include/libxml/globals.h",
191 "src/include/libxml/hash.h",
192 "src/include/libxml/list.h",
193 "src/include/libxml/nanoftp.h",
194 "src/include/libxml/nanohttp.h",
195 "src/include/libxml/parser.h",
196 "src/include/libxml/parserInternals.h",
197 "src/include/libxml/pattern.h",
198 "src/include/libxml/relaxng.h",
199 "src/include/libxml/schemasInternals.h",
200 "src/include/libxml/schematron.h",
201 "src/include/libxml/threads.h",
202 "src/include/libxml/tree.h",
203 "src/include/libxml/uri.h",
204 "src/include/libxml/valid.h",
205 "src/include/libxml/xinclude.h",
206 "src/include/libxml/xlink.h",
207 "src/include/libxml/xmlIO.h",
208 "src/include/libxml/xmlautomata.h",
209 "src/include/libxml/xmlerror.h",
210 "src/include/libxml/xmlexports.h",
211 "src/include/libxml/xmlmemory.h",
212 "src/include/libxml/xmlmodule.h",
213 "src/include/libxml/xmlreader.h",
214 "src/include/libxml/xmlregexp.h",
215 "src/include/libxml/xmlsave.h",
216 "src/include/libxml/xmlschemas.h",
217 "src/include/libxml/xmlschemastypes.h",
218 "src/include/libxml/xmlstring.h",
219 "src/include/libxml/xmlunicode.h",
220 "src/include/libxml/xmlwriter.h",
221 "src/include/libxml/xpath.h",
222 "src/include/libxml/xpathInternals.h",
223 "src/include/libxml/xpointer.h",
229 "src/parserInternals.c",
244 # Note: xpath.c #includes trionan.c
264 #"src/xmlschemastypes.c",
274 configs -= [ "//build/config/compiler:chromium_code" ]
276 "//build/config/compiler:no_chromium_code",
278 # Must be after no_chromium_code for warning flags to be ordered correctly.
282 if (is_linux || is_chromeos) {
285 "linux/include/libxml/xmlversion.h",
292 "mac/include/libxml/xmlversion.h",
298 "src/include/win32config.h",
299 "src/include/wsockcompat.h",
301 "win32/include/libxml/xmlversion.h",
304 # libxml2 already defines WIN32_LEAN_AND_MEAN.
305 configs -= [ "//build/config/win:lean_and_mean" ]
308 sources += [ "chromium/disabled_libxml_features.cc" ]
310 public_configs = [ ":libxml_config" ]
311 public_deps = [ "//third_party/icu:icuuc" ]
312 deps = [ "//third_party/zlib" ]
314 if (is_apple || is_android || is_fuchsia) {
315 # http://www.xmlsoft.org/threads.html says that this is required when using
316 # libxml from several threads, which can possibly happen in chrome. On
317 # linux, this is picked up by transitivity from pkg-config output from
318 # build/linux/system.gyp.
319 defines = [ "_REENTRANT" ]
322 include_dirs = [ "$os_include" ]