1#!/bin/bash -eu
2# Copyright 2020 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# build dav1d
19cd ext && bash dav1d.cmd && cd ..
20
21# build libavif
22mkdir build
23cd build
24cmake -G Ninja -DBUILD_SHARED_LIBS=0 -DAVIF_CODEC_DAV1D=1 -DAVIF_LOCAL_DAV1D=1 ..
25ninja
26
27# build fuzzer
28$CXX $CXXFLAGS -std=c++11 -I../include \
29    ../tests/oss-fuzz/avif_decode_fuzzer.cc -o $OUT/avif_decode_fuzzer \
30    $LIB_FUZZING_ENGINE libavif.a ../ext/dav1d/build/src/libdav1d.a
31
32# copy seed corpus
33cp $SRC/avif_decode_seed_corpus.zip $OUT/
34
35# show contents of $OUT/ for sanity checking
36find $OUT/
37