aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--projects/mosh/Dockerfile2
-rwxr-xr-xprojects/mosh/build.sh23
2 files changed, 21 insertions, 4 deletions
diff --git a/projects/mosh/Dockerfile b/projects/mosh/Dockerfile
index c3497e91..50fb55d0 100644
--- a/projects/mosh/Dockerfile
+++ b/projects/mosh/Dockerfile
@@ -16,7 +16,7 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y autoconf automake protobuf-compiler \
- libprotobuf-dev pkg-config zlib1g-dev libncurses5-dev libssl-dev clang
+ libprotobuf-dev pkg-config zlib1g-dev libncurses5-dev libssl-dev clang lcov
RUN git clone --depth 1 https://github.com/mobile-shell/mosh.git
WORKDIR mosh
COPY build.sh $SRC/
diff --git a/projects/mosh/build.sh b/projects/mosh/build.sh
index 87526a18..cf6039c0 100755
--- a/projects/mosh/build.sh
+++ b/projects/mosh/build.sh
@@ -19,16 +19,33 @@ set -eu
./autogen.sh
+# Sniff $CXXFLAGS to figure out what to pass to ./configure.
+configure_flags=
+case $CXXFLAGS in
+ *-fsanitize=address*)
+ configure_flags="$configure_flags --enable-asan"
+ ;;
+esac
+case $CXXFLAGS in
+ *-fcoverage*)
+ configure_flags="$configure_flags --enable-code-coverage"
+ ;;
+esac
+
+# Use libstdc++, not libc++, since the base image's prebuild libraries require
+# libstdc++.
+export CXXFLAGS="$CXXFLAGS -stdlib=libstdc++"
+
# Clear CFLAGS and CXXFLAGS during configure tests so configure won't try to
# link with -fsanitize=fuzz.
-CFLAGS= CXXFLAGS= ./configure --enable-fuzzing --enable-asan --enable-static-libraries
+CFLAGS= CXXFLAGS= ./configure --disable-silent-rules --enable-fuzzing --enable-static-libraries $configure_flags
n=$(nproc)
-make -j$n
+make -j$n CFLAGS+="$CFLAGS" CXXFLAGS+="$CXXFLAGS"
cd src/fuzz
-make -j$n
+make -j$n CFLAGS+="$CFLAGS" CXXFLAGS+="$CXXFLAGS"
for fuzzer in *_fuzzer; do
cp $fuzzer $OUT