generated from archlinux/template
195 lines
9.9 KiB
Bash
195 lines
9.9 KiB
Bash
# Maintainer: Imperator Storm <ImperatorStorm11@protonmail.com>
|
|
# Maintainer: Eldred Habert <me@eldred.fr>
|
|
# Contributor: Fredrick Brennan <copypaste@kittens.ph>
|
|
# Contributor: Andrew Bueide <abueide@protonmail.com>
|
|
# Contributor: rouhannb <rouhannb@protonmail.com>
|
|
# Contributor: Wilson E. Alvarez <wilson.e.alvarez1@gmail.com>
|
|
# Contributor: Benoit Favre <benoit.favre@gmail.com>
|
|
# Contributor: Alexander Rødseth <rodseth@gmail.com>
|
|
# Contributor: Kamil Biduś <kamil.bidus@gmail.com>
|
|
# Contributor: Jomar Milan <jomarm@jomarm.com>
|
|
|
|
pkgname=aseprite
|
|
pkgver=1.3.13
|
|
_skiaver=m102
|
|
_skiahash=861e4743af
|
|
pkgrel=10
|
|
pkgdesc='Create animated sprites and pixel art'
|
|
arch=('x86_64')
|
|
url="https://www.aseprite.org/"
|
|
license=('LicenseRef-Aseprite-EULA')
|
|
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 'tinyxml2>=11.0.0' 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
|
|
# Aseprite (including e.g. LAF)
|
|
libxi
|
|
# Skia
|
|
gn harfbuzz-icu
|
|
# TODO: Benchmark clang v gcc
|
|
# Fuck it, compiling with GCC>=13 is broken and I'm not gonna write a patch to fix it
|
|
clang
|
|
)
|
|
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`
|
|
"skia-$_skiaver.tar.gz::https://github.com/aseprite/skia/archive/refs/tags/$_skiaver-$_skiahash.tar.gz"
|
|
aseprite-strings::git+https://github.com/aseprite/strings.git#commit=5499ce2030d831c614f1ce7fdfdaf36a973c21f8
|
|
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
|
|
optional-pixman.patch
|
|
fix-shared-tinyxml2.patch
|
|
shared-libwebp-found.patch
|
|
include_cstdint.patch)
|
|
noextract=("Aseprite-v$pkgver-Source.zip"
|
|
"skia-$_skiaver.tar.gz") # Don't extract Aseprite or skia sources at the root
|
|
sha256sums=('c2e639c083d99a5a478ded7c86d9d7f4e4ff9ebebf6fedac7f8bfc94d6bd94c1'
|
|
'8d76c1ad3693e1fc019eb14d806082148eb4ed7d601474aeeaae601b05a9b3ad'
|
|
'8ee87f57b5792e5751f63fe37cdda8d29053cd4449e1f533e792e15abcfefa79'
|
|
'8b14e36939e930de581e95abf0591645aa0fcfd47161cf88b062917dbaaef7f9'
|
|
'c3591d376180d99ff8001c3d549c0bd18ef5e4d95f1755ccaa8e2fd65dd5d2b3'
|
|
'89cd28a5a90ee9dd42e85866b6f954bde526068d94311b0730a62f00f9cfffdb'
|
|
'0f8adb959d7000697af453d6cf5aaf9984b74868008382aad541d2c29871c751'
|
|
'eb9f544e68b41b5cb1a9ab7a6648db51587e67e94f1a452cb5a84f3d224bf5d0'
|
|
'c2d14f9738a96a9db3695c00ac3d14b1312b6a595b151bd56e19422c86517654'
|
|
'ba02fc060dc930cfd66a8903a5d8a59f981753bdf416e91cc77a48c56c86aea3'
|
|
'72605d6760c29eb98f2d8d8cf2cc9f9f7d7655bcf7cfc944f6a46b0957adbb14'
|
|
'ce20c8caa61b0e4b478eb08853e1148eba76836027ec04cf5d0f76c4db9ae112')
|
|
_debug="false"
|
|
prepare() {
|
|
# Extract Aseprite's sources
|
|
mkdir -p aseprite
|
|
bsdtar -xf "${noextract[0]}" -C aseprite
|
|
# Extract Skia's sources
|
|
mkdir -p skia
|
|
bsdtar xf skia-$_skiaver.tar.gz --strip-components=1 -C skia
|
|
# Fix up Aseprite's desktop integration
|
|
[[ -n $_debug ]] && echo desktop.patch
|
|
env -C aseprite patch -tp1 <desktop.patch
|
|
# Allow using more shared libs
|
|
[[ -n $_debug ]] && echo shared-fmt.patch
|
|
env -C aseprite patch -tp1 <shared-fmt.patch
|
|
[[ -n $_debug ]] && echo shared-libarchive.patch
|
|
env -C aseprite patch -tp1 <shared-libarchive.patch
|
|
[[ -n $_debug ]] && echo shared-libwebp.patch
|
|
env -C aseprite patch -tp1 <shared-libwebp.patch
|
|
[[ -n $_debug ]] && echo shared-pixman.patch
|
|
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.
|
|
[[ -n $_debug ]] && echo shared-skia-deps.patch
|
|
env -C aseprite patch -tp1 <shared-skia-deps.patch
|
|
# TinyEXIF cannot find tinyxml2 otherwise
|
|
[[ -n $_debug ]] && echo fix-shared-tinyxml2.patch
|
|
env -C aseprite/third_party/TinyEXIF patch -tp1 <fix-shared-tinyxml2.patch
|
|
[[ -n $_debug ]] && echo shared-libwebp-found.patch
|
|
env -C aseprite patch -tp1 <shared-libwebp-found.patch
|
|
[[ -n $_debug ]] && echo include_cstdint.patch
|
|
patch -tp1 <include_cstdint.patch
|
|
}
|
|
|
|
build() {
|
|
echo Building Skia...
|
|
local _skiadir="$PWD/skia/obj"
|
|
export CXX=clang++
|
|
export CC=clang
|
|
export AR=ar
|
|
export NM=nm
|
|
# Flags can be found by running `gn args --list "$_skiadir"` from skia's directory.
|
|
# (Pipe the output somewhere, there's a LOT of args.)
|
|
#
|
|
# The flags are chosen to provide the API required by Aseprite and nothing else (if possible),
|
|
# so as to reduce the compilation time and final binary size.
|
|
#
|
|
# Individual rationales:
|
|
# is_official_build: Suggested by the build instructions.
|
|
# skia_build_fuzzers: We don't care about them.
|
|
# skia_enable_pdf: Not used by Aseprite.
|
|
# skia_enable_skottie: Not used by Aseprite.
|
|
# skia_enable_sksl: laf seems to want to use it... but no references are made anywhere.
|
|
# skia_enable_svg: Not used by Aseprite. It seems it has its own SVG exporter.
|
|
# skia_use_lib*_{encode,decode}: Aseprite only loads PNG assets, so only libpng is required.
|
|
# skia_use_expat: Only required for the Android font manager and SVGCanvas/SVGDevice.
|
|
# skia_use_piex: Not used by Aseprite. Only used for reading RAW files.
|
|
# skia_use_xps: Not used outside of Windows.
|
|
# skia_use_zlib: Only used for PDF and RAW files.
|
|
# skia_use_libgifcodec: Only used for GIFs, which Aseprite doesn't use.
|
|
# skia_enable_{particles,skparagraph,sktext}: Aseprite does not link against this library.
|
|
|
|
# gn is bad software
|
|
env -C skia gn gen "$_skiadir" --args='is_official_build=true skia_build_fuzzers=false skia_enable_pdf=false skia_enable_skottie=false skia_enable_sksl=false skia_enable_svg=false skia_use_libjpeg_turbo_encode=false skia_use_libjpeg_turbo_decode=false skia_use_libwebp_encode=false skia_use_libwebp_decode=false skia_use_expat=false skia_use_piex=false skia_use_xps=false skia_use_zlib=false skia_use_libgifcodec=false skia_enable_particles=false skia_enable_skparagraph=false skia_enable_sktext=false cc="clang" cxx="clang++"'
|
|
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=OFF -DENABLE_{SCRIPTING,WEBSOCKET}=ON \
|
|
-DLAF_WITH_{EXAMPLES,TESTS}=OFF -DLAF_BACKEND=skia \
|
|
-DSKIA_DIR="$PWD/skia" -DSKIA_LIBRARY_DIR="$_skiadir" \
|
|
-DUSE_SHARED_{CMARK,CURL,FMT,GIFLIB,JPEGLIB,ZLIB,LIBPNG,TINYXML,PIXMAN,FREETYPE,HARFBUZZ,LIBARCHIVE,WEBP}=YES \
|
|
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 # workaround
|
|
cmake --build build
|
|
}
|
|
|
|
check() {
|
|
export CXX=clang++
|
|
export CC=clang
|
|
export AR=ar
|
|
export NM=nm
|
|
env -C build ctest --output-on-failure
|
|
}
|
|
|
|
package() {
|
|
export CXX=clang++
|
|
export CC=clang
|
|
export AR=ar
|
|
export NM=nm
|
|
# 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/$pkgname.desktop"
|
|
install -vDm 644 aseprite/src/desktop/linux/mime/aseprite.xml "$pkgdir/usr/share/mime/packages/$pkgname.xml"
|
|
# Thumbnailer
|
|
install -vDm 755 aseprite/src/desktop/linux/aseprite-thumbnailer "$pkgdir/usr/bin/aseprite-thumbnailer"
|
|
install -vDm 644 aseprite/src/desktop/linux/gnome/aseprite.thumbnailer "$pkgdir/usr/share/thumbnailers/aseprite.thumbnailer"
|
|
# 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"
|
|
# Copy translations
|
|
mkdir -p "$pkgdir/usr/share/$pkgname/data/strings/"
|
|
cp -vt "$pkgdir/usr/share/$pkgname/data/strings/" aseprite-strings/*.ini
|
|
# Copy translations' license
|
|
install -vm 644 aseprite-strings/LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/translations.txt"
|
|
}
|