1#!/bin/bash -eu 2# Copyright 2017 Google Inc. 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15# 16################################################################################ 17 18./bootstrap.sh 19./configure --enable-macho --enable-debug --enable-dex --enable-dotnet --without-crypto 20 21make clean 22make -j$(nproc) all 23make install 24 25fuzzers=$(find $SRC/yara/tests/oss-fuzz/ -name "*.cc") 26for f in $fuzzers; do 27 fuzzer_name=$(basename -s ".cc" $f) 28 echo "Building $fuzzer_name" 29 $CXX $CXXFLAGS -std=c++11 -I. $f -o $OUT/$fuzzer_name \ 30 ./libyara/.libs/libyara.a \ 31 $LIB_FUZZING_ENGINE 32 if [ -d "$SRC/yara/tests/oss-fuzz/${fuzzer_name}_corpus" ]; then 33 zip -j $OUT/${fuzzer_name}_seed_corpus.zip $SRC/yara/tests/oss-fuzz/${fuzzer_name}_corpus/* 34 fi 35done 36 37find $SRC/yara/tests/oss-fuzz -name \*.dict -exec cp {} $OUT \; 38find $SRC/yara/tests/oss-fuzz -name \*.options -exec cp {} $OUT \; 39