summaryrefslogtreecommitdiff
path: root/bin/oss-fuzz-build.sh
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-09 10:23:54 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-09 10:28:31 +0000
commitec01a46ea3520f9086d0ce6fae05f763ce5cb533 (patch)
tree107ae6b8a0b70779e26ea9883a8ec21d64da5fd4 /bin/oss-fuzz-build.sh
parent77779166569da389de44075b3d03413b353046a4 (diff)
put the oss build script into our own git
Change-Id: Ifeabee60c18afa88403e1c92d01a01b545ed6570
Diffstat (limited to 'bin/oss-fuzz-build.sh')
-rwxr-xr-xbin/oss-fuzz-build.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/bin/oss-fuzz-build.sh b/bin/oss-fuzz-build.sh
new file mode 100755
index 000000000000..c4084b5893f5
--- /dev/null
+++ b/bin/oss-fuzz-build.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -eu
+
+#shuffle CXXFLAGS -stdlib=libc++ arg into CXX as well because we use
+#the CXX as the linker and need to pass -stdlib=libc++ to build
+export CXX="$CXX -stdlib=libc++"
+#similarly force the -fsanitize etc args in as well as pthread to get
+#things to link successfully during the build
+export LDFLAGS="$CFLAGS -lpthread"
+
+cd $WORK
+$SRC/libreoffice/autogen.sh --with-distro=LibreOfficeOssFuzz --with-external-tar=$SRC
+
+#build-time rsc tool leaks a titch
+export ASAN_OPTIONS="detect_leaks=0"
+
+make fuzzers
+
+#some minimal fonts required
+cp $SRC/libreoffice/extras/source/truetype/symbol/opens___.ttf instdir/share/fonts/truetype/Liberation* $OUT
+#minimal runtime requirements
+rm -rf $OUT/services $OUT/types $OUT/resource $OUT/*rdb
+pushd instdir/program
+cp -r *fuzzer *rc *rdb services types resource $OUT
+mv $OUT/services/services.rdb $OUT/services.rdb
+popd
+
+#starting corpuses
+cp $SRC/*_seed_corpus.zip $OUT