Last active
January 8, 2022 02:08
-
-
Save ISSOtm/5e03b507e46dbbde9e88b80903f6f6a8 to your computer and use it in GitHub Desktop.
Overhauled PKGBUILD for aseprite-git
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Justin Wong <jusw85 at hotmail dot com> | |
# Contributor: Eldred Habert <[email protected]> | |
# Contributor: Benoit Favre <[email protected]> | |
# Contributor: Alexander Rødseth <[email protected]> | |
# Contributor: Kamil Biduś <[email protected]> | |
# Discussion: https://bbs.archlinux.org/viewtopic.php?pid=1853334#p1853334 | |
pkgname=aseprite-git | |
pkgver=1.3.beta7.r63.g8ec2fff44 | |
pkgrel=2 | |
pkgdesc='Create animated sprites and pixel art' | |
arch=('x86_64' 'i686') | |
url='https://www.aseprite.org/' | |
license=('custom') | |
#depends=('curl' 'libjpeg-turbo' 'giflib' 'tinyxml' 'libxcursor' 'fontconfig' 'hicolor-icon-theme') | |
#makedepends=('git' 'ninja' 'python2' 'clang' 'cmake' 'libglvnd' 'harfbuzz-icu' 'pixman' 'libxi') | |
depends=(# ~ Aseprite's direct dependencies ~ | |
# pixman is not linked to because we use Skia instead | |
# harfbuzz is linked statically because Aseprite expects an older version | |
cmark libcurl.so libgif.so libjpeg.so zlib libpng tinyxml libfreetype.so libarchive.so libfmt.so | |
libwebp.so libwebpmux.so libwebpdemux.so | |
hicolor-icon-theme # For installing Aseprite's icons | |
# ~ Skia deps ~ | |
# (Skia links dynamically to HarfBuzz, only Aseprite itself doesn't. >_<) | |
libexpat.so=1-64 libharfbuzz.so=0-64 libgl | |
# Already required by Aseprite: libjpeg-turbo libpng zlib freetype2 | |
# These two are only reported by Namcap, but don't seem to be direct dependencies? | |
libfontconfig.so libxcursor) | |
makedepends=(# "Meta" dependencies | |
cmake ninja git python gn | |
# Aseprite (including e.g. LAF) | |
libxi pixman | |
# Skia | |
harfbuzz-icu) | |
provides=(aseprite) | |
conflicts=(aseprite) | |
source=("git+https://github.com/aseprite/aseprite.git#branch=beta" # The dev branch is not `main` | |
# Aseprite submodules | |
"git+https://github.com/aseprite/laf.git" | |
"git+https://github.com/aseprite/clip.git" | |
"git+https://github.com/aseprite/flic.git" | |
"git+https://github.com/aseprite/observable.git" | |
"git+https://github.com/aseprite/psd.git" | |
"git+https://github.com/aseprite/tga.git" | |
"git+https://github.com/aseprite/undo.git" | |
"git+https://github.com/aseprite/cityhash.git" | |
"git+https://github.com/aseprite/json11.git" | |
"git+https://github.com/aseprite/pixman.git" | |
"git+https://github.com/aseprite/simpleini.git" | |
"git+https://github.com/aseprite/tinyexpr.git" | |
# LAF submodules | |
"git+https://github.com/aseprite/stringencoders.git" | |
# Skia | |
"git+https://github.com/aseprite/skia.git#branch=aseprite-m96" # The branch is noted in `aseprite/INSTALL.md` | |
desktop.patch | |
shared-fmt.patch | |
# Based on https://patch-diff.githubusercontent.com/raw/aseprite/aseprite/pull/2535.patch | |
shared-libarchive.patch | |
# Based on https://patch-diff.githubusercontent.com/raw/aseprite/aseprite/pull/2523.patch | |
shared-libwebp.patch | |
shared-skia-deps.patch) | |
sha256sums=('SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'SKIP' | |
'8b14e36939e930de581e95abf0591645aa0fcfd47161cf88b062917dbaaef7f9' | |
'821f1354dbbc0bb3fa700e63037ed3c89b0d32bd2ab253450f91eeacd7d47c06' | |
'd7f2f8c43d24382453273ed17b1c0e05928980a36ad0b7c988da3aa0fe32de53' | |
'9ce05287a136d34000b8905e4862500f436bb81afdabb9eba912cd8559359d93' | |
'eb9f544e68b41b5cb1a9ab7a6648db51587e67e94f1a452cb5a84f3d224bf5d0') | |
pkgver() { | |
cd aseprite | |
git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//' | |
} | |
prepare() { | |
# Set up Aseprite's Git submodules | |
local -A _submodules=([laf]=laf | |
[clip]=src/clip | |
[flic]=src/flic | |
[observable]=src/observable | |
[psd]=src/psd | |
[tga]=src/tga | |
[undo]=src/undo | |
[cityhash]=third_party/cityhash | |
[json11]=third_party/json11 | |
[pixman]=third_party/pixman | |
[simpleini]=third_party/simpleini | |
[tinyexpr]=third_party/tinyexpr) _submodule | |
cd aseprite | |
git submodule init "${_submodules[@]}" | |
for _submodule in "${#_submodules[@]}"; do | |
git config "submodule.${_submodules[$_submodule]}.url" "$srcdir/$_submodule" | |
done | |
git submodule update "${_submodules[@]}" | |
# Set up LAF's Git submodules | |
pushd laf | |
git submodule init third_party/stringencoders | |
git config submodule.third_party/stringencoders.url "$srcdir/stringencoders" | |
git submodule update third_party/stringencoders | |
popd | |
# Fix up Aseprite's desktop integration | |
patch -tp1 <../desktop.patch | |
# Use more shared libs | |
patch -tp1 <../shared-fmt.patch | |
patch -tp1 <../shared-libarchive.patch | |
patch -tp1 <../shared-libwebp.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. | |
patch -tp1 <../shared-skia-deps.patch | |
} | |
build() { | |
echo Building Skia... | |
local _skiadir="$PWD/skia/obj" | |
# 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_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,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,FMT,GIFLIB,JPEGLIB,ZLIB,LIBPNG,TINYXML,PIXMAN,FREETYPE,HARFBUZZ,LIBARCHIVE,WEBP}=YES | |
ninja -C build | |
} | |
check() { | |
env -C build ctest --output-on-failure | |
} | |
package() { | |
# Now the fun part: components of e.g. `libwebp` get installed as well, | |
# since we've had to compile it. But we don't want them. | |
# So, install normally, and then cherry-pick Aseprite's files out of that. | |
# Use a whitelist to prefer installing not enough (breakage goes noticed), | |
# instead of too much (cruft rarely goes noticed). Also hope that it doesn't break :) | |
cmake --install build --prefix=staging --strip | |
# Install the binary and its `.desktop` file | |
install -vDm 755 staging/bin/aseprite "$pkgdir/usr/bin/aseprite" | |
install -vDm 644 aseprite/src/desktop/linux/aseprite.desktop "$pkgdir/usr/share/applications/aseprite.desktop" | |
install -vDm 644 aseprite/src/desktop/linux/mime/aseprite.xml "${pkgdir}/usr/share/mime/packages/${_pkgname}.xml" | |
# Install the icons in the correct directory (which is not the default) | |
local _size | |
for _size in 16 32 48 64 128 256; do | |
# The installed icon's name is taken from the `.desktop` file | |
install -vDm 644 staging/share/aseprite/data/icons/ase$_size.png "$pkgdir/usr/share/icons/hicolor/${_size}x$_size/apps/aseprite.png" | |
done | |
# Delete the icons to avoid copying them in two places (they aren't used by Aseprite itself) | |
rm -rf staging/share/aseprite/data/icons | |
# Install all of the program's data | |
cp -vrt "$pkgdir/usr/share" staging/share/aseprite | |
# Also install the licenses | |
install -vDm 644 -t "$pkgdir/usr/share/licenses/$pkgname" aseprite/{EULA.txt,docs/LICENSES.md} | |
# Copy the font's license, but leave it in the font directory as well (probably doesn't hurt) | |
install -vm 644 aseprite/data/fonts/LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/font.txt" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment