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 && ./bin/fetch-ninja 37 38# Write args.gn. 39RUN mkdir -p /tmp/skia/skia/out/Static 40RUN echo ' \n\ 41cc = "clang" \n\ 42cxx = "clang++" \n\ 43skia_use_egl = true \n\ 44is_debug = false \n\ 45skia_use_system_freetype2 = false \n\ 46extra_cflags = [ \n\ 47 "-I/tmp/swiftshader/include", \n\ 48 "-DGR_EGL_TRY_GLES3_THEN_GLES2", \n\ 49 "-g0", \n\ 50] \n\ 51extra_ldflags = [ \n\ 52 "-L/usr/local/lib", \n\ 53 "-Wl,-rpath", \n\ 54 "-Wl,/usr/local/lib" \n\ 55] ' > /tmp/skia/skia/out/Static/args.gn 56 57# Build Skia. 58RUN cd /tmp/skia/skia \ 59 && ./bin/gn gen out/Static \ 60 && git rev-parse HEAD > VERSION \ 61 && ./bin/ninja -C out/Static \ 62 && chown -R skia:skia . \ 63 # obj is readable only by the skia user. It needs additional 64 # permissions to be accessible for CI (see https://review.skia.org/487217). 65 && chmod 755 -R out/Static/obj \ 66 # Cleanup .git directories because they are not needed and take up space. 67 && find . -name .git -print0 | xargs -0 rm -rf 68