5 if [ -z "${OUT}" ] || [ -z "${SRC}" ] || [ -z "${WORK}" ]; then
6 echo "OUT, SRC or WORK not set - script expects to be called inside oss-fuzz build env"
10 echo start
at `date -u`
12 #shuffle CXXFLAGS -stdlib=libc++ arg into CXX as well because we use
13 #the CXX as the linker and need to pass -stdlib=libc++ to build
14 export CXX
="$CXX -stdlib=libc++ -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-excludelist.txt"
15 export CC
="$CC -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-excludelist.txt"
16 #similarly force the -fsanitize etc args in as well as pthread to get
17 #things to link successfully during the build
18 export LDFLAGS
="$CFLAGS -Wl,--compress-debug-sections,zlib -lpthread"
23 $SRC/libreoffice
/autogen.sh
--with-distro=LibreOfficeOssFuzz
--with-external-tar=$SRC
27 #build-time rsc tool leaks a titch
28 export ASAN_OPTIONS
="detect_leaks=0"
33 head -c -14 services.rdb
> templateservices.rdb
34 tail -c +85 .
/services
/services.rdb
>> templateservices.rdb
36 #some minimal fonts required
38 mkdir
-p $OUT/$a.fonts
39 tar -x -C $OUT/$a.fonts
--strip-components=1 --wildcards --no-anchored '*.ttf' -f $SRC/liberation-fonts-ttf
*
40 cp $SRC/*opens___.ttf
$OUT/$a.fonts
41 #minimal runtime requirements
42 cp templateservices.rdb
$OUT/$a.services.rdb
43 cp types.rdb
$OUT/$a.types.rdb
44 cp types
/offapi.rdb
$OUT/$a.moretypes.rdb
45 cat > $OUT/$a.unorc
<< EOF
47 URE_INTERNAL_LIB_DIR=\${ORIGIN}
48 UNO_TYPES=\${ORIGIN}/$a.types.rdb \${ORIGIN}/$a.moretypes.rdb
49 UNO_SERVICES=\${ORIGIN}/$a.services.rdb
57 for zip_file
in $SRC/*_seed_corpus.
zip; do
63 cp $SRC/libreoffice
/vcl
/workben
/*.options
$OUT