Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / libxml / libxml.gyp
blob493ed044db387596ec9f3d6fca7717f7af8f0e91
1 # Copyright (c) 2012 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.
6   'variables': {
7     'conditions': [
8       # Define an "os_include" variable that points at the OS-specific generated
9       # headers.  These were generated by running the configure script offline.
10       ['os_posix == 1 and OS != "mac" and OS != "ios"', {
11         'os_include': 'linux'
12       }],
13       ['OS=="mac"', {'os_include': 'mac'}],
14       ['OS=="win"', {'os_include': 'win32'}],
15     ],
16     'use_system_libxml%': 0,
17   },
18   'targets': [
19     {
20       'target_name': 'libxml',
21       'conditions': [
22         ['use_system_libxml', {
23           'conditions': [
24             ['os_posix == 1 and OS != "mac" and OS != "ios"', {
25               'type': 'static_library',
26               'sources': [
27                 'chromium/libxml_utils.h',
28                 'chromium/libxml_utils.cc',
29               ],
30               'cflags': [
31                 '<!@(pkg-config --cflags libxml-2.0)',
32               ],
33               'defines': [
34                 'USE_SYSTEM_LIBXML',
35               ],
36               'direct_dependent_settings': {
37                 'cflags': [
38                   '<!@(pkg-config --cflags libxml-2.0)',
39                 ],
40                 'defines': [
41                   'USE_SYSTEM_LIBXML',
42                 ],
43               },
44               'link_settings': {
45                 'ldflags': [
46                   '<!@(pkg-config --libs-only-L --libs-only-other libxml-2.0)',
47                 ],
48                 'libraries': [
49                   '<!@(pkg-config --libs-only-l libxml-2.0)',
50                 ],
51               },
52             }],
53             ['OS == "ios"', {
54               'type': 'static_library',
55               'sources': [
56                 'chromium/libxml_utils.h',
57                 'chromium/libxml_utils.cc',
58               ],
59               'include_dirs': [
60                 '$(SDKROOT)/usr/include/libxml2',
61               ],
62               'all_dependent_settings': {
63                 'defines': [
64                   'USE_SYSTEM_LIBXML',
65                 ],
66                 'include_dirs': [
67                   '$(SDKROOT)/usr/include/libxml2',
68                 ],
69               },
70               'link_settings': {
71                 'xcode_settings': {
72                   'OTHER_LDFLAGS': [
73                     '-lxml2',
74                   ],
75                 },
76               },
77             }],
78           ],
79         }, {  # else: !use_system_libxml
80           'type': 'static_library',
81           'sources': [
82             'chromium/libxml_utils.h',
83             'chromium/libxml_utils.cc',
84             'linux/config.h',
85             'linux/include/libxml/xmlversion.h',
86             'mac/config.h',
87             'mac/include/libxml/xmlversion.h',
88             'src/include/libxml/c14n.h',
89             'src/include/libxml/catalog.h',
90             'src/include/libxml/chvalid.h',
91             'src/include/libxml/debugXML.h',
92             'src/include/libxml/dict.h',
93             'src/include/libxml/DOCBparser.h',
94             'src/include/libxml/encoding.h',
95             'src/include/libxml/entities.h',
96             'src/include/libxml/globals.h',
97             'src/include/libxml/hash.h',
98             'src/include/libxml/HTMLparser.h',
99             'src/include/libxml/HTMLtree.h',
100             'src/include/libxml/list.h',
101             'src/include/libxml/parser.h',
102             'src/include/libxml/parserInternals.h',
103             'src/include/libxml/pattern.h',
104             'src/include/libxml/relaxng.h',
105             'src/include/libxml/SAX.h',
106             'src/include/libxml/SAX2.h',
107             'src/include/libxml/schemasInternals.h',
108             'src/include/libxml/schematron.h',
109             'src/include/libxml/threads.h',
110             'src/include/libxml/tree.h',
111             'src/include/libxml/uri.h',
112             'src/include/libxml/valid.h',
113             'src/include/libxml/xinclude.h',
114             'src/include/libxml/xlink.h',
115             'src/include/libxml/xmlautomata.h',
116             'src/include/libxml/xmlerror.h',
117             'src/include/libxml/xmlexports.h',
118             'src/include/libxml/xmlIO.h',
119             'src/include/libxml/xmlmemory.h',
120             'src/include/libxml/xmlmodule.h',
121             'src/include/libxml/xmlreader.h',
122             'src/include/libxml/xmlregexp.h',
123             'src/include/libxml/xmlsave.h',
124             'src/include/libxml/xmlschemas.h',
125             'src/include/libxml/xmlschemastypes.h',
126             'src/include/libxml/xmlstring.h',
127             'src/include/libxml/xmlunicode.h',
128             'src/include/libxml/xmlwriter.h',
129             'src/include/libxml/xpath.h',
130             'src/include/libxml/xpathInternals.h',
131             'src/include/libxml/xpointer.h',
132             'src/include/win32config.h',
133             'src/include/wsockcompat.h',
134             'src/buf.c',
135             'src/buf.h',
136             'src/c14n.c',
137             'src/catalog.c',
138             'src/chvalid.c',
139             'src/debugXML.c',
140             'src/dict.c',
141             'src/DOCBparser.c',
142             'src/elfgcchack.h',
143             'src/enc.h',
144             'src/encoding.c',
145             'src/entities.c',
146             'src/error.c',
147             'src/globals.c',
148             'src/hash.c',
149             'src/HTMLparser.c',
150             'src/HTMLtree.c',
151             'src/legacy.c',
152             'src/libxml.h',
153             'src/list.c',
154             'src/parser.c',
155             'src/parserInternals.c',
156             'src/pattern.c',
157             'src/relaxng.c',
158             'src/save.h',
159             'src/SAX.c',
160             'src/SAX2.c',
161             'src/schematron.c',
162             'src/threads.c',
163             'src/timsort.h',
164             'src/tree.c',
165             #'src/trio.c',
166             #'src/trio.h',
167             #'src/triodef.h',
168             #'src/trionan.c',
169             #'src/trionan.h',
170             #'src/triop.h',
171             #'src/triostr.c',
172             #'src/triostr.h',
173             'src/uri.c',
174             'src/valid.c',
175             'src/xinclude.c',
176             'src/xlink.c',
177             'src/xmlIO.c',
178             'src/xmlmemory.c',
179             'src/xmlmodule.c',
180             'src/xmlreader.c',
181             'src/xmlregexp.c',
182             'src/xmlsave.c',
183             'src/xmlschemas.c',
184             'src/xmlschemastypes.c',
185             'src/xmlstring.c',
186             'src/xmlunicode.c',
187             'src/xmlwriter.c',
188             'src/xpath.c',
189             'src/xpointer.c',
190             #'src/xzlib.c',
191             'src/xzlib.h',
192             'win32/config.h',
193             'win32/include/libxml/xmlversion.h',
194           ],
195           'defines': [
196             # Define LIBXML_STATIC as nothing to match how libxml.h
197             # (an internal header) defines LIBXML_STATIC, otherwise
198             # we get the macro redefined warning from GCC.  (-DFOO
199             # defines the macro FOO as 1.)
200             'LIBXML_STATIC=',
201           ],
202           'variables': {
203             'clang_warning_flags': [
204               # libxml passes `const unsigned char*` through `const char*`.
205               '-Wno-pointer-sign',
206               # pattern.c and uri.c both have an intentional
207               # `for (...);` / `while(...);` loop. I submitted a patch to
208               # move the `'` to its own line, but until that's landed
209               # suppress the warning:
210               '-Wno-empty-body',
211               # debugXML.c compares array 'arg' to NULL.
212               '-Wno-tautological-pointer-compare',
213               # See http://crbug.com/138571#c8
214               '-Wno-ignored-attributes',
215               # libxml casts from int to long to void*.
216               '-Wno-int-to-void-pointer-cast',
217               # libxml passes a volatile LPCRITICAL_SECTION* to a function
218               # expecting a void* volatile*.
219               '-Wno-incompatible-pointer-types',
220               # trio_is_special_quantity and trio_is_negative are only
221               # used with certain preprocessor defines set.
222               '-Wno-unused-function',
223             ],
224           },
225           'include_dirs': [
226             '<(os_include)',
227             '<(os_include)/include',
228             'src/include',
229           ],
230           'dependencies': [
231             '../icu/icu.gyp:icuuc',
232             '../zlib/zlib.gyp:zlib',
233           ],
234           'export_dependent_settings': [
235             '../icu/icu.gyp:icuuc',
236           ],
237           'direct_dependent_settings': {
238             'defines': [
239               'LIBXML_STATIC',
240             ],
241             'include_dirs': [
242               '<(os_include)/include',
243               'src/include',
244             ],
245           },
246           'conditions': [
247             ['OS=="linux"', {
248               'link_settings': {
249                 'libraries': [
250                   # We need dl for dlopen() and friends.
251                   '-ldl',
252                   '-lm',
253                 ],
254               },
255             }],
256             # http://www.xmlsoft.org/threads.html says that this is required
257             # when using libxml from several threads, which can possibly happen
258             # in chrome. On linux, this is picked up by transitivity from
259             # pkg-config output from build/linux/system.gyp.
260             ['OS=="mac" or OS=="android"', {'defines': ['_REENTRANT']}],
261             ['OS=="win"', {
262               'product_name': 'libxml2',
263               # Disable unimportant 'unused variable' warning, and
264               # signed/unsigned comparison warning. The signed/unsigned (4101)
265               # is fixed upstream and can be removed eventually.
266               # TODO(jschuh): http://crbug.com/167187 size_t -> int
267               'msvs_disabled_warnings': [ 4018, 4101, 4267 ],
268             }, {  # else: OS!="win"
269               'product_name': 'xml2',
270             }],
271           ],
272         }],
273         ['OS == "ios"', {
274           'toolsets': ['host', 'target'],
275         }],
276       ],
277     },
278   ],