Home | History | Annotate | Download | only in libxml
      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.
      4 
      5 {
      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': 'none',
     55               'all_dependent_settings': {
     56                 'defines': [
     57                   'USE_SYSTEM_LIBXML',
     58                 ],
     59                 'include_dirs': [
     60                   '$(SDKROOT)/usr/include/libxml2',
     61                 ],
     62               },
     63               'link_settings': {
     64                 'libraries': [
     65                   '$(SDKROOT)/usr/lib/libxml2.dylib',
     66                 ],
     67               },
     68             }],
     69           ],
     70         }, {  # else: !use_system_libxml
     71           'type': 'static_library',
     72           'sources': [
     73             'chromium/libxml_utils.h',
     74             'chromium/libxml_utils.cc',
     75             'linux/config.h',
     76             'linux/include/libxml/xmlversion.h',
     77             'mac/config.h',
     78             'mac/include/libxml/xmlversion.h',
     79             'src/include/libxml/c14n.h',
     80             'src/include/libxml/catalog.h',
     81             'src/include/libxml/chvalid.h',
     82             'src/include/libxml/debugXML.h',
     83             'src/include/libxml/dict.h',
     84             'src/include/libxml/DOCBparser.h',
     85             'src/include/libxml/encoding.h',
     86             'src/include/libxml/entities.h',
     87             'src/include/libxml/globals.h',
     88             'src/include/libxml/hash.h',
     89             'src/include/libxml/HTMLparser.h',
     90             'src/include/libxml/HTMLtree.h',
     91             'src/include/libxml/list.h',
     92             'src/include/libxml/nanoftp.h',
     93             'src/include/libxml/nanohttp.h',
     94             'src/include/libxml/parser.h',
     95             'src/include/libxml/parserInternals.h',
     96             'src/include/libxml/pattern.h',
     97             'src/include/libxml/relaxng.h',
     98             'src/include/libxml/SAX.h',
     99             'src/include/libxml/SAX2.h',
    100             'src/include/libxml/schemasInternals.h',
    101             'src/include/libxml/schematron.h',
    102             'src/include/libxml/threads.h',
    103             'src/include/libxml/tree.h',
    104             'src/include/libxml/uri.h',
    105             'src/include/libxml/valid.h',
    106             'src/include/libxml/xinclude.h',
    107             'src/include/libxml/xlink.h',
    108             'src/include/libxml/xmlautomata.h',
    109             'src/include/libxml/xmlerror.h',
    110             'src/include/libxml/xmlexports.h',
    111             'src/include/libxml/xmlIO.h',
    112             'src/include/libxml/xmlmemory.h',
    113             'src/include/libxml/xmlmodule.h',
    114             'src/include/libxml/xmlreader.h',
    115             'src/include/libxml/xmlregexp.h',
    116             'src/include/libxml/xmlsave.h',
    117             'src/include/libxml/xmlschemas.h',
    118             'src/include/libxml/xmlschemastypes.h',
    119             'src/include/libxml/xmlstring.h',
    120             'src/include/libxml/xmlunicode.h',
    121             'src/include/libxml/xmlwriter.h',
    122             'src/include/libxml/xpath.h',
    123             'src/include/libxml/xpathInternals.h',
    124             'src/include/libxml/xpointer.h',
    125             'src/include/win32config.h',
    126             'src/include/wsockcompat.h',
    127             'src/acconfig.h',
    128             'src/c14n.c',
    129             'src/catalog.c',
    130             'src/chvalid.c',
    131             'src/debugXML.c',
    132             'src/dict.c',
    133             'src/DOCBparser.c',
    134             'src/elfgcchack.h',
    135             'src/encoding.c',
    136             'src/entities.c',
    137             'src/error.c',
    138             'src/globals.c',
    139             'src/hash.c',
    140             'src/HTMLparser.c',
    141             'src/HTMLtree.c',
    142             'src/legacy.c',
    143             'src/libxml.h',
    144             'src/list.c',
    145             'src/nanoftp.c',
    146             'src/nanohttp.c',
    147             'src/parser.c',
    148             'src/parserInternals.c',
    149             'src/pattern.c',
    150             'src/relaxng.c',
    151             'src/SAX.c',
    152             'src/SAX2.c',
    153             'src/schematron.c',
    154             'src/threads.c',
    155             'src/tree.c',
    156             #'src/trio.c',
    157             #'src/trio.h',
    158             #'src/triodef.h',
    159             #'src/trionan.c',
    160             #'src/trionan.h',
    161             #'src/triop.h',
    162             #'src/triostr.c',
    163             #'src/triostr.h',
    164             'src/uri.c',
    165             'src/valid.c',
    166             'src/xinclude.c',
    167             'src/xlink.c',
    168             'src/xmlIO.c',
    169             'src/xmlmemory.c',
    170             'src/xmlmodule.c',
    171             'src/xmlreader.c',
    172             'src/xmlregexp.c',
    173             'src/xmlsave.c',
    174             'src/xmlschemas.c',
    175             'src/xmlschemastypes.c',
    176             'src/xmlstring.c',
    177             'src/xmlunicode.c',
    178             'src/xmlwriter.c',
    179             'src/xpath.c',
    180             'src/xpointer.c',
    181             'win32/config.h',
    182             'win32/include/libxml/xmlversion.h',
    183           ],
    184           'defines': [
    185             # Define LIBXML_STATIC as nothing to match how libxml.h
    186             # (an internal header) defines LIBXML_STATIC, otherwise
    187             # we get the macro redefined warning from GCC.  (-DFOO
    188             # defines the macro FOO as 1.)
    189             'LIBXML_STATIC=',
    190           ],
    191           'include_dirs': [
    192             '<(os_include)',
    193             '<(os_include)/include',
    194             'src/include',
    195           ],
    196           'dependencies': [
    197             '../icu/icu.gyp:icuuc',
    198             '../zlib/zlib.gyp:zlib',
    199           ],
    200           'export_dependent_settings': [
    201             '../icu/icu.gyp:icuuc',
    202           ],
    203           'direct_dependent_settings': {
    204             'defines': [
    205               'LIBXML_STATIC',
    206             ],
    207             'include_dirs': [
    208               '<(os_include)/include',
    209               'src/include',
    210             ],
    211           },
    212           'conditions': [
    213             ['OS=="linux"', {
    214               'link_settings': {
    215                 'libraries': [
    216                   # We need dl for dlopen() and friends.
    217                   '-ldl',
    218                 ],
    219               },
    220             }],
    221             # http://www.xmlsoft.org/threads.html says that this is required
    222             # when using libxml from several threads, which can possibly happen
    223             # in chrome. On linux, this is picked up by transitivity from
    224             # pkg-config output from build/linux/system.gyp.
    225             ['OS=="mac" or OS=="android"', {'defines': ['_REENTRANT']}],
    226             ['OS=="win"', {
    227               'product_name': 'libxml2',
    228               # Disable unimportant 'unused variable' warning, and
    229               # signed/unsigned comparison warning. The signed/unsigned (4101)
    230               # is fixed upstream and can be removed eventually.
    231               # TODO(jschuh): http://crbug.com/167187 size_t -> int
    232               'msvs_disabled_warnings': [ 4018, 4101, 4267 ],
    233             }, {  # else: OS!="win"
    234               'product_name': 'xml2',
    235             }],
    236             ['clang == 1', {
    237               'xcode_settings': {
    238                 'WARNING_CFLAGS': [
    239                   # libxml passes `const unsigned char*` through `const char*`.
    240                   '-Wno-pointer-sign',
    241                   # pattern.c and uri.c both have an intentional
    242                   # `for (...);` / `while(...);` loop. I submitted a patch to
    243                   # move the `'` to its own line, but until that's landed
    244                   # suppress the warning:
    245                   '-Wno-empty-body',
    246                 ],
    247               },
    248               'cflags': [
    249                 '-Wno-pointer-sign',
    250                 '-Wno-empty-body',
    251 
    252                 # See http://crbug.com/138571#c8
    253                 '-Wno-ignored-attributes',
    254               ],
    255             }],
    256           ],
    257         }],
    258       ],
    259     },
    260   ],
    261 }
    262