1#!/bin/bash -eu 2# Copyright 2016 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# First, build RE2. 19# N.B., we don't follow the standard incantation for building RE2 20# (i.e., `make && make test && make install && make testinstall`), 21# because some of the targets doesn't use $CXXFLAGS properly, which 22# causes compilation to fail. The obj/libre2.a target is all we 23# really need for our fuzzer, so that's all we build. Hopefully 24# this won't cause the fuzzer to fail erroneously due to not running 25# upstream's tests first to be sure things compiled correctly. 26CXXFLAGS="$CXXFLAGS -O2" 27make clean 28make -j$(nproc) obj/libre2.a 29 30# Second, build the fuzzer (distributed with RE2). 31$CXX $CXXFLAGS -std=c++11 -I. \ 32 re2/fuzzing/re2_fuzzer.cc -o $OUT/re2_fuzzer \ 33 $LIB_FUZZING_ENGINE obj/libre2.a 34