BUILD.gn 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. # Copyright (c) 2013 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("//build/config/chromecast_build.gni")
  5. import("//testing/libfuzzer/fuzzer_test.gni")
  6. # On Linux, we implicitly already depend on expat via fontconfig;
  7. # let's not pull it in twice.
  8. # Chromecast doesn't ship expat as a system library.
  9. # Libfuzzer and AFL need to build library from sources.
  10. if (((is_linux && !is_castos) || is_chromeos) && !use_fuzzing_engine) {
  11. config("expat_config") {
  12. libs = [ "expat" ]
  13. }
  14. group("expat") {
  15. public_configs = [ ":expat_config" ]
  16. }
  17. } else {
  18. config("expat_public_config") {
  19. include_dirs = [
  20. "src/expat/lib",
  21. "include/expat_config",
  22. ]
  23. defines = [ "XML_STATIC" ]
  24. }
  25. config("expat_internal_config") {
  26. cflags = [
  27. # xmlparse.c has some |if (0 && ...)| statements.
  28. "-Wno-unreachable-code",
  29. # Various files have fallthrough annotated with comments instead of
  30. # attributes, and switching to attributes is difficult.
  31. "-Wno-implicit-fallthrough",
  32. ]
  33. }
  34. static_library("expat") {
  35. sources = [
  36. "src/expat/lib/expat.h",
  37. "src/expat/lib/xmlparse.c",
  38. "src/expat/lib/xmlrole.c",
  39. "src/expat/lib/xmltok.c",
  40. ]
  41. public_configs = [ ":expat_public_config" ]
  42. configs += [ ":expat_internal_config" ]
  43. defines = [ "_LIB" ]
  44. if (is_win) {
  45. # expat expects to define WIN32_LEAN_AND_MEAN itself
  46. configs -= [ "//build/config/win:lean_and_mean" ]
  47. defines += [ "COMPILED_FROM_DSP" ]
  48. } else {
  49. defines += [ "HAVE_EXPAT_CONFIG_H" ]
  50. }
  51. }
  52. }
  53. fuzzer_test("expat_xml_parse_fuzzer") {
  54. sources = [ "fuzz/expat_xml_parse_fuzzer.cc" ]
  55. deps = [ ":expat" ]
  56. dict = "//third_party/libxml/fuzz/xml.dict"
  57. seed_corpus = "//third_party/libxml/fuzz/seed_corpus"
  58. }