summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 2ac78f15219fc3416e24ac2ffe6a912f13e9b968 (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
# Maintainer: Core_UK <dev@coredev.uk>

pkgname=cider
pkgver=1.6.3
pkgrel=8
pkgdesc="Project Cider. An open-source Apple Music client built from the ground up with Vue.js and Electron. Build from tar file on GitHub releases."
arch=(x86_64)
url="https://github.com/ciderapp/${pkgname}.git"
license=(AGPL3)
depends=(gtk3 nss alsa-lib libxcrypt-compat)
optdepends=('libnotify: Playback notifications')
makedepends=(nvm fontconfig git)
provides=(${pkgname})
conflicts=(${pkgname})
source_x86_64=("https://github.com/ciderapp/${pkgname}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums_x86_64=('f9c778c0f2a0f9e21fa7c67cbc252b959d7261457752fd8f7f08ba2685005688')

_ensure_local_nvm() {
	# lets be sure we are starting clean
	which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload

	export NVM_DIR="${srcdir}/${pkgname}-core-${pkgver}/.nvm"
	# The init script returns 3 if version
	#   specified in ./.nvrc is not (yet) installed in $NVM_DIR
	#   but nvm itself still gets loaded ok
	source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
}

prepare() {
	cd "${srcdir}/${pkgname^}-${pkgver}"
	_ensure_local_nvm
	nvm install
	corepack enable
	corepack prepare yarn@stable --activate
}

build() {
	cd "${srcdir}/${pkgname^}-${pkgver}"
	_ensure_local_nvm
	npx -y check-engine && yarn install && yarn dist && mv dist/*.deb "${srcdir}/" && cd "${srcdir}"
	ar x ${pkgname}_${pkgver}_amd64.deb data.tar.xz
}

package() {
	# Extract package data
	bsdtar -xf ${srcdir}/data.tar.xz -C ${pkgdir}/
	# mv "${pkgdir}/opt/${pkgname^}" "${pkgdir}/opt/${pkgname}" # Disabled as breaks desktop file

	# Symlink the binary
	install -d "$pkgdir/usr/bin/"
	ln -sf "/opt/${pkgname^}/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"

	# Echo documentation to user
	echo "To change the port that Cider uses, CIDER_PORT environment variable can be set."
}