chromium/third_party/libxslt/BUILD.gn

# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

config("libxslt_config") {
  defines = [ "LIBXSLT_STATIC" ]
  include_dirs = [ "src" ]
}

config("libxslt_warnings") {
  if (is_clang) {
    cflags = [
      # libxslt stores a char[3] in a `const unsigned char*`.
      "-Wno-pointer-sign",

      # xsltDefaultRegion and xsltCalibrateTimestamps are only
      # used with certain preprocessor defines set.
      "-Wno-unused-function",
    ]
  }
}

static_library("libxslt") {
  sources = [
    "src/libxslt/attributes.c",
    "src/libxslt/attributes.h",
    "src/libxslt/attrvt.c",
    "src/libxslt/documents.c",
    "src/libxslt/documents.h",
    "src/libxslt/extensions.c",
    "src/libxslt/extensions.h",
    "src/libxslt/extra.c",
    "src/libxslt/extra.h",
    "src/libxslt/functions.c",
    "src/libxslt/functions.h",
    "src/libxslt/imports.c",
    "src/libxslt/imports.h",
    "src/libxslt/keys.c",
    "src/libxslt/keys.h",
    "src/libxslt/libxslt.h",
    "src/libxslt/namespaces.c",
    "src/libxslt/namespaces.h",
    "src/libxslt/numbers.c",
    "src/libxslt/numbersInternals.h",
    "src/libxslt/pattern.c",
    "src/libxslt/pattern.h",
    "src/libxslt/preproc.c",
    "src/libxslt/preproc.h",
    "src/libxslt/security.c",
    "src/libxslt/security.h",
    "src/libxslt/templates.c",
    "src/libxslt/templates.h",
    "src/libxslt/transform.c",
    "src/libxslt/transform.h",
    "src/libxslt/trio.h",
    "src/libxslt/triodef.h",
    "src/libxslt/variables.c",
    "src/libxslt/variables.h",
    "src/libxslt/win32config.h",
    "src/libxslt/xslt.c",
    "src/libxslt/xslt.h",
    "src/libxslt/xsltInternals.h",
    "src/libxslt/xsltconfig.h",
    "src/libxslt/xsltexports.h",
    "src/libxslt/xsltlocale.c",
    "src/libxslt/xsltlocale.h",
    "src/libxslt/xsltutils.c",
    "src/libxslt/xsltutils.h",
    "win32/config.h",
  ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [
    "//build/config/compiler:no_chromium_code",

    # Must be after no_chromium_code for warning flags to be ordered correctly.
    ":libxslt_warnings",
  ]
  public_configs = [ ":libxslt_config" ]

  if (is_linux || is_chromeos) {
    sources += [ "linux/config.h" ]
  }
  if (is_apple) {
    sources += [ "mac/config.h" ]
  }

  cflags = []
  if (is_linux || is_chromeos || is_android || is_fuchsia) {
    include_dirs = [ "linux" ]
  } else if (is_win) {
    include_dirs = [ "win32" ]
    cflags += [
      "/wd4267",  # size_t to int.

      # TODO(brucedawson): http://crbug.com/554200 4311 is a VS
      # 2015 64-bit warning for pointer truncation
      "/wd4311",
    ]
  } else if (is_apple) {
    include_dirs = [ "mac" ]
  }

  deps = [ "//third_party/libxml" ]

  visibility = [ "//third_party/blink/renderer/*" ]
}