summaryrefslogtreecommitdiff
path: root/chromium/third_party/hunspell/BUILD.gn
blob: 3172159be3fcc351f18d1bbdfc4f7935ffd8b54d (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# 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.

import("//testing/libfuzzer/fuzzer_test.gni")

config("hunspell_config") {
  defines = [
    "HUNSPELL_STATIC",
    "HUNSPELL_CHROME_CLIENT",
    "USE_HUNSPELL",
  ]
}

config("hunspell_warnings") {
  if (is_clang) {
    cflags = [ "-Wno-unused-private-field" ]
  }
}

static_library("hunspell") {
  sources = [
    "google/bdict.cc",
    "google/bdict.h",
    "google/bdict_reader.cc",
    "google/bdict_reader.h",
    "google/bdict_writer.cc",
    "google/bdict_writer.h",
    "src/hunspell/affentry.cxx",
    "src/hunspell/affentry.hxx",
    "src/hunspell/affixmgr.cxx",
    "src/hunspell/affixmgr.hxx",
    "src/hunspell/atypes.hxx",
    "src/hunspell/baseaffix.hxx",
    "src/hunspell/csutil.cxx",
    "src/hunspell/csutil.hxx",
    "src/hunspell/filemgr.cxx",
    "src/hunspell/filemgr.hxx",
    "src/hunspell/hashmgr.cxx",
    "src/hunspell/hashmgr.hxx",
    "src/hunspell/htypes.hxx",
    "src/hunspell/hunspell.cxx",
    "src/hunspell/hunspell.h",
    "src/hunspell/hunspell.hxx",
    "src/hunspell/hunzip.cxx",
    "src/hunspell/hunzip.hxx",
    "src/hunspell/langnum.hxx",
    "src/hunspell/phonet.cxx",
    "src/hunspell/phonet.hxx",
    "src/hunspell/replist.cxx",
    "src/hunspell/replist.hxx",
    "src/hunspell/suggestmgr.cxx",
    "src/hunspell/suggestmgr.hxx",
    "src/hunspell/w_char.hxx",
    "src/parsers/textparser.cxx",
    "src/parsers/textparser.hxx",
  ]

  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.
    ":hunspell_warnings",
  ]
  public_configs = [ ":hunspell_config" ]

  defines = [ "OPENOFFICEORG" ]

  deps = [
    "//base",
    "//third_party/icu",
  ]

  cflags = []

  if (is_win) {
    cflags += [
      # TODO(jschuh): http://crbug.com/167187 size_t -> int
      "/wd4267",
    ]
  }

  if (is_posix && !is_mac && !is_clang) {
    cflags += [
      "-Wno-unused-value",
      "-Wno-unused-variable",
      "-Wno-write-strings",
    ]
  }

  if (is_posix && !is_apple && !is_clang) {
    cflags += [
      # affentry.hxx has NULL as default parameter for a FLAG in two
      # places.
      "-Wno-conversion-null",
    ]
  }

  if (is_clang) {
    cflags += [
      # affentry.cxx has one `while ((p = nextchar(p)));` parsing loop.
      "-Wno-empty-body",

      # affentry.hxx has NULL as default parameter for a FLAG in two
      # places.
      "-Wno-null-conversion",
    ]
  }
}

fuzzer_test("hunspell_spell_fuzzer") {
  sources = [
    "fuzz/hunspell_fuzzer_hunspell_dictionary.h",
    "fuzz/hunspell_spell_fuzzer.cc",
  ]
  deps = [
    ":hunspell",
    "//base:base",
  ]

  # This is a dictionary for the fuzzer, not a spellcheck dictionary.
  dict = "fuzz/hunspell.dict"
}

fuzzer_test("hunspell_suggest_fuzzer") {
  sources = [
    "fuzz/hunspell_fuzzer_hunspell_dictionary.h",
    "fuzz/hunspell_suggest_fuzzer.cc",
  ]
  deps = [
    ":hunspell",
    "//base:base",
  ]

  # This is a dictionary for the fuzzer, not a spellcheck dictionary.
  dict = "fuzz/hunspell.dict"
}

fuzzer_test("bdict_fuzzer") {
  sources = [ "fuzz/bdict_fuzzer.cc" ]
  deps = [
    ":hunspell",
    "//base:base",
  ]
  seed_corpus = "fuzz/bdict_corpus"
}