summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 41933223f9d069225461dfa4ab2074e41d85c247 (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
# Maintainer: MithicSpirit <rpc01234 at gmail dot com>

_pkgname=appflowy
pkgname=$_pkgname-git
pkgver=latest
pkgrel=18
pkgdesc='An open-source alternative to Notion.'
arch=(x86_64)
url='https://www.appflowy.io/'
license=('AGPL3')
depends=('glibc>=2.32' gtk3 libkeybinder3 xdg-user-dirs libnotify)
makedepends=(git clang cmake ninja unzip rustup sqlite rsync cargo-make duckscript)
provides=($_pkgname)
conflicts=($_pkgname $_pkgname-bin)
replaces=()
backup=()
options=(!lto)
install=
source=("$_pkgname::git+https://github.com/AppFlowy-IO/AppFlowy.git"
        'flutter::git+https://github.com/flutter/flutter.git#tag=3.19.2')
sha256sums=('SKIP'
            'SKIP')

_setenv() {
	export RUSTUP_HOME="$srcdir/rustup"
	export CARGO_HOME="$srcdir/cargo"
	export PUB_CACHE="$srcdir/pub-cache"

	export PATH="$srcdir/flutter/bin:$PUB_CACHE/bin:$CARGO_HOME/bin:$PATH"
}

pkgver() {
	_setenv
	cd "$srcdir/$_pkgname"
	git describe --long --tags | sed 's/\([^-]*-\)g/r\1/;s/-/./g'
}

prepare() {
	_setenv

	mkdir "$RUSTUP_HOME" "$CARGO_HOME" "$PUB_CACHE"

	flutter config --enable-linux-desktop

	rustup toolchain install stable
	rustup default stable
}

build() {
	_setenv
	cd "$srcdir/$_pkgname/frontend"

	cargo make appflowy-flutter-deps-tools

	cargo make --profile "production-linux-$CARCH" appflowy
}

package() {
	_setenv
	cd "$srcdir/$_pkgname/frontend"

	install -dm755 "$pkgdir"{/usr/bin,/usr/share/applications,"/opt/$pkgname"}
	cp -a ./appflowy_flutter/product/*/linux/Release/AppFlowy/* "$pkgdir/opt/$pkgname/"
	ln -s "/opt/$pkgname/AppFlowy" "$pkgdir/usr/bin/"

	install -m644 "scripts/linux_distribution/deb/AppFlowy.desktop" \
		"$pkgdir/usr/share/applications/"
}