summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 65e43fa7788bc7f126de10c632f507e470e57b49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Kabakov Grigoriy <g.kabakov@inbox.ru>

pkgname=graphite-editor-git
_pkgname=Graphite
pkgver=r2430.d6c06da
pkgrel=1
pkgdesc='raster & vector editor with a modern node-based, non-destructive, procedural workflow'
arch=(x86_64)
url="https://github.com/GraphiteEditor/$_pkgname"
license=(Apache-2.0)
depends=(alsa-lib
         at-spi2-core
         libcups
         libxcomposite
         libxdamage
         libxkbcommon
         libxrandr
         mesa
         nss
         pango)
makedepends=(cargo-about
             git
             npm
             rustup
             wasm-pack)
provides=("${pkgname%-git}=$pkgver")
conflicts=("${pkgname%-git}")
source=("$pkgname::git+$url.git")
sha256sums=('SKIP')

_cef_path="/usr/lib/$pkgname"
# toolchain is hard coded in pinned Git dependency, a stable one can be used to
# build some parts of the system, but that just results in multiple toolchains
# being downloaded and mix-'n-matched in the build
_toolchain='nightly-2025-06-23'

prepare() {
	cd "$pkgname"
	export RUSTUP_TOOLCHAIN="$_toolchain"
	cargo fetch --locked --target "$(rustc --print host-tuple)"
	pushd frontend
	npm run setup
	cargo run --package third-party-licenses --features desktop
}

pkgver() {
	cd "$pkgname"
	printf 'r%s.%s' \
		"$(git rev-list --count HEAD)" \
		"$(git rev-parse --short=7 HEAD)"
}

build() {
	cd "$pkgname"
	export RUSTUP_TOOLCHAIN="$_toolchain"
	unset CARGO_TARGET_DIR
	(
		pushd frontend
		RUSTFLAGS+=" -C target-feature=+bulk-memory"
		RUSTFLAGS+=" -C link-arg=--max-memory=4294967296"
		RUSTFLAGS+=" --cfg=web_sys_unstable_apis"
		npm run build-native
	)
	CFLAGS+=' -ffat-lto-objects'
	CXXFLAGS+=' -fno-lto'
	RUSTFLAGS+=" -C link-arg=-Wl,-rpath=$_cef_path"
	cargo build --release --frozen --package graphene-cli --package graphite-desktop
}

package() {
	cd "$pkgname"
	install -Dm0755 -t "$pkgdir/usr/bin/" target/release/{graphene-cli,graphite}
	install -d "$pkgdir$_cef_path"
	cp -a target/release/build/cef-dll-sys-*/out/cef_linux_x86_64/. "$pkgdir$_cef_path"
	install -Dm644 -t "$pkgdir/usr/share/applications/" desktop/assets/art.graphite.Graphite.desktop
	install -Dm644 -t "$pkgdir/usr/share/pixmaps/" branding/app-icons/graphite.{png,svg}
	install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
}