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"
12 local do_df
="$1"; shift
13 echo "[[" `date -u` "]]" "build -" "$@"
14 if [ "$do_df" != "0" ]; then
20 echo git
: `git -C $SRC/libreoffice log -1 --pretty=reference`
22 #shuffle CXXFLAGS -stdlib=libc++ arg into CXX as well because we use
23 #the CXX as the linker and need to pass -stdlib=libc++ to build
24 export CXX
="$CXX -stdlib=libc++ -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-excludelist.txt"
25 export CXX_FOR_BUILD
="$CXX"
26 export CC
="$CC -fsanitize-blacklist=$SRC/libreoffice/bin/sanitize-excludelist.txt"
27 export CC_FOR_BUILD
="$CC"
28 #similarly force the -fsanitize etc args in as well as pthread to get
29 #things to link successfully during the build
30 export LDFLAGS
="$CFLAGS -Wl,--compress-debug-sections,zlib -lpthread"
31 #build-time concat-deps tool leaks a titch
32 export ASAN_OPTIONS
="detect_leaks=0"
35 if [ -f Makefile
]; then
40 print_stamp
0 autogen.sh
41 $SRC/libreoffice
/autogen.sh
--with-distro=LibreOfficeOssFuzz
--with-external-tar=$SRC/external-tar
46 print_stamp
1 prepare
'$OUT'
49 # skip last 14 bytes of 1st, and first 85 of 2nd to just skip the
50 # xml tags to merge these into a single xml file
51 head -c -14 services.rdb
> templateservices.rdb
52 tail -c +85 .
/services
/services.rdb
>> templateservices.rdb
54 #some minimal fonts required
56 mkdir
-p $OUT/$a.fonts
57 tar -x -C $OUT/$a.fonts
--strip-components=1 --wildcards --no-anchored '*.ttf' -f $SRC/external-tar
/liberation-fonts-ttf
*
58 cp $SRC/external-tar
/*opens___.ttf
$OUT/$a.fonts
59 #minimal runtime requirements
60 cp templateservices.rdb
$OUT/$a.services.rdb
61 cp types.rdb
$OUT/$a.types.rdb
62 cp types
/offapi.rdb
$OUT/$a.moretypes.rdb
63 cat > $OUT/$a.unorc
<< EOF
65 URE_INTERNAL_LIB_DIR=\${ORIGIN}
66 UNO_TYPES=\${ORIGIN}/$a.types.rdb \${ORIGIN}/$a.moretypes.rdb
67 UNO_SERVICES=\${ORIGIN}/$a.services.rdb
73 for zip_file
in $SRC/*_seed_corpus.
zip; do
81 cp $SRC/libreoffice
/vcl
/workben
/*.options
$OUT