summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: a0cf9eccde886d3b8bed860658db09f212c6ec37 (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
# Maintainer: SelfRef <arch@selfref.dev>

_basename=jan
pkgname=${_basename}-git
pkgver=0.5.4.r50.gbe8c4f8
pkgrel=1
pkgdesc="Jan is an open source alternative to ChatGPT that runs 100% offline on your computer (git version)"
url="https://jan.ai/"
arch=('x86_64')
license=('AGPL-3.0')
source=(
	"$_basename::git+https://github.com/janhq/jan.git"
	'jan.desktop'
)
sha256sums=('SKIP'
            '689c50321d61f2c40a275c004865e9956501038782867bbe73e9d42128f40048')
provides=("$_basename")
conflicts=("$_basename")
depends=(
	'nss'
	'atk'
	'libcups'
	'gtk3'
	'alsa-lib'
)
makedepends=(
	'git'
	'nodejs'
	'npm'
	'yarn'
	'libxcrypt-compat'
)

pkgver() {
	cd "$_basename"
	git describe --long --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/^v//'
}

prepare() {
	cd "$_basename"
	[ -f electron/package.json ] && sed -i '/"build:linux"/s/-l deb -l AppImage/-l --dir/' electron/package.json
}

build() {
	cd "$_basename"
	export YARN_CACHE_FOLDER="$srcdir"/yarn-cache
	make build
}

package() {
	# Desktop file
	install -Dm644 ../jan.desktop "$pkgdir"/usr/share/applications/jan.desktop

	# Application files
	cd "$_basename"/electron
	install -dm755 "$pkgdir"/opt/Jan
	cp -r dist/linux-unpacked/* "$pkgdir"/opt/Jan/

	# Icon files
	cd icons
	[ -f icon.png ] && install -Dm644 icon.png "$pkgdir"/usr/share/icons/hicolor/512x512/apps/jan.png
	[ -f icon-tray.png ] && install -Dm644 icon-tray.png "$pkgdir"/usr/share/icons/hicolor/16x16/apps/jan.png
	[ -f icon-tray@2x.png ] && install -Dm644 icon-tray@2x.png "$pkgdir"/usr/share/icons/hicolor/32x32/apps/jan.png
}