build_google_oss_fuzzers.sh 739 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. set -e
  3. if [ "$SRC" == "" ]; then
  4. echo "SRC env var not defined"
  5. exit 1
  6. fi
  7. if [ "$OUT" == "" ]; then
  8. echo "OUT env var not defined"
  9. exit 1
  10. fi
  11. if [ "$CXX" == "" ]; then
  12. echo "CXX env var not defined"
  13. exit 1
  14. fi
  15. SRC_DIR=$(dirname $0)/../..
  16. build_fuzzer()
  17. {
  18. fuzzerName=$1
  19. sourceFilename=$2
  20. shift
  21. shift
  22. echo "Building fuzzer $fuzzerName"
  23. $CXX $CXXFLAGS -std=c++11 -I$SRC_DIR/src/lib/openjp2 -I$SRC_DIR/build/src/lib/openjp2 \
  24. $sourceFilename $* -o $OUT/$fuzzerName \
  25. -lFuzzingEngine $SRC_DIR/build/bin/libopenjp2.a -lm -lpthread
  26. }
  27. fuzzerFiles=$(dirname $0)/*.cpp
  28. for F in $fuzzerFiles; do
  29. fuzzerName=$(basename $F .cpp)
  30. build_fuzzer $fuzzerName $F
  31. done