summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 395b2ad07e731c1dcccc9b662ec90185a45ba89e (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
# Maintainer: j.r <j.r@jugendhacker.de>
pkgname=sonixd
pkgver=0.15.0
pkgrel=1
pkgdesc="A full-featured Subsonic/Jellyfin compatible desktop music player"
arch=('x86_64')
url="https://github.com/jeffvli/sonixd"
license=('GPL3')
depends=('electron13' 'nodejs')
makedepends=('yarn' 'nvm' 'asar')
conflicts=("$pkgname-appimage")
replaces=("$pkgname-appimage")
source=("$pkgname-$pkgver.tar.gz::https://github.com/jeffvli/sonixd/archive/refs/tags/v$pkgver.tar.gz"
	"$pkgname"
	"$pkgname.desktop")
sha256sums=('92820a922fbd6def4caab4f39553d507cd253f093b25c3296cc1744f3abb1c4e'
            '89039f59dc58490cc5a2e05bb38b3645448df56b2e763d6170facb64e73241d0'
            '9e2e1cce47b594b75b8df7a1cf3a5a6da340dda9d0cfdf2aa305d097fc0bbc7a')

_ensure_local_nvm() {
	which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload
	export NVM_DIR="$srcdir/.nvm"

	source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}

prepare() {
	cd "$pkgname-$pkgver"

	_ensure_local_nvm
	nvm install --no-progress 15.14.0

	_ver="$(</usr/lib/electron13/version)"
	yarn upgrade --cache-folder="$srcdir/yarn-cache" "electron@$_ver"
}

build() {
	cd "$pkgname-$pkgver"

	_ver="$(</usr/lib/electron13/version)"
	_ensure_local_nvm
	local i686=ia32 x86_64=x64
	export NODE_ENV=production
	yarn build --cache-folder="$srcdir/yarn-cache"
	yarn run --cache-folder="$srcdir/yarn-cache" \
		electron-builder --linux --"${!CARCH}" --dir \
		-c.electronDist=/usr/lib/electron13 \
		-c.electronVersion="$_ver"
}

package() {
	install -Dm755 "$pkgname" "$pkgdir/usr/bin/$pkgname"
	install -Dm755 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"

	cd "$pkgname-$pkgver"
	local i686=linux-ia32-unpacked x86_64=linux-unpacked

	install -d "$pkgdir/usr/lib/$pkgname/"

	install -Dm644 "release/${!CARCH}/resources/assets/icons/512x512.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"
	cp -r "release/${!CARCH}/resources/assets" "$pkgdir/usr/lib/$pkgname"
	asar e "release/${!CARCH}/resources/app.asar" "$pkgdir/usr/lib/$pkgname/$pkgname/"
}