1#!/bin/bash -eu 2# Copyright 2017 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 18set -e 19 20if [[ $SANITIZER = *undefined* ]]; then 21 CFLAGS="$CFLAGS -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=unsigned-integer-overflow" 22 CXXFLAGS="$CXXFLAGS -fsanitize=unsigned-integer-overflow -fno-sanitize-recover=unsigned-integer-overflow" 23fi 24 25cd "$WORK" 26mkdir build 27cd build 28 29# Temporarily use gold for linking because of BFD breakage (see 30# https://github.com/google/oss-fuzz/pull/2781). 31ln -f -s /usr/bin/gold /usr/bin/ld 32cmake \ 33 -G"Unix Makefiles" -DBINARY_PACKAGE_BUILD=ON -DWITH_OPENMP=OFF \ 34 -DWITH_PUGIXML=OFF -DUSE_XMLLINT=OFF -DWITH_JPEG=OFF -DWITH_ZLIB=OFF \ 35 -DBUILD_TESTING=OFF -DBUILD_TOOLS=OFF -DBUILD_BENCHMARKING=OFF \ 36 -DCMAKE_BUILD_TYPE=FUZZ -DBUILD_FUZZERS=ON \ 37 -DLIB_FUZZING_ENGINE:STRING="$LIB_FUZZING_ENGINE" \ 38 -DCMAKE_INSTALL_PREFIX:PATH="$OUT" -DCMAKE_INSTALL_BINDIR:PATH="$OUT" \ 39 "$SRC/librawspeed/" 40 41make -j$(nproc) all && make -j$(nproc) install 42 43cd "$SRC" 44rm -rf "$WORK/build" 45