1#!/bin/bash -eu
2# Copyright 2018 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
18LDFLAGS="$CXXFLAGS" make -j$(nproc) HAVE_GLUT=no build=debug OUT=$WORK
19fuzz_target=pdf_fuzzer
20
21$CXX $CXXFLAGS -std=c++11 -Iinclude \
22    source/fuzz/pdf_fuzzer.cc -o $OUT/$fuzz_target \
23    $LIB_FUZZING_ENGINE $WORK/libmupdf.a $WORK/libmupdf-third.a
24
25mv $SRC/{*.zip,*.dict,*.options} $OUT
26
27if [ ! -f "${OUT}/${fuzz_target}_seed_corpus.zip" ]; then
28  echo "missing seed corpus"
29  exit 1
30fi
31
32if [ ! -f "${OUT}/${fuzz_target}.dict" ]; then
33  echo "missing dictionary"
34  exit 1
35fi
36
37if [ ! -f "${OUT}/${fuzz_target}.options" ]; then
38  echo "missing options"
39  exit 1
40fi
41