How to compile Skia on FreeBSD

Mon, Jul 24 2023 11:28:59 KST

Updated 2024.08.26

Download the Skia source code with the following command.

git clone https://skia.googlesource.com/skia

Apply the patch for FreeBSD support.

0001-Support-for-FreeBSD.patch

cd skia
git am ~/Downloads/0001-Support-for-FreeBSD.patch

Run git-sync-deps to download the required source code.

python3 tools/git-sync-deps

Compile with the command:

gn gen out/Static --args='is_debug=false skia_use_fontconfig=true skia_use_freetype=true skia_use_x11=true skia_use_vulkan=true skia_use_dng_sdk=false skia_use_system_libpng=true skia_use_system_zlib=true skia_use_system_icu=true extra_cflags=["-I/usr/local/include", "-I/usr/local/include/harfbuzz", "-I/usr/local/include/freetype2"] extra_ldflags=["-L/usr/local/lib"]'

Try running the following command:

ninja -C out/Static viewer

If you need sk_app try running the following command.

ninja -C out/Static sk_app