1#!/bin/bash -eu 2# Copyright 2016 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 18# Disable: 19# 1. UBSan vptr since target built with -fno-rtti. 20export CFLAGS="$CFLAGS -fno-sanitize=vptr -DHB_NO_VISIBILITY" 21export CXXFLAGS="$CXXFLAGS -fno-sanitize=vptr -DHB_NO_VISIBILITY" 22 23# setup 24build=$WORK/build 25 26# cleanup 27rm -rf $build 28mkdir -p $build 29 30# Build the library. 31meson --default-library=static --wrap-mode=nodownload \ 32 -Dexperimental_api=true \ 33 -Dfuzzer_ldflags="$(echo $LIB_FUZZING_ENGINE)" \ 34 $build \ 35 || (cat build/meson-logs/meson-log.txt && false) 36 37# Build the fuzzers. 38ninja -v -j$(nproc) -C $build test/fuzzing/hb-{shape,draw,subset,set}-fuzzer 39mv $build/test/fuzzing/hb-{shape,draw,subset,set}-fuzzer $OUT/ 40 41# Archive and copy to $OUT seed corpus if the build succeeded. 42mkdir all-fonts 43for d in \ 44 test/shape/data/in-house/fonts \ 45 test/shape/data/aots/fonts \ 46 test/shape/data/text-rendering-tests/fonts \ 47 test/api/fonts \ 48 test/fuzzing/fonts \ 49 perf/fonts \ 50 ; do 51 cp $d/* all-fonts/ 52done 53zip $OUT/hb-shape-fuzzer_seed_corpus.zip all-fonts/* 54cp $OUT/hb-shape-fuzzer_seed_corpus.zip $OUT/hb-draw-fuzzer_seed_corpus.zip 55cp $OUT/hb-shape-fuzzer_seed_corpus.zip $OUT/hb-subset-fuzzer_seed_corpus.zip 56zip $OUT/hb-set-fuzzer_seed_corpus.zip ./test/fuzzing/sets/* 57