Add ICU message format support
[chromium-blink-merge.git] / third_party / libxml / BUILD.gn
blob58a5f1c1040d3ae8ad8909da52d7d56c84c4c191
1 # Copyright (c) 2013 The Chromium Authors. All rights reserved.
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_android || is_nacl) {
8   os_include = "linux"
9 } else if (is_mac || is_ios) {
10   os_include = "mac"
11 } else if (is_win) {
12   os_include = "win32"
15 config("libxml_config") {
16   # Define LIBXML_STATIC as nothing to match how libxml.h (an internal header)
17   # defines LIBXML_STATIC, otherwise we get the macro redefined warning from
18   # GCC. ("defines" does "-DFOO" which defines the macro FOO as 1.)
19   cflags = [ "-DLIBXML_STATIC=" ]
21   include_dirs = [
22     "src/include",
23     "$os_include/include",
24   ]
27 static_library("libxml") {
28   output_name = "libxml2"
29   sources = [
30     "chromium/libxml_utils.cc",
31     "chromium/libxml_utils.h",
32     "linux/config.h",
33     "linux/include/libxml/xmlversion.h",
34     "mac/config.h",
35     "mac/include/libxml/xmlversion.h",
36     "src/DOCBparser.c",
37     "src/HTMLparser.c",
38     "src/HTMLtree.c",
39     "src/SAX.c",
40     "src/SAX2.c",
41     "src/buf.c",
42     "src/buf.h",
43     "src/c14n.c",
44     "src/catalog.c",
45     "src/chvalid.c",
46     "src/debugXML.c",
47     "src/dict.c",
48     "src/elfgcchack.h",
49     "src/enc.h",
50     "src/encoding.c",
51     "src/entities.c",
52     "src/error.c",
53     "src/globals.c",
54     "src/hash.c",
55     "src/include/libxml/DOCBparser.h",
56     "src/include/libxml/HTMLparser.h",
57     "src/include/libxml/HTMLtree.h",
58     "src/include/libxml/SAX.h",
59     "src/include/libxml/SAX2.h",
60     "src/include/libxml/c14n.h",
61     "src/include/libxml/catalog.h",
62     "src/include/libxml/chvalid.h",
63     "src/include/libxml/debugXML.h",
64     "src/include/libxml/dict.h",
65     "src/include/libxml/encoding.h",
66     "src/include/libxml/entities.h",
67     "src/include/libxml/globals.h",
68     "src/include/libxml/hash.h",
69     "src/include/libxml/list.h",
70     "src/include/libxml/parser.h",
71     "src/include/libxml/parserInternals.h",
72     "src/include/libxml/pattern.h",
73     "src/include/libxml/relaxng.h",
74     "src/include/libxml/schemasInternals.h",
75     "src/include/libxml/schematron.h",
76     "src/include/libxml/threads.h",
77     "src/include/libxml/tree.h",
78     "src/include/libxml/uri.h",
79     "src/include/libxml/valid.h",
80     "src/include/libxml/xinclude.h",
81     "src/include/libxml/xlink.h",
82     "src/include/libxml/xmlIO.h",
83     "src/include/libxml/xmlautomata.h",
84     "src/include/libxml/xmlerror.h",
85     "src/include/libxml/xmlexports.h",
86     "src/include/libxml/xmlmemory.h",
87     "src/include/libxml/xmlmodule.h",
88     "src/include/libxml/xmlreader.h",
89     "src/include/libxml/xmlregexp.h",
90     "src/include/libxml/xmlsave.h",
91     "src/include/libxml/xmlschemas.h",
92     "src/include/libxml/xmlschemastypes.h",
93     "src/include/libxml/xmlstring.h",
94     "src/include/libxml/xmlunicode.h",
95     "src/include/libxml/xmlwriter.h",
96     "src/include/libxml/xpath.h",
97     "src/include/libxml/xpathInternals.h",
98     "src/include/libxml/xpointer.h",
99     "src/include/win32config.h",
100     "src/include/wsockcompat.h",
101     "src/legacy.c",
102     "src/libxml.h",
103     "src/list.c",
104     "src/parser.c",
105     "src/parserInternals.c",
106     "src/pattern.c",
107     "src/relaxng.c",
108     "src/save.h",
109     "src/schematron.c",
110     "src/threads.c",
111     "src/timsort.h",
112     "src/tree.c",
114     #"src/trio.c",
115     #"src/trio.h",
116     #"src/triodef.h",
117     #"src/trionan.c",
118     #"src/trionan.h",
119     #"src/triop.h",
120     #"src/triostr.c",
121     #"src/triostr.h",
122     "src/uri.c",
123     "src/valid.c",
124     "src/xinclude.c",
125     "src/xlink.c",
126     "src/xmlIO.c",
127     "src/xmlmemory.c",
128     "src/xmlmodule.c",
129     "src/xmlreader.c",
130     "src/xmlregexp.c",
131     "src/xmlsave.c",
132     "src/xmlschemas.c",
133     "src/xmlschemastypes.c",
134     "src/xmlstring.c",
135     "src/xmlunicode.c",
136     "src/xmlwriter.c",
137     "src/xpath.c",
138     "src/xpointer.c",
140     #"src/xzlib.c",
141     "src/xzlib.h",
142     "win32/config.h",
143     "win32/include/libxml/xmlversion.h",
144   ]
146   configs -= [ "//build/config/compiler:chromium_code" ]
147   configs += [ "//build/config/compiler:no_chromium_code" ]
149   public_configs = [ ":libxml_config" ]
150   public_deps = [
151     "//third_party/icu:icuuc",
152   ]
153   deps = [
154     "//third_party/zlib",
155   ]
157   if (is_win) {
158     cflags_c = [
159       "/wd4018",  # Signed/unsigned mismatch in comparison.
160       "/wd4101",  # Unreferenced local variable.
161     ]
162   } else if (is_mac || is_ios || is_android) {
163     # http://www.xmlsoft.org/threads.html says that this is required when using
164     # libxml from several threads, which can possibly happen in chrome. On
165     # linux, this is picked up by transitivity from pkg-config output from
166     # build/linux/system.gyp.
167     defines = [ "_REENTRANT" ]
168   }
170   if (is_clang) {
171     cflags = [
172       # libxml passes `const unsigned char*` through `const char*`.
173       "-Wno-pointer-sign",
175       # pattern.c and uri.c both have an intentional `for (...);` /
176       # `while(...);` loop. I submitted a patch to move the `'` to its own
177       # line, but until that's landed suppress the warning:
178       "-Wno-empty-body",
180       # debugXML.c compares array 'arg' to NULL.
181       "-Wno-tautological-pointer-compare",
183       # threads.c attempts to forward declare a pthread_equal which doesn't
184       # match the prototype in pthreads.h
185       "-Wno-ignored-attributes",
186     ]
187   }
188   config("libxml_warnings") {
189     if (is_clang) {
190       cflags += [
191         # libxml casts from int to long to void*.
192         "-Wno-int-to-void-pointer-cast",
194         # libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
195         # a void* volatile*.
196         "-Wno-incompatible-pointer-types",
197       ]
198     }
199   }
200   configs += [ ":libxml_warnings" ]
202   include_dirs = [ "$os_include" ]