aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/mosh/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'projects/mosh/build.sh')
-rwxr-xr-xprojects/mosh/build.sh23
1 files changed, 20 insertions, 3 deletions
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