• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
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# Build dependencies.
19export DEPS_PATH=$SRC/deps
20mkdir -p $DEPS_PATH
21
22cd $SRC/x265/build/linux
23cmake -G "Unix Makefiles" \
24    -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
25    -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
26    -DCMAKE_INSTALL_PREFIX="$DEPS_PATH" \
27    -DENABLE_SHARED:bool=off \
28    ../../source
29make clean
30make -j$(nproc) x265-static
31make install
32
33cd $SRC/libde265
34./autogen.sh
35./configure \
36    --prefix="$DEPS_PATH" \
37    --disable-shared \
38    --enable-static \
39    --disable-dec265 \
40    --disable-sherlock265 \
41    --disable-hdrcopy \
42    --disable-enc265 \
43    --disable-acceleration_speed
44make clean
45make -j$(nproc)
46make install
47
48mkdir -p $SRC/aom/build/linux
49cd $SRC/aom/build/linux
50cmake -G "Unix Makefiles" \
51  -DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
52  -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \
53  -DCMAKE_INSTALL_PREFIX="$DEPS_PATH" \
54  -DENABLE_SHARED:bool=off -DCONFIG_PIC=1 \
55  -DENABLE_EXAMPLES=0 -DENABLE_DOCS=0 -DENABLE_TESTS=0 \
56  -DCONFIG_SIZE_LIMIT=1 \
57  -DDECODE_HEIGHT_LIMIT=12288 -DDECODE_WIDTH_LIMIT=12288 \
58  -DDO_RANGE_CHECK_CLAMP=1 \
59  -DAOM_MAX_ALLOCABLE_MEMORY=536870912 \
60  -DAOM_TARGET_CPU=generic \
61  ../../
62make clean
63make -j$(nproc)
64make install
65
66# Remove shared libraries to avoid accidental linking against them.
67rm -f $DEPS_PATH/lib/*.so
68rm -f $DEPS_PATH/lib/*.so.*
69
70cd $SRC/libheif
71./autogen.sh
72PKG_CONFIG="pkg-config --static" PKG_CONFIG_PATH="$DEPS_PATH/lib/pkgconfig" ./configure \
73    --disable-shared \
74    --enable-static \
75    --disable-examples \
76    --disable-go \
77    --enable-libfuzzer="$LIB_FUZZING_ENGINE" \
78    CPPFLAGS="-I$DEPS_PATH/include"
79make clean
80make -j$(nproc)
81
82cp libheif/*-fuzzer $OUT
83cp fuzzing/dictionary.txt $OUT/box-fuzzer.dict
84cp fuzzing/dictionary.txt $OUT/file-fuzzer.dict
85
86zip -r $OUT/file-fuzzer_seed_corpus.zip fuzzing/corpus/*.heic
87