1#!/bin/bash -eu 2# Copyright 2019 Google LLC 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 $SRC/myanmar-tools/clients/cpp 19mkdir build 20cd build 21cmake -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \ 22 -DCMAKE_C_FLAGS="$CFLAGS" -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ 23 -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON .. 24make all 25 26# Note: don't use the myanmartools_fuzz CMake target directly because we want 27# to link with LIB_FUZZING_ENGINE instead of the default fuzzer. 28# Copy the .so file to $OUT as well as the executable. 29mkdir -p $OUT/lib 30cp libmyanmartools.so $OUT/lib 31# TODO(https://github.com/google/oss-fuzz/issues/2947): Link in libunwind 32# statically or stop copying if ClusterFuzz bot images get libunwind. 33# Copy libunwind since it isn't on the ClusterFuzz bot images. 34cp /usr/lib/x86_64-linux-gnu/libunwind.so.8 $OUT/lib/ 35$CXX $CXXFLAGS -std=c++11 -I../public -L$OUT/lib \ 36 -Wl,-rpath,'$ORIGIN/lib' -lmyanmartools -lunwind \ 37 -o $OUT/zawgyi_detector_fuzz_target \ 38 ../zawgyi_detector_fuzz_target.cpp \ 39 $LIB_FUZZING_ENGINE 40