summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fa31c0e0a0b6a15888b73700a318032dfb722990 (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
# Maintainer: Kevin S <aur@eldenring.mozmail.com>
pkgname=audiobookshelf-git
pkgver=v2.2.23.r28.gd86a3b3d
pkgrel=1
pkgdesc="Self-hosted audiobook server for managing and playing audiobooks"
arch=('any')
url="https://github.com/advplyr/audiobookshelf"
license=('GPL3')
depends=('ffmpeg')
makedepends=('nodejs' 'npm' 'git')
optdepends=('tone-bin')
provides=("audiobookshelf")
conflicts=("audiobookshelf")
backup=('etc/conf.d/audiobookshelf')
options=(!strip)

source=(${pkgname}::git+"${url}".git
	'audiobookshelf.conf.d'
	'audiobookshelf.hook'
	'audiobookshelf.service'
        'audiobookshelf.sysusers'
        'audiobookshelf.tmpfiles')

md5sums=('SKIP'
	'de5fab845f7f96b49956c7dc21268593'
	'749322fc2b48a839a79a638d879e77a4'
	'ce89e5d2ce27de70b5e6b53cbaf595f0'
        '63619dfc5bb5b2dbecfb1d6037095338'
        '90e34ac4e5a79f71af3eaab8cebf1198')

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

prepare() {    
	cd "${srcdir}/${pkgname}"
	# install build dependencies
	npm install pkg
}

build() {
	cd "${srcdir}/${pkgname}"
	echo ">>> Building Client"
	echo "--------------------"

	cd client
	rm -rf node_modules
	npm ci --unsafe-perm=true --allow-root
	NODE_OPTIONS=--openssl-legacy-provider	npm run generate
	cd ..

	echo ">>> Building Server"
	echo "--------------------"

	rm -rf node_modules
	npm ci --unsafe-perm=true --allow-root
}

package() {
	cd "${srcdir}/${pkgname}"

	install -d -m 755 "${pkgdir}/usr/share/audiobookshelf/"
	"${srcdir}/${pkgname}"/node_modules/.bin/pkg -t node16-linux -o "${pkgdir}/usr/share/audiobookshelf/audiobookshelf" . 
	install -D -m 644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
	install -D -m 644 "${srcdir}/audiobookshelf.conf.d" "${pkgdir}/etc/conf.d/audiobookshelf"
	install -D -m 644 "${srcdir}/audiobookshelf.service" "${pkgdir}/usr/lib/systemd/system/audiobookshelf.service"
	install -D -m 644 "${srcdir}/audiobookshelf.sysusers" "${pkgdir}/usr/lib/sysusers.d/audiobookshelf.conf"
	install -D -m 644 "${srcdir}/audiobookshelf.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/audiobookshelf.conf"
	install -D -m 644 "${srcdir}/audiobookshelf.hook" "${pkgdir}/usr/share/doc/${pkgname}/audiobookshelf.hook"
}