2018-12-20 00:25:05 +00:00
|
|
|
#!/bin/bash -eu
|
|
|
|
# Copyright 2018 Google Inc.
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2019-04-01 00:37:01 +00:00
|
|
|
build_dir=$WORK/build-$SANITIZER
|
|
|
|
install_dir=$WORK/install-$SANITIZER
|
|
|
|
|
|
|
|
mkdir -p $build_dir
|
|
|
|
pushd $build_dir
|
|
|
|
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=$install_dir \
|
2018-12-20 00:25:05 +00:00
|
|
|
-DBUILD_SHARED_LIBS=OFF -DOPENCV_GENERATE_PKGCONFIG=ON \
|
2019-04-01 00:37:01 +00:00
|
|
|
-DOPENCV_GENERATE_PKGCONFIG=ON -DOPENCV_FORCE_3RDPARTY_BUILD=ON \
|
|
|
|
-DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_opencv_apps=OFF \
|
|
|
|
$SRC/opencv
|
2018-12-20 00:25:05 +00:00
|
|
|
make -j$(nproc)
|
|
|
|
make install
|
|
|
|
popd
|
|
|
|
|
2019-04-01 00:37:01 +00:00
|
|
|
pushd $SRC
|
2018-12-20 00:25:05 +00:00
|
|
|
for fuzzer in imdecode_fuzzer imread_fuzzer; do
|
2019-04-30 20:48:34 +00:00
|
|
|
$CXX $CXXFLAGS $LIB_FUZZING_ENGINE $fuzzer.cc -std=c++11 \
|
2019-04-01 00:37:01 +00:00
|
|
|
-I$install_dir/include/opencv4 -L$install_dir/lib \
|
|
|
|
-L$install_dir/lib/opencv4/3rdparty \
|
2018-12-21 06:28:41 +00:00
|
|
|
-lopencv_dnn -lopencv_objdetect -lopencv_photo -lopencv_ml -lopencv_gapi \
|
|
|
|
-lopencv_stitching -lopencv_video -lopencv_calib3d -lopencv_features2d \
|
|
|
|
-lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_imgproc \
|
|
|
|
-lopencv_flann -lopencv_core -llibjpeg-turbo -llibwebp -llibpng -llibtiff \
|
|
|
|
-llibjasper -lIlmImf -llibprotobuf -lquirc -lzlib -littnotify -lippiw \
|
|
|
|
-lippicv -lade -ldl -lm -lpthread -lrt \
|
|
|
|
-o $OUT/$fuzzer
|
2018-12-20 00:25:05 +00:00
|
|
|
done
|
2019-04-01 00:37:01 +00:00
|
|
|
popd
|