James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 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. |
| 4 | |
| 5 | # Define an "os_include" variable that points at the OS-specific generated |
| 6 | # headers. These were generated by running the configure script offline. |
Benjamin Lerman | 507bb1a | 2015-02-26 13:15:17 +0100 | [diff] [blame] | 7 | if (is_linux || is_android || is_nacl) { |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 8 | os_include = "linux" |
| 9 | } else if (is_mac || is_ios) { |
| 10 | os_include = "mac" |
| 11 | } else if (is_win) { |
| 12 | os_include = "win32" |
| 13 | } |
| 14 | |
| 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=" ] |
| 20 | |
| 21 | include_dirs = [ |
| 22 | "src/include", |
| 23 | "$os_include/include", |
| 24 | ] |
| 25 | } |
| 26 | |
| 27 | static_library("libxml") { |
| 28 | output_name = "libxml2" |
| 29 | sources = [ |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 30 | "chromium/libxml_utils.cc", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 31 | "chromium/libxml_utils.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 32 | "linux/config.h", |
| 33 | "linux/include/libxml/xmlversion.h", |
| 34 | "mac/config.h", |
| 35 | "mac/include/libxml/xmlversion.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 36 | "src/DOCBparser.c", |
| 37 | "src/HTMLparser.c", |
| 38 | "src/HTMLtree.c", |
| 39 | "src/SAX.c", |
| 40 | "src/SAX2.c", |
| 41 | "src/acconfig.h", |
| 42 | "src/c14n.c", |
| 43 | "src/catalog.c", |
| 44 | "src/chvalid.c", |
| 45 | "src/debugXML.c", |
| 46 | "src/dict.c", |
| 47 | "src/elfgcchack.h", |
| 48 | "src/encoding.c", |
| 49 | "src/entities.c", |
| 50 | "src/error.c", |
| 51 | "src/globals.c", |
| 52 | "src/hash.c", |
| 53 | "src/include/libxml/DOCBparser.h", |
| 54 | "src/include/libxml/HTMLparser.h", |
| 55 | "src/include/libxml/HTMLtree.h", |
| 56 | "src/include/libxml/SAX.h", |
| 57 | "src/include/libxml/SAX2.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 58 | "src/include/libxml/c14n.h", |
| 59 | "src/include/libxml/catalog.h", |
| 60 | "src/include/libxml/chvalid.h", |
| 61 | "src/include/libxml/debugXML.h", |
| 62 | "src/include/libxml/dict.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 63 | "src/include/libxml/encoding.h", |
| 64 | "src/include/libxml/entities.h", |
| 65 | "src/include/libxml/globals.h", |
| 66 | "src/include/libxml/hash.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 67 | "src/include/libxml/list.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 68 | "src/include/libxml/parser.h", |
| 69 | "src/include/libxml/parserInternals.h", |
| 70 | "src/include/libxml/pattern.h", |
| 71 | "src/include/libxml/relaxng.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 72 | "src/include/libxml/schemasInternals.h", |
| 73 | "src/include/libxml/schematron.h", |
| 74 | "src/include/libxml/threads.h", |
| 75 | "src/include/libxml/tree.h", |
| 76 | "src/include/libxml/uri.h", |
| 77 | "src/include/libxml/valid.h", |
| 78 | "src/include/libxml/xinclude.h", |
| 79 | "src/include/libxml/xlink.h", |
Dave Moore | cc0e4f9 | 2015-03-10 15:23:04 -0700 | [diff] [blame] | 80 | "src/include/libxml/xmlIO.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 81 | "src/include/libxml/xmlautomata.h", |
| 82 | "src/include/libxml/xmlerror.h", |
| 83 | "src/include/libxml/xmlexports.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 84 | "src/include/libxml/xmlmemory.h", |
| 85 | "src/include/libxml/xmlmodule.h", |
| 86 | "src/include/libxml/xmlreader.h", |
| 87 | "src/include/libxml/xmlregexp.h", |
| 88 | "src/include/libxml/xmlsave.h", |
| 89 | "src/include/libxml/xmlschemas.h", |
| 90 | "src/include/libxml/xmlschemastypes.h", |
| 91 | "src/include/libxml/xmlstring.h", |
| 92 | "src/include/libxml/xmlunicode.h", |
| 93 | "src/include/libxml/xmlwriter.h", |
| 94 | "src/include/libxml/xpath.h", |
| 95 | "src/include/libxml/xpathInternals.h", |
| 96 | "src/include/libxml/xpointer.h", |
| 97 | "src/include/win32config.h", |
| 98 | "src/include/wsockcompat.h", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 99 | "src/legacy.c", |
| 100 | "src/libxml.h", |
| 101 | "src/list.c", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 102 | "src/parser.c", |
| 103 | "src/parserInternals.c", |
| 104 | "src/pattern.c", |
| 105 | "src/relaxng.c", |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 106 | "src/schematron.c", |
| 107 | "src/threads.c", |
| 108 | "src/tree.c", |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 109 | |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 110 | #"src/trio.c", |
| 111 | #"src/trio.h", |
| 112 | #"src/triodef.h", |
| 113 | #"src/trionan.c", |
| 114 | #"src/trionan.h", |
| 115 | #"src/triop.h", |
| 116 | #"src/triostr.c", |
| 117 | #"src/triostr.h", |
| 118 | "src/uri.c", |
| 119 | "src/valid.c", |
| 120 | "src/xinclude.c", |
| 121 | "src/xlink.c", |
| 122 | "src/xmlIO.c", |
| 123 | "src/xmlmemory.c", |
| 124 | "src/xmlmodule.c", |
| 125 | "src/xmlreader.c", |
| 126 | "src/xmlregexp.c", |
| 127 | "src/xmlsave.c", |
| 128 | "src/xmlschemas.c", |
| 129 | "src/xmlschemastypes.c", |
| 130 | "src/xmlstring.c", |
| 131 | "src/xmlunicode.c", |
| 132 | "src/xmlwriter.c", |
| 133 | "src/xpath.c", |
| 134 | "src/xpointer.c", |
| 135 | "win32/config.h", |
| 136 | "win32/include/libxml/xmlversion.h", |
| 137 | ] |
| 138 | |
| 139 | configs -= [ "//build/config/compiler:chromium_code" ] |
| 140 | configs += [ "//build/config/compiler:no_chromium_code" ] |
| 141 | |
| 142 | public_configs = [ ":libxml_config" ] |
| 143 | public_deps = [ |
| 144 | "//third_party/icu:icuuc", |
| 145 | ] |
| 146 | deps = [ |
| 147 | "//third_party/zlib", |
| 148 | ] |
| 149 | |
| 150 | if (is_win) { |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 151 | cflags_c = [ "/wd4101" ] # Unreferenced local variable. |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 152 | } else if (is_mac || is_android) { |
| 153 | # http://www.xmlsoft.org/threads.html says that this is required when using |
| 154 | # libxml from several threads, which can possibly happen in chrome. On |
| 155 | # linux, this is picked up by transitivity from pkg-config output from |
| 156 | # build/linux/system.gyp. |
| 157 | defines = [ "_REENTRANT" ] |
| 158 | } |
| 159 | |
| 160 | if (is_clang) { |
| 161 | cflags = [ |
| 162 | # libxml passes `const unsigned char*` through `const char*`. |
| 163 | "-Wno-pointer-sign", |
| 164 | |
| 165 | # pattern.c and uri.c both have an intentional `for (...);` / |
| 166 | # `while(...);` loop. I submitted a patch to move the `'` to its own |
| 167 | # line, but until that's landed suppress the warning: |
| 168 | "-Wno-empty-body", |
| 169 | |
| 170 | # debugXML.c compares array 'arg' to NULL. |
| 171 | "-Wno-tautological-pointer-compare", |
| 172 | |
| 173 | # threads.c attempts to forward declare a pthread_equal which doesn't |
| 174 | # match the prototype in pthreads.h |
| 175 | "-Wno-ignored-attributes", |
| 176 | ] |
| 177 | } |
| 178 | |
James Robinson | 6a64b81 | 2014-12-03 13:38:42 -0800 | [diff] [blame] | 179 | include_dirs = [ "$os_include" ] |
James Robinson | 646469d | 2014-10-03 15:33:28 -0700 | [diff] [blame] | 180 | } |