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 18echo "Precompiling honggfuzz" 19export BUILD_OSSFUZZ_STATIC=true 20 21PACKAGES=( 22 libunwind8-dev 23 libblocksruntime-dev 24 liblzma-dev 25 libiberty-dev 26 zlib1g-dev 27 pkg-config) 28 29apt-get install -y ${PACKAGES[@]} 30 31pushd $SRC/honggfuzz > /dev/null 32make clean 33# These CFLAGs match honggfuzz's default, with the exception of -mtune to 34# improve portability and `-D_HF_LINUX_NO_BFD` to remove assembly instructions 35# from the filenames. 36CC=clang CFLAGS="-O3 -funroll-loops -D_HF_LINUX_NO_BFD" make 37 38# libhfuzz.a will be added by CC/CXX linker directly during linking, 39# but it's defined here to satisfy the build infrastructure 40ar rcs honggfuzz.a libhfuzz/*.o libhfcommon/*.o 41popd > /dev/null 42 43apt-get remove -y --purge ${PACKAGES[@]} 44apt-get autoremove -y 45echo "Done." 46