summaryrefslogtreecommitdiff
path: root/chromium/third_party/libxslt/BUILD.gn
blob: 17162c11d4faf9fa667f43819e52e5bb50f676bd (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
# Copyright 2014 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.

declare_args() {
  use_system_libxslt = false
}

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("bundled_libxslt") {
  sources = [
    "linux/config.h",
    "mac/config.h",
    "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",
    "src/libxslt/xsltwin32config.h.in",
    "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" ]

  cflags = []
  if (is_linux || 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_mac) {
    include_dirs = [ "mac" ]
  }

  deps = [
    "//third_party/libxml",
  ]
}

if (use_system_libxslt) {
  import("//build/config/linux/pkg_config.gni")
  pkg_config("system_libxslt") {
    packages = [ "libxslt" ]
  }
  source_set("libxslt") {
    public_configs = [ ":system_libxslt" ]
  }
} else {
  group("libxslt") {
    public_deps = [ ":bundled_libxslt" ]
  }
}