1# Dockerfile for building Skia in release mode, using 3rd party libs from DEPS, with SwiftShader. 2FROM gcr.io/skia-public/skia-build-tools:latest 3 4RUN cd /tmp \ 5 && git clone https://swiftshader.googlesource.com/SwiftShader swiftshader 6 7# Checkout Skia. 8RUN mkdir -p /tmp/skia \ 9 && cd /tmp/skia \ 10 && fetch skia 11 12# Set fake identity for git rebase. See thread in 13# https://skia-review.googlesource.com/c/buildbot/+/286537/5/docker/Dockerfile#46 14RUN cd /tmp/skia/skia \ 15 && git config user.email "skia@skia.org" \ 16 && git config user.name "Skia" 17 18# HASH must be specified. 19ARG HASH 20RUN if [ -z "${HASH}" ] ; then echo "HASH must be specified as a --build-arg"; exit 1; fi 21 22RUN cd /tmp/skia/skia \ 23 && git fetch \ 24 && git reset --hard ${HASH} 25 26# If patch ref is specified then update the ref to patch in a CL. 27ARG PATCH_REF 28RUN if [ ! -z "${PATCH_REF}" ] ; then cd /tmp/skia/skia \ 29 && git fetch https://skia.googlesource.com/skia ${PATCH_REF} \ 30 && git checkout FETCH_HEAD \ 31 && git rebase ${HASH}; fi 32 33RUN cd /tmp/skia/skia \ 34 && gclient sync \ 35 && ./bin/fetch-gn 36 37# Write args.gn. 38RUN mkdir -p /tmp/skia/skia/out/Static 39RUN echo ' \n\ 40cc = "clang" \n\ 41cxx = "clang++" \n\ 42skia_use_egl = true \n\ 43is_debug = false \n\ 44skia_use_system_freetype2 = false \n\ 45extra_cflags = [ \n\ 46 "-I/tmp/swiftshader/include", \n\ 47 "-DGR_EGL_TRY_GLES3_THEN_GLES2", \n\ 48 "-g0", \n\ 49] \n\ 50extra_ldflags = [ \n\ 51 "-L/usr/local/lib", \n\ 52 "-Wl,-rpath", \n\ 53 "-Wl,/usr/local/lib" \n\ 54] ' > /tmp/skia/skia/out/Static/args.gn 55 56# Build Skia. 57RUN cd /tmp/skia/skia \ 58 && ./bin/gn gen out/Static \ 59 && git rev-parse HEAD > VERSION \ 60 && /tmp/depot_tools/ninja -C out/Static \ 61 && chown -R skia:skia . 62