blob: 70b66ab53b30c3fc0a41d8516464b8bfb19ae259 [file] [log] [blame]
# Copyright (c) 2013 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.
# Define an "os_include" variable that points at the OS-specific generated
# headers. These were generated by running the configure script offline.
if (is_linux || is_android || is_nacl) {
os_include = "linux"
} else if (is_mac || is_ios) {
os_include = "mac"
} else if (is_win) {
os_include = "win32"
config("libxml_config") {
# 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. ("defines" does "-DFOO" which defines the macro FOO as 1.)
cflags = [ "-DLIBXML_STATIC=" ]
include_dirs = [
config("libxml_warnings") {
if (is_win) {
cflags_c = [
"/wd4018", # Signed/unsigned mismatch in comparison.
"/wd4267", # TODO(brucedawson): fix C4267
"/wd4311", # and C4311 warnings.
if (is_clang) {
cflags = [
# libxml passes `const unsigned char*` through `const char*`.
# 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:
# debugXML.c compares array 'arg' to NULL.
# threads.c attempts to forward declare a pthread_equal which doesn't
# match the prototype in pthreads.h
# libxml casts from int to long to void*.
# libxml passes a volatile LPCRITICAL_SECTION* to a function expecting
# a void* volatile*.
# trio_is_special_quantity and trio_is_negative are only
# used with certain preprocessor defines set.
static_library("libxml") {
output_name = "libxml2"
sources = [
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [
# Must be after no_chromium_code for warning flags to be ordered correctly.
public_configs = [ ":libxml_config" ]
public_deps = [
deps = [
if (is_mac || is_ios || is_android) {
# 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.
defines = [ "_REENTRANT" ]
include_dirs = [ "$os_include" ]