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 18cd $WORK/ 19 20CMAKE_SETTINGS=( 21 "-D BUILD_SHARED_LIBS=OFF" # Build static libraries only 22 "-D BUILD_TESTING=OFF" # Or tests 23 "-D OPENEXR_INSTALL_EXAMPLES=OFF" # Or examples 24 "-D OPENEXR_LIB_SUFFIX=" # Don't append the version number to library files 25) 26cmake $SRC/openexr ${CMAKE_SETTINGS[@]} 27make -j$(nproc) 28 29INCLUDES=( 30 "-I $SRC" 31 "-I $SRC/openexr/src/lib/OpenEXRCore" 32 "-I $SRC/openexr/src/lib/OpenEXR" 33 "-I $SRC/openexr/src/lib/OpenEXRUtil" 34 "-I $WORK/cmake" 35) 36 37LIBS=( 38 "$WORK/src/lib/OpenEXRUtil/libOpenEXRUtil.a" 39 "$WORK/src/lib/OpenEXR/libOpenEXR.a" 40 "$WORK/src/lib/OpenEXRCore/libOpenEXRCore.a" 41 "$WORK/src/lib/IlmThread/libIlmThread.a" 42 "$WORK/src/lib/Iex/libIex.a" 43 "$WORK/_deps/imath-build/src/Imath/libImath*.a" 44) 45 46for fuzzer in $SRC/openexr/src/test/OpenEXRFuzzTest/oss-fuzz/*_fuzzer.cc; do 47 fuzzer_basename=$(basename -s .cc $fuzzer) 48 $CXX $CXXFLAGS -std=c++11 -pthread ${INCLUDES[@]} $fuzzer $LIB_FUZZING_ENGINE ${LIBS[@]} -lz \ 49 -o $OUT/$fuzzer_basename 50done 51