• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -euv
2# Copyright 2019 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
19mkdir -p $WORK/lwan
20cd $WORK/lwan
21
22cmake -GNinja \
23	-DCMAKE_BUILD_TYPE=Debug \
24	-DCMAKE_C_COMPILER="${CC}" \
25	-DCMAKE_C_FLAGS="${CFLAGS}" \
26	$SRC/lwan/
27
28ninja -v liblwan.a
29
30cp $SRC/lwan/fuzz/*.dict $OUT/
31
32for fuzzer in $SRC/lwan/src/bin/fuzz/*_fuzzer.cc; do
33	executable=$(basename $fuzzer .cc)
34	corpus_base=$(basename $fuzzer _fuzzer.cc)
35
36	zip -jr $OUT/${executable}_seed_corpus.zip $SRC/lwan/fuzz/corpus/corpus-${corpus_base}-*
37
38	$CXX $CXXFLAGS -std=c++11 \
39		-Wl,-whole-archive $WORK/lwan/src/lib/liblwan.a -Wl,-no-whole-archive \
40		-I$SRC/lwan/src/lib $fuzzer \
41		$LIB_FUZZING_ENGINE -lpthread -lz \
42		-o $OUT/$executable
43done
44