1# Copyright 2016 Google Inc.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15################################################################################
16
17# Docker image with head clang installed.
18
19FROM gcr.io/oss-fuzz-base/base-image
20
21# Install newer cmake.
22ENV CMAKE_VERSION 3.19.2
23RUN apt-get update && apt-get install -y wget sudo && \
24    wget https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-Linux-x86_64.sh && \
25    chmod +x cmake-$CMAKE_VERSION-Linux-x86_64.sh && \
26    ./cmake-$CMAKE_VERSION-Linux-x86_64.sh --skip-license --prefix="/usr/local" && \
27    rm cmake-$CMAKE_VERSION-Linux-x86_64.sh && \
28    SUDO_FORCE_REMOVE=yes apt-get remove --purge -y wget sudo && \
29    rm -rf /usr/local/doc/cmake /usr/local/bin/cmake-gui
30
31COPY checkout_build_install_llvm.sh /root/
32# Keep all steps in the same script to decrease the number of intermediate
33# layes in docker file.
34RUN /root/checkout_build_install_llvm.sh
35RUN rm /root/checkout_build_install_llvm.sh
36
37# Setup the environment.
38ENV CC "clang"
39ENV CXX "clang++"
40ENV CCC "clang++"
41
42# FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION is described at
43# http://libfuzzer.info#fuzzer-friendly-build-mode
44
45ENV CFLAGS "-O1 -fno-omit-frame-pointer -gline-tables-only -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
46ENV CXXFLAGS_EXTRA "-stdlib=libc++"
47ENV CXXFLAGS "$CFLAGS $CXXFLAGS_EXTRA"
48