BUILD.gn 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. # Copyright 2014 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. import("//testing/libfuzzer/fuzzer_test.gni")
  5. config("hunspell_config") {
  6. defines = [
  7. "HUNSPELL_STATIC",
  8. "HUNSPELL_CHROME_CLIENT",
  9. "USE_HUNSPELL",
  10. ]
  11. }
  12. config("hunspell_warnings") {
  13. if (is_clang) {
  14. cflags = [ "-Wno-unused-private-field" ]
  15. }
  16. }
  17. static_library("hunspell") {
  18. sources = [
  19. "google/bdict.cc",
  20. "google/bdict.h",
  21. "google/bdict_reader.cc",
  22. "google/bdict_reader.h",
  23. "google/bdict_writer.cc",
  24. "google/bdict_writer.h",
  25. "src/hunspell/affentry.cxx",
  26. "src/hunspell/affentry.hxx",
  27. "src/hunspell/affixmgr.cxx",
  28. "src/hunspell/affixmgr.hxx",
  29. "src/hunspell/atypes.hxx",
  30. "src/hunspell/baseaffix.hxx",
  31. "src/hunspell/csutil.cxx",
  32. "src/hunspell/csutil.hxx",
  33. "src/hunspell/filemgr.cxx",
  34. "src/hunspell/filemgr.hxx",
  35. "src/hunspell/hashmgr.cxx",
  36. "src/hunspell/hashmgr.hxx",
  37. "src/hunspell/htypes.hxx",
  38. "src/hunspell/hunspell.cxx",
  39. "src/hunspell/hunspell.h",
  40. "src/hunspell/hunspell.hxx",
  41. "src/hunspell/hunzip.cxx",
  42. "src/hunspell/hunzip.hxx",
  43. "src/hunspell/langnum.hxx",
  44. "src/hunspell/phonet.cxx",
  45. "src/hunspell/phonet.hxx",
  46. "src/hunspell/replist.cxx",
  47. "src/hunspell/replist.hxx",
  48. "src/hunspell/suggestmgr.cxx",
  49. "src/hunspell/suggestmgr.hxx",
  50. "src/hunspell/w_char.hxx",
  51. "src/parsers/textparser.cxx",
  52. "src/parsers/textparser.hxx",
  53. ]
  54. configs -= [ "//build/config/compiler:chromium_code" ]
  55. configs += [
  56. "//build/config/compiler:no_chromium_code",
  57. # Must be after no_chromium_code for warning flags to be ordered correctly.
  58. ":hunspell_warnings",
  59. ]
  60. public_configs = [ ":hunspell_config" ]
  61. defines = [ "OPENOFFICEORG" ]
  62. deps = [
  63. "//base",
  64. "//third_party/icu",
  65. ]
  66. cflags = []
  67. if (is_win) {
  68. cflags += [
  69. # TODO(jschuh): http://crbug.com/167187 size_t -> int
  70. "/wd4267",
  71. ]
  72. }
  73. if (is_posix && !is_mac && !is_clang) {
  74. cflags += [
  75. "-Wno-unused-value",
  76. "-Wno-unused-variable",
  77. "-Wno-write-strings",
  78. ]
  79. }
  80. if (is_posix && !is_apple && !is_clang) {
  81. cflags += [
  82. # affentry.hxx has NULL as default parameter for a FLAG in two
  83. # places.
  84. "-Wno-conversion-null",
  85. ]
  86. }
  87. if (is_clang) {
  88. cflags += [
  89. # affentry.cxx has one `while ((p = nextchar(p)));` parsing loop.
  90. "-Wno-empty-body",
  91. # affentry.hxx has NULL as default parameter for a FLAG in two
  92. # places.
  93. "-Wno-null-conversion",
  94. ]
  95. }
  96. }
  97. fuzzer_test("hunspell_spell_fuzzer") {
  98. sources = [
  99. "fuzz/hunspell_fuzzer_hunspell_dictionary.h",
  100. "fuzz/hunspell_spell_fuzzer.cc",
  101. ]
  102. deps = [
  103. ":hunspell",
  104. "//base:base",
  105. ]
  106. # This is a dictionary for the fuzzer, not a spellcheck dictionary.
  107. dict = "fuzz/hunspell.dict"
  108. }
  109. fuzzer_test("hunspell_suggest_fuzzer") {
  110. sources = [
  111. "fuzz/hunspell_fuzzer_hunspell_dictionary.h",
  112. "fuzz/hunspell_suggest_fuzzer.cc",
  113. ]
  114. deps = [
  115. ":hunspell",
  116. "//base:base",
  117. ]
  118. # This is a dictionary for the fuzzer, not a spellcheck dictionary.
  119. dict = "fuzz/hunspell.dict"
  120. }
  121. fuzzer_test("bdict_fuzzer") {
  122. sources = [ "fuzz/bdict_fuzzer.cc" ]
  123. deps = [
  124. ":hunspell",
  125. "//base:base",
  126. ]
  127. seed_corpus = "fuzz/bdict_corpus"
  128. }