summaryrefslogtreecommitdiffstats
path: root/third_party/libxml/libxml.gyp
blob: a3cfea9b4ec8de859c2eb31792a55b9110056311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

{
  'variables': {
    'conditions': [
      # Define an "os_include" variable that points at the OS-specific generated
      # headers.  These were generated by running the configure script offline.
      ['os_posix == 1 and OS != "mac" and OS != "ios"', {
        'os_include': 'linux'
      }],
      ['OS=="mac"', {'os_include': 'mac'}],
      ['OS=="win"', {'os_include': 'win32'}],
    ],
    'use_system_libxml%': 0,
  },
  'targets': [
    {
      'target_name': 'libxml',
      'conditions': [
        ['use_system_libxml', {
          'conditions': [
            ['os_posix == 1 and OS != "mac" and OS != "ios"', {
              'type': 'static_library',
              'sources': [
                'chromium/libxml_utils.h',
                'chromium/libxml_utils.cc',
              ],
              'cflags': [
                '<!@(pkg-config --cflags libxml-2.0)',
              ],
              'defines': [
                'USE_SYSTEM_LIBXML',
              ],
              'direct_dependent_settings': {
                'cflags': [
                  '<!@(pkg-config --cflags libxml-2.0)',
                ],
                'defines': [
                  'USE_SYSTEM_LIBXML',
                ],
              },
              'link_settings': {
                'ldflags': [
                  '<!@(pkg-config --libs-only-L --libs-only-other libxml-2.0)',
                ],
                'libraries': [
                  '<!@(pkg-config --libs-only-l libxml-2.0)',
                ],
              },
            }],
            ['OS == "ios"', {
              'type': 'static_library',
              'sources': [
                'chromium/libxml_utils.h',
                'chromium/libxml_utils.cc',
              ],
              'include_dirs': [
                '$(SDKROOT)/usr/include/libxml2',
              ],
              'all_dependent_settings': {
                'defines': [
                  'USE_SYSTEM_LIBXML',
                ],
                'include_dirs': [
                  '$(SDKROOT)/usr/include/libxml2',
                ],
              },
              'link_settings': {
                'xcode_settings': {
                  'OTHER_LDFLAGS': [
                    '-lxml2',
                  ],
                },
              },
            }],
          ],
        }, {  # else: !use_system_libxml
          'type': 'static_library',
          'sources': [
            'chromium/libxml_utils.h',
            'chromium/libxml_utils.cc',
            'linux/config.h',
            'linux/include/libxml/xmlversion.h',
            'mac/config.h',
            'mac/include/libxml/xmlversion.h',
            'src/include/libxml/c14n.h',
            'src/include/libxml/catalog.h',
            'src/include/libxml/chvalid.h',
            'src/include/libxml/debugXML.h',
            'src/include/libxml/dict.h',
            'src/include/libxml/DOCBparser.h',
            'src/include/libxml/encoding.h',
            'src/include/libxml/entities.h',
            'src/include/libxml/globals.h',
            'src/include/libxml/hash.h',
            'src/include/libxml/HTMLparser.h',
            'src/include/libxml/HTMLtree.h',
            'src/include/libxml/list.h',
            'src/include/libxml/parser.h',
            'src/include/libxml/parserInternals.h',
            'src/include/libxml/pattern.h',
            'src/include/libxml/relaxng.h',
            'src/include/libxml/SAX.h',
            'src/include/libxml/SAX2.h',
            'src/include/libxml/schemasInternals.h',
            'src/include/libxml/schematron.h',
            'src/include/libxml/threads.h',
            'src/include/libxml/tree.h',
            'src/include/libxml/uri.h',
            'src/include/libxml/valid.h',
            'src/include/libxml/xinclude.h',
            'src/include/libxml/xlink.h',
            'src/include/libxml/xmlautomata.h',
            'src/include/libxml/xmlerror.h',
            'src/include/libxml/xmlexports.h',
            'src/include/libxml/xmlIO.h',
            'src/include/libxml/xmlmemory.h',
            'src/include/libxml/xmlmodule.h',
            'src/include/libxml/xmlreader.h',
            'src/include/libxml/xmlregexp.h',
            'src/include/libxml/xmlsave.h',
            'src/include/libxml/xmlschemas.h',
            'src/include/libxml/xmlschemastypes.h',
            'src/include/libxml/xmlstring.h',
            'src/include/libxml/xmlunicode.h',
            'src/include/libxml/xmlwriter.h',
            'src/include/libxml/xpath.h',
            'src/include/libxml/xpathInternals.h',
            'src/include/libxml/xpointer.h',
            'src/include/win32config.h',
            'src/include/wsockcompat.h',
            'src/acconfig.h',
            'src/c14n.c',
            'src/catalog.c',
            'src/chvalid.c',
            'src/debugXML.c',
            'src/dict.c',
            'src/DOCBparser.c',
            'src/elfgcchack.h',
            'src/encoding.c',
            'src/entities.c',
            'src/error.c',
            'src/globals.c',
            'src/hash.c',
            'src/HTMLparser.c',
            'src/HTMLtree.c',
            'src/legacy.c',
            'src/libxml.h',
            'src/list.c',
            'src/parser.c',
            'src/parserInternals.c',
            'src/pattern.c',
            'src/relaxng.c',
            'src/SAX.c',
            'src/SAX2.c',
            'src/schematron.c',
            'src/threads.c',
            'src/tree.c',
            #'src/trio.c',
            #'src/trio.h',
            #'src/triodef.h',
            #'src/trionan.c',
            #'src/trionan.h',
            #'src/triop.h',
            #'src/triostr.c',
            #'src/triostr.h',
            'src/uri.c',
            'src/valid.c',
            'src/xinclude.c',
            'src/xlink.c',
            'src/xmlIO.c',
            'src/xmlmemory.c',
            'src/xmlmodule.c',
            'src/xmlreader.c',
            'src/xmlregexp.c',
            'src/xmlsave.c',
            'src/xmlschemas.c',
            'src/xmlschemastypes.c',
            'src/xmlstring.c',
            'src/xmlunicode.c',
            'src/xmlwriter.c',
            'src/xpath.c',
            'src/xpointer.c',
            'win32/config.h',
            'win32/include/libxml/xmlversion.h',
          ],
          'defines': [
            # Define LIBXML_STATIC as nothing to match how libxml.h
            # (an internal header) defines LIBXML_STATIC, otherwise
            # we get the macro redefined warning from GCC.  (-DFOO
            # defines the macro FOO as 1.)
            'LIBXML_STATIC=',
          ],
          'variables': {
            'clang_warning_flags': [
              # libxml passes `const unsigned char*` through `const char*`.
              '-Wno-pointer-sign',
              # pattern.c and uri.c both have an intentional
              # `for (...);` / `while(...);` loop. I submitted a patch to
              # move the `'` to its own line, but until that's landed
              # suppress the warning:
              '-Wno-empty-body',
              # debugXML.c compares array 'arg' to NULL.
              '-Wno-tautological-pointer-compare',
              # See http://crbug.com/138571#c8
              '-Wno-ignored-attributes',
            ],
          },
          'include_dirs': [
            '<(os_include)',
            '<(os_include)/include',
            'src/include',
          ],
          'dependencies': [
            '../icu/icu.gyp:icuuc',
            '../zlib/zlib.gyp:zlib',
          ],
          'export_dependent_settings': [
            '../icu/icu.gyp:icuuc',
          ],
          'direct_dependent_settings': {
            'defines': [
              'LIBXML_STATIC',
            ],
            'include_dirs': [
              '<(os_include)/include',
              'src/include',
            ],
          },
          'conditions': [
            ['OS=="linux"', {
              'link_settings': {
                'libraries': [
                  # We need dl for dlopen() and friends.
                  '-ldl',
                  '-lm',
                ],
              },
            }],
            # http://www.xmlsoft.org/threads.html says that this is required
            # when using libxml from several threads, which can possibly happen
            # in chrome. On linux, this is picked up by transitivity from
            # pkg-config output from build/linux/system.gyp.
            ['OS=="mac" or OS=="android"', {'defines': ['_REENTRANT']}],
            ['OS=="win"', {
              'product_name': 'libxml2',
              # Disable unimportant 'unused variable' warning, and
              # signed/unsigned comparison warning. The signed/unsigned (4101)
              # is fixed upstream and can be removed eventually.
              # TODO(jschuh): http://crbug.com/167187 size_t -> int
              'msvs_disabled_warnings': [ 4018, 4101, 4267 ],
            }, {  # else: OS!="win"
              'product_name': 'xml2',
            }],
          ],
        }],
        ['OS == "ios"', {
          'toolsets': ['host', 'target'],
        }],
      ],
    },
  ],
}