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 17FROM gcr.io/oss-fuzz-base/base-builder 18MAINTAINER kjlubick@chromium.org 19 20# Mesa needed to build swiftshader 21RUN apt-get update && apt-get install -y python wget libglu1-mesa-dev cmake 22 23RUN git clone 'https://chromium.googlesource.com/chromium/tools/depot_tools.git' --depth 1 24ENV PATH="${SRC}/depot_tools:${PATH}" 25 26RUN git clone https://skia.googlesource.com/skia.git --depth 1 27 28# current directory for build script 29WORKDIR skia 30 31RUN bin/sync 32 33# Setup SwiftShader 34WORKDIR $SRC/skia/third_party/externals/swiftshader/ 35# TODO(metzman): Come up with a better long term solution, such as downloading 36# prebuilt libraries, than pinning swiftshader to a known working revision. 37RUN git checkout bf8fd5b5fb6892dabcc21b4b86d41cd40cb9b4b5 38RUN git submodule update --init 39WORKDIR $SRC/skia 40 41RUN wget -O $SRC/skia/image_filter_deserialize_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/image_filter_deserialize_seed_corpus.zip 42 43RUN wget -O $SRC/skia/region_set_path_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/region_set_path_seed_corpus.zip 44 45RUN wget -O $SRC/skia/textblob_deserialize_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/textblob_deserialize_seed_corpus.zip 46 47RUN wget -O $SRC/skia/path_deserialize_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/path_deserialize_seed_corpus.zip 48 49RUN wget -O $SRC/skia/image_decode_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/image_decode_seed_corpus.zip 50 51RUN wget -O $SRC/skia/animated_image_decode_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/animated_image_decode_seed_corpus.zip 52 53RUN wget -O $SRC/skia/api_draw_functions_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_draw_functions_seed_corpus.zip 54 55RUN wget -O $SRC/skia/api_gradients_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_gradients_seed_corpus.zip 56 57RUN wget -O $SRC/skia/api_image_filter_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_image_filter_seed_corpus.zip 58 59RUN wget -O $SRC/skia/api_path_measure_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_path_measure_seed_corpus.zip 60 61RUN wget -O $SRC/skia/api_pathop_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_pathop_seed_corpus.zip 62 63RUN wget -O $SRC/skia/canvas_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/canvas_seed_corpus.zip 64 65RUN wget -O $SRC/skia/encoder_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/encoder_seed_corpus.zip 66 67RUN wget -O $SRC/skia/skottie_json_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/skottie_json_seed_corpus.zip 68 69RUN wget -O $SRC/skia/skjson_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/skjson_seed_corpus.zip 70 71RUN wget -O $SRC/skia/api_polyutils_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_polyutils_seed_corpus.zip 72 73RUN wget -O $SRC/skia/sksl_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/sksl_seed_corpus.zip 74 75RUN wget -O $SRC/skia/api_skdescriptor_seed_corpus.zip https://storage.googleapis.com/skia-fuzzer/oss-fuzz/api_skdescriptor_seed_corpus.zip 76 77COPY build.sh $SRC/ 78 79COPY skia.diff $SRC/skia/skia.diff 80RUN git apply skia.diff 81 82COPY region_deserialize.options $SRC/skia/region_deserialize.options 83COPY region_set_path.options $SRC/skia/region_set_path.options 84COPY image_filter_deserialize.options $SRC/skia/image_filter_deserialize.options 85COPY image_filter_deserialize_width.options $SRC/skia/image_filter_deserialize_width.options 86COPY textblob_deserialize.options $SRC/skia/textblob_deserialize.options 87COPY path_deserialize.options $SRC/skia/path_deserialize.options 88COPY encoder.options $SRC/skia/encoder.options 89COPY skdescriptor_deserialize.options $SRC/skia/skdescriptor_deserialize.options 90 91# Codec fuzzers can share options 92COPY image_codec.options $SRC/skia/android_codec.options 93COPY image_codec.options $SRC/skia/animated_image_decode.options 94COPY image_codec.options $SRC/skia/image_decode.options 95COPY image_codec.options $SRC/skia/image_decode_incremental.options 96 97# API fuzzers can share options 98COPY api_fuzzers.options $SRC/skia/api_draw_functions.options 99COPY api_fuzzers.options $SRC/skia/api_gradients.options 100COPY api_fuzzers.options $SRC/skia/api_image_filter.options 101COPY api_fuzzers.options $SRC/skia/api_mock_gpu_canvas.options 102COPY api_fuzzers.options $SRC/skia/api_null_canvas.options 103COPY api_fuzzers.options $SRC/skia/api_path_measure.options 104COPY api_fuzzers.options $SRC/skia/api_pathop.options 105COPY api_fuzzers.options $SRC/skia/api_polyutils.options 106COPY api_fuzzers.options $SRC/skia/api_raster_n32_canvas.options 107COPY api_fuzzers.options $SRC/skia/api_skdescriptor.options 108 109# SKSL fuzzers can share options 110COPY sksl.options $SRC/skia/sksl2glsl.options 111COPY sksl.options $SRC/skia/sksl2spirv.options 112COPY sksl.options $SRC/skia/sksl2metal.options 113COPY sksl.options $SRC/skia/sksl2pipeline.options 114 115COPY json.dict $SRC/skia/json.dict 116 117COPY BUILD.gn.diff $SRC/skia/BUILD.gn.diff 118RUN cat BUILD.gn.diff >> BUILD.gn 119