Fix build

Use more recent `gn`
Disable some functionality to broke the build (whether we should enable it back remains TBD)
Change Skia flags to fix up dependencies
Apply patch so missing Skia deps don't break Aseprite's build

Many of these changes were imported from my work on `aseprite-git`
https://github.com/ISSOtm/PKGBUILDs/tree/aseprite-git/aseprite-git
This commit is contained in:
ISSOtm
2022-01-13 19:24:40 +01:00
parent a58e729f86
commit 9078bc1fac
4 changed files with 38 additions and 15 deletions

View File

@@ -32,13 +32,10 @@ makedepends=(# "Meta" dependencies
# Aseprite (including e.g. LAF)
libxi pixman
# Skia
harfbuzz-icu)
gn harfbuzz-icu)
source=("https://github.com/aseprite/aseprite/releases/download/v$pkgver/Aseprite-v$pkgver-Source.zip"
# Which branch a given build of Aseprite requires is noted in its `INSTALL.md`
"git+https://github.com/aseprite/skia.git#branch=aseprite-m96"
# `gn` executable required to configure Skia, pulled from `skia/bin/fetch-gn`
# Normally we'd use the Arch-provided one, but it has API incompatibilities
"gn.zip::https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+/git_revision:d62642c920e6a0d1756316d225a90fd6faa9e21e"
# Skia dependencies, determined from `skia/DEPS`
# Only pulling what we need, though
"git+https://chromium.googlesource.com/chromium/buildtools.git#commit=505de88083136eefd056e5ee4ca0f01fe9b33de8"
@@ -49,16 +46,17 @@ source=("https://github.com/aseprite/aseprite/releases/download/v$pkgver/Aseprit
shared-libarchive.patch
# Based on https://patch-diff.githubusercontent.com/raw/aseprite/aseprite/pull/2523.patch
shared-libwebp.patch
shared-skia-deps.patch
optional-pixman.patch)
noextract=("${source[0]##*/}") # Don't extract Aseprite sources at the root
sha256sums=('966bd940e1072ed24b70e211ca2bb1eb9aa6432ca12972a8e1df5f1e0150213d'
'SKIP'
'0ef7a431fa1bfd2d12edd1f6ceffac7e2b6ed89dcfae9aea9bf681d42a068347'
'SKIP'
'SKIP'
'cb901aaf479bcf1a2406ce21eb31e43d3581712a9ea245672ffd8fbcd9190441'
'e42675504bfbc17655aef1dca957041095026cd3dd4e6981fb6df0a363948aa7'
'2d6b5f33f23adc4f9912511ac35311a776ce34519ef40e9db3659e4c5457f055'
'eb9f544e68b41b5cb1a9ab7a6648db51587e67e94f1a452cb5a84f3d224bf5d0'
'c2d14f9738a96a9db3695c00ac3d14b1312b6a595b151bd56e19422c86517654')
prepare() {
@@ -75,34 +73,36 @@ prepare() {
for _dep in "${!_skiadeps[@]}"; do
ln -svfT "$(realpath $_dep)" "skia/${_skiadeps[$_dep]}"
done
bsdtar -xf gn.zip gn
chmod 755 gn
# Replace `is_clang.py` with Python 3-compliant version
cp -v is_clang.py skia/gn
# Allow using shared libarchive (the bundled version prevents using the `None` build type...)
env -C aseprite patch -tp1 <shared-libarchive.patch
# Allow using shared libarchive (breaks builds otherwise...)
# Allow using shared libwebp (breaks builds otherwise...)
env -C aseprite patch -tp1 <shared-libwebp.patch
# Skip the build-time dependency on Pixman since it doesn't get used in the end
env -C aseprite patch -tp1 <optional-pixman.patch
# Their "FindSkia" module forcefully tries to use Skia's FreeType and HarfBuzz,
# but we don't clone those because we use the shared ones. Avoid overwriting the settings instead.
env -C aseprite patch -tp1 <shared-skia-deps.patch
}
build() {
echo Building Skia...
local _skiadir="$PWD/skia/obj"
# Must use the bundled `gn` executable and HarfBuzz libraries because of incompatibilities
# Flags can typically be found in `src/skia/gn/skia.gni`... but you're kind of on your own
env -C skia ../gn gen "$_skiadir" --args="`printf '%s ' \
is_debug=false is_official_build=true skia_enable_{skottie,pdf}=false \
skia_use_{expat,libwebp,xps,zlib,libgifcodec,sfntly}=false`"
env -C skia gn gen "$_skiadir" --args="`printf '%s ' \
is_debug=false is_official_build=true skia_build_fuzzers=false \
skia_enable_{pdf,skottie,skrive,sksl}=false \
skia_use_{libjpeg_turbo,libwebp}_{encode,decode}=false \
skia_use_{expat,xps,zlib,libgifcodec,sfntly}=false`"
ninja -C "$_skiadir" skia modules
echo Building Aseprite...
# Suppress install messages since we install to a temporary area; `install -v` will do the job
cmake -S aseprite -B build -G Ninja -Wno-dev -DCMAKE_INSTALL_MESSAGE=NEVER -DCMAKE_BUILD_TYPE=None \
-DENABLE_UPDATER=NO -DLAF_WITH_EXAMPLES=OFF -DLAF_WITH_TESTS=OFF -DLAF_OS_BACKEND=skia -DLAF_BACKEND=skia \
-DENABLE_{UPDATER,SCRIPTING,WEBSOCKET}=NO -DLAF_WITH_EXAMPLES=OFF -DLAF_WITH_TESTS=OFF -DLAF_BACKEND=skia \
-DSKIA_DIR="$PWD/skia" -DSKIA_LIBRARY_DIR="$_skiadir" -DSKIA_LIBRARY="$_skiadir/libskia.a" \
-DUSE_SHARED_{CMARK,CURL,GIFLIB,JPEGLIB,ZLIB,LIBPNG,TINYXML,PIXMAN,FREETYPE,HARFBUZZ,LIBARCHIVE,WEBP}=YES
ninja -C build