Bump version to 6.0-36
[LibreOffice.git] / bin / oss-fuzz-build.sh
blob812d632316bd5009c9d70374e0ac1278079a0244
1 #!/bin/bash -e
3 if [ -z "${OUT}" ] || [ -z "${SRC}" ] || [ -z "${WORK}" ]; then
4 echo "OUT, SRC or WORK not set - script expects to be called inside oss-fuzz build env"
5 exit 1
6 fi
8 #shuffle CXXFLAGS -stdlib=libc++ arg into CXX as well because we use
9 #the CXX as the linker and need to pass -stdlib=libc++ to build
10 export CXX="$CXX -stdlib=libc++"
11 #similarly force the -fsanitize etc args in as well as pthread to get
12 #things to link successfully during the build
13 export LDFLAGS="$CFLAGS -lpthread"
15 cd $WORK
16 $SRC/libreoffice/autogen.sh --with-distro=LibreOfficeOssFuzz --with-external-tar=$SRC
18 #build-time rsc tool leaks a titch
19 export ASAN_OPTIONS="detect_leaks=0"
21 make fuzzers
23 #some minimal fonts required
24 cp $SRC/libreoffice/extras/source/truetype/symbol/opens___.ttf instdir/share/fonts/truetype/Liberation* $OUT
25 #minimal runtime requirements
26 rm -rf $OUT/services $OUT/types $OUT/*rdb
27 mkdir $OUT/services
28 pushd instdir/program
29 cp -r *fuzzer *rc types.rdb types $OUT
30 head -c -14 services.rdb > $OUT/services.rdb
31 tail -c +85 ./services/services.rdb >> $OUT/services.rdb
32 popd
34 #starting corpuses
35 cp $SRC/*_seed_corpus.zip $OUT
36 #fuzzing dictionaries
37 cp $SRC/gif.dict $OUT/giffuzzer.dict
38 cp $SRC/jpeg.dict $OUT/jpgfuzzer.dict
39 cp $SRC/png.dict $OUT/pngfuzzer.dict
40 cp $SRC/tiff.dict $OUT/tiffuzzer.dict
41 cp $SRC/xml.dict $OUT/fodtfuzzer.dict
42 cp $SRC/xml.dict $OUT/fodsfuzzer.dict
43 cp $SRC/xml.dict $OUT/fodpfuzzer.dict
44 cp $SRC/xml.dict $OUT/fodgfuzzer.dict