From a4b1f6c2a5cb018cf81ae92efae4e63fb7036325 Mon Sep 17 00:00:00 2001 From: Mike Aizatsky Date: Sat, 6 Aug 2016 11:11:39 -0700 Subject: [PATCH] [infra] moved env variables into Dockerfiles --- expat/build.sh | 2 +- infra/base-images/base-clang/Dockerfile | 13 +++++++++---- infra/base-images/base-clang/env | 4 +--- infra/base-images/base-libfuzzer/Dockerfile | 3 +++ 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/expat/build.sh b/expat/build.sh index ea3dc3b02..78ab6aa2e 100755 --- a/expat/build.sh +++ b/expat/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash -ex +#!/bin/bash -eu . /env cd /src/expat/expat diff --git a/infra/base-images/base-clang/Dockerfile b/infra/base-images/base-clang/Dockerfile index 7c04b71a3..99ea4fd6c 100644 --- a/infra/base-images/base-clang/Dockerfile +++ b/infra/base-images/base-clang/Dockerfile @@ -38,21 +38,26 @@ WORKDIR /work/llvm RUN cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON /src/llvm RUN ninja RUN ninja install -RUN rm -rf /work/llvm +# Copy libfuzzer sources RUN mkdir /src/libfuzzer RUN cp -r /src/llvm/lib/Fuzzer/* /src/libfuzzer/ + +# Cleanup +RUN rm -rf /work/llvm RUN rm -rf /src/llvm - -# RUN ln -s /work/llvm/bin/lld /work/llvm/bin/ld - RUN apt-get remove --purge -y $LLVM_DEP_PACKAGES RUN apt-get autoremove -y +# Setup the environment. ENV CC "clang" ENV CXX "clang++" ENV CCC "clang++" ENV CFLAGS "-g" +ENV CXXFLAGS_EXTRA "-stdlib=libc++" +ENV CXXFLAGS "$CFLAGS $CXXFLAGS_EXTRA" + +ENV LDFLAGS "-Wl,-Bstatic -lc++ -lc++abi -Wl,-Bdynamic" COPY env / diff --git a/infra/base-images/base-clang/env b/infra/base-images/base-clang/env index cf0f1fbaa..4cdc2df64 100644 --- a/infra/base-images/base-clang/env +++ b/infra/base-images/base-clang/env @@ -27,10 +27,8 @@ $CXX -g -std=c++11 -stdlib=libc++ $sanitizer_flags -c /src/libfuzzer/*.cpp -I/sr echo "Done." popd > /dev/null -export CFLAGS="-g $sanitizer_flags $cov_flags" -export LDFLAGS="-Wl,-Bstatic -lc++ -lc++abi -Wl,-Bdynamic" export LIBCXX_FLAGS="-stdlib=libc++" -export CXXFLAGS="$CFLAGS $LIBCXX_FLAGS " +export CXXFLAGS="$CFLAGS $LIBCXX_FLAGS" echo "CC=$CC" echo "CXX=$CXX" diff --git a/infra/base-images/base-libfuzzer/Dockerfile b/infra/base-images/base-libfuzzer/Dockerfile index 3abd675e9..8fd973242 100644 --- a/infra/base-images/base-libfuzzer/Dockerfile +++ b/infra/base-images/base-libfuzzer/Dockerfile @@ -28,5 +28,8 @@ ENV cov_flags="-fsanitize-coverage=edge,indirect-calls,8bit-counters" ENV ASAN_OPTIONS="symbolize=1" +ENV CFLAGS "$CFLAGS $sanitizer_flags $cov_flags" +ENV CXXFLAGS "$CFLAGS $CXXFLAGS_EXTRA" + RUN mkdir /out VOLUME /out