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"
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++ -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-blacklist.txt"
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"
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"
24 head -c -14 services.rdb
> templateservices.rdb
25 tail -c +85 .
/services
/services.rdb
>> templateservices.rdb
27 #some minimal fonts required
29 mkdir
-p $OUT/$a.fonts
30 cp $SRC/libreoffice
/extras
/source
/truetype
/symbol
/opens___.ttf ..
/share
/fonts
/truetype
/Liberation
* $OUT/$a.fonts
31 #minimal runtime requirements
32 cp templateservices.rdb
$OUT/$a.services.rdb
33 cp types.rdb
$OUT/$a.types.rdb
34 cp types
/offapi.rdb
$OUT/$a.moretypes.rdb
35 cat > $OUT/$a.unorc
<< EOF
37 URE_INTERNAL_LIB_DIR=\${ORIGIN}
38 UNO_TYPES=\${ORIGIN}/$a.types.rdb \${ORIGIN}/$a.moretypes.rdb
39 UNO_SERVICES=\${ORIGIN}/$a.services.rdb
45 cp $SRC/*_seed_corpus.
zip $OUT
49 cp $SRC/libreoffice
/vcl
/workben
/*.options
$OUT