Add an option to build libFuzzer from DEPS.

The bots will need to get libFuzzer externally. As usual, borrow
Chromium's copy.

Change-Id: I5ed879bbc76188838adcf9d51855e76c481ace5b
Reviewed-on: https://boringssl-review.googlesource.com/16146
Reviewed-by: Steven Valdez <svaldez@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/.gitignore b/.gitignore
index 9f396f6..41c6e96 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,6 +14,7 @@
 util/bot/cmake-win32.zip
 util/bot/golang
 util/bot/gyp
+util/bot/libFuzzer
 util/bot/llvm-build
 util/bot/perl-win32
 util/bot/perl-win32.zip
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c421e88..7c23f0a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -277,6 +277,14 @@
 add_subdirectory(decrepit)
 
 if(FUZZ)
+  if(LIBFUZZER_FROM_DEPS)
+    file(GLOB LIBFUZZER_SOURCES "util/bot/libFuzzer/*.cpp")
+    add_library(Fuzzer STATIC ${LIBFUZZER_SOURCES})
+    # libFuzzer does not pass our aggressive warnings. It also must be built
+    # without -fsanitize-coverage options or clang crashes.
+    set_target_properties(Fuzzer PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-format-nonliteral -fsanitize-coverage=0")
+  endif()
+
   add_subdirectory(fuzz)
 endif()
 
diff --git a/util/bot/DEPS b/util/bot/DEPS
index 3642da6..3047f14 100644
--- a/util/bot/DEPS
+++ b/util/bot/DEPS
@@ -26,6 +26,10 @@
     'boringssl/util/bot/android_tools':
       Var('chromium_git') + '/android_tools.git' + '@' + 'cb6bc21107001e2f2eeee2707b482b2b755baf51',
   },
+  'unix': {
+    'boringssl/util/bot/libFuzzer':
+      Var('chromium_git') + '/chromium/llvm-project/llvm/lib/Fuzzer.git' + '@' + '16f5f743c188c836d32cdaf349d5d3effb8a3518',
+  },
 }
 
 recursedeps = [