diff options
-rwxr-xr-x | projects/libpsl/build.sh | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/projects/libpsl/build.sh b/projects/libpsl/build.sh index d1b2420d..640194ca 100755 --- a/projects/libpsl/build.sh +++ b/projects/libpsl/build.sh @@ -21,8 +21,13 @@ export CPPFLAGS="-I$DEPS_PATH/include" export LDFLAGS="-L$DEPS_PATH/lib" cd $SRC/icu/source -./configure --disable-shared --enable-static --disable-extras --disable-icuio --disable-layoutex \ - --disable-tests --disable-samples --with-data-packaging=static --prefix=$DEPS_PATH +UBSAN_OPTIONS=detect_leaks=0 \ +CFLAGS="$CFLAGS -fno-sanitize=function,vptr" \ +CXXFLAGS="$CXXFLAGS -fno-sanitize=function,vptr" \ +CPPFLAGS="$CPPFLAGS -fno-sanitize=function,vptr" \ +LDFLAGS="$LDFLAGS -fno-sanitize=undefined" \ + ./configure --disable-shared --enable-static --disable-extras --disable-icuio --disable-layoutex \ + --disable-tests --disable-samples --with-data-packaging=static --prefix=$DEPS_PATH # ugly hack to avoid build error echo '#include <locale.h>' >>i18n/digitlst.h make -j$(nproc) @@ -30,12 +35,14 @@ make install cd $SRC/libunistring ./autogen.sh -./configure --enable-static --disable-shared --prefix=$DEPS_PATH +ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=detect_leaks=0 \ + ./configure --enable-static --disable-shared --prefix=$DEPS_PATH make -j$(nproc) make install cd $SRC/libidn -make CFGFLAGS="--enable-static --disable-shared --disable-doc --prefix=$DEPS_PATH" +ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=detect_leaks=0 \ + make CFGFLAGS="--enable-static --disable-shared --disable-doc --prefix=$DEPS_PATH" make clean make -j1 make -j$(nproc) check @@ -43,38 +50,46 @@ make install cd $SRC/libidn2 ./bootstrap -./configure --enable-static --disable-shared --disable-doc --disable-gcc-warnings --prefix=$DEPS_PATH +ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=detect_leaks=0 \ + ./configure --enable-static --disable-shared --disable-doc --disable-gcc-warnings --prefix=$DEPS_PATH make -j$(nproc) make install -# avoid iconv() memleak on Ubuntu 16.04 image (breaks test suite) -export ASAN_OPTIONS=detect_leaks=0 - cd $SRC/libpsl ./autogen.sh export CXXFLAGS="$CXXFLAGS -L$DEPS_PATH/lib/" -for build in libicu libidn2 libidn none; do +if test $SANITIZER = "undefined"; then + # libicu doesn't work with -fsanitizer=undefined, see projects/icu/project.yaml + builds="libidn2 libidn none" +else + builds="libicu libidn2 libidn none" +fi +for build in $builds; do + XLIBS="" if test $build = "none"; then BUILD_FLAGS="--disable-runtime --disable-builtin" else BUILD_FLAGS="--enable-runtime=$build --enable-builtin=$build" + if test $build = "libicu"; then + XLIBS="-lstdc++" + fi fi - LIBS="-lstdc++" ./configure --enable-static --disable-shared --disable-gtk-doc $BUILD_FLAGS --prefix=$DEPS_PATH + # older m4 iconv detection has memleaks, so switch leak detection off + LIBS=$XLIBS ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=detect_leaks=0 \ + ./configure --enable-static --disable-shared --disable-gtk-doc $BUILD_FLAGS --prefix=$DEPS_PATH make clean make -j$(nproc) make -j$(nproc) check make -C fuzz oss-fuzz + find fuzz -name '*_fuzzer' -exec cp -v '{}' $OUT ';' done cd fuzz find . -name '*_fuzzer.dict' -exec cp -v '{}' $OUT ';' find . -name '*_fuzzer.options' -exec cp -v '{}' $OUT ';' -for fuzzer in *_fuzzer; do - cp -p "${fuzzer}" "$OUT" - - if [ -d "${fuzzer}.in/" ]; then - zip -rj "$OUT/${fuzzer}_seed_corpus.zip" "${fuzzer}.in/" - fi +for dir in *_fuzzer.in; do + fuzzer=$(basename $dir .in) + zip -rj "$OUT/${fuzzer}_seed_corpus.zip" "${dir}/" done |