Skip to content

Building on Linux

Matthew Leibowitz edited this page Mar 25, 2018 · 42 revisions

As of v1.60.1 (yet to be released), building libSkiaSharp.so is very easy and does not even require the mono/SkiaSharp repository. However, it is best to just clone the mono/SkiaSharp repository as it also pulls down additional tools used to build skia, namely depot_tools.

Prior to v1.60.1, use the "Building on Linux (LEGACY)" guide.

Downloading

The first step is to clone the mono/skia repository:

$ git clone https://github.com/mono/skia.git -b v1.60.1

To build the current master, check out xamarin-mobile-bindings as this is the Xamarin "master" - the master branch is reserved for the Google "master".

In order to build libSkiaSharp, Google's depot_tools is also required:

$ https://chromium.googlesource.com/chromium/tools/depot_tools.git

Building

Once skia and depot_tools are cloned, building happens in 3 steps:

$ cd skia
$ python tools/git-sync-deps
$ ./bin/gn 'out/Linux/x64' --args='
        $"  is_official_build=true skia_enable_tools=false" +
        $"  target_os=\"linux\" target_cpu=\"{arch}\"" +
        $"  skia_use_icu=false skia_use_sfntly=false skia_use_piex=true" +
        $"  skia_use_system_expat=false skia_use_system_freetype2=false skia_use_system_libjpeg_turbo=false skia_use_system_libpng=false skia_use_system_libwebp=false skia_use_system_zlib=false" +
        $"  skia_enable_gpu={(SUPPORT_GPU ? "true" : "false")}" +
        $"  extra_cflags=[ \"-DSKIA_C_DLL\" ]" +
        $"  extra_ldflags=[ ]" +
        $"  linux_soname_version=\"{soname}\"" +'
$ ../depot_tools/ninja 'SkiaSharp' -C 'out/Linux/x64'