text: # Copyright 2020 Google LLC
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  # http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  ARG parent_image
  FROM $parent_image
  
  # Install wget to download afl_driver.cpp. Install libstdc++ to use llvm_mode.
  RUN apt-get update && \
      apt-get install -y wget libstdc++-5-dev libtool-bin automake flex bison \
                         libglib2.0-dev libpixman-1-dev python3-setuptools unzip \
                         apt-utils apt-transport-https ca-certificates
  
  # Download and compile afl++ (v2.62d).
  # Build without Python support as we don't need it.
  # Set AFL_NO_X86 to skip flaky tests.
  RUN git clone https://github.com/AFLplusplus/AFLplusplus.git /afl && \
      cd /afl && \
      git checkout 688e2c87df90cc63032aa4d1961493f52ebbd3c5 && \
      sed -i 's/HAVOC_MAX_MULT.*16/HAVOC_MAX_MULT 32/' include/config.h && \
      unset CFLAGS && unset CXXFLAGS && export CC=clang && \
      AFL_NO_X86=1 PYTHON_INCLUDE=/ make && make install && \
      make -C examples/aflpp_driver && \
      cp examples/aflpp_driver/libAFLDriver.a /
  