xref: /freebsd/contrib/libcbor/oss-fuzz/build.sh (revision abd872540f24cfc7dbd1ea29b6918c7082a22108)
1*abd87254SEd Maste#!/bin/bash -eux
210ff414cSEd Maste# Copyright 2019 Google Inc.
310ff414cSEd Maste#
410ff414cSEd Maste# Licensed under the Apache License, Version 2.0 (the "License");
510ff414cSEd Maste# you may not use this file except in compliance with the License.
610ff414cSEd Maste# You may obtain a copy of the License at
710ff414cSEd Maste#
810ff414cSEd Maste#      http://www.apache.org/licenses/LICENSE-2.0
910ff414cSEd Maste#
1010ff414cSEd Maste# Unless required by applicable law or agreed to in writing, software
1110ff414cSEd Maste# distributed under the License is distributed on an "AS IS" BASIS,
1210ff414cSEd Maste# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1310ff414cSEd Maste# See the License for the specific language governing permissions and
1410ff414cSEd Maste# limitations under the License.
1510ff414cSEd Maste#
1610ff414cSEd Maste################################################################################
1710ff414cSEd Maste
1810ff414cSEd Mastemkdir build
1910ff414cSEd Mastecd build
2010ff414cSEd Maste# We disable libcbor's default sanitizers since we'll be configuring them ourselves via CFLAGS.
215d3e7166SEd Mastecmake -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX="$WORK" -D SANITIZE=OFF ..
2210ff414cSEd Mastemake "-j$(nproc)"
2310ff414cSEd Mastemake install
2410ff414cSEd Maste
2510ff414cSEd Maste$CXX $CXXFLAGS -std=c++11 "-I$WORK/include" \
2610ff414cSEd Maste    ../oss-fuzz/cbor_load_fuzzer.cc -o "$OUT/cbor_load_fuzzer" \
2710ff414cSEd Maste    $LIB_FUZZING_ENGINE src/libcbor.a
2810ff414cSEd Maste
29