aboutsummaryrefslogtreecommitdiff
path: root/apks/invidious/APKBUILD
blob: b62f63ce9792e0616f2ea893eb364a9ee7a7fd7c (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
72
73
pkgname=invidious
pkgver=v2.20241110.0
pkgrel=0
pkgdesc="Alternative front-end to YouTube"
url="https://github.com/iv-org/invidious"
arch="x86_64"
license="AGPL-3.0-or-later"
depends="
	rsvg-convert
"
options="!check" # testing breaks for now fixing later
makedepends="
	crystal
	git
	libxml2-dev
	openssl-dev
	shards
	sqlite-dev
	yaml-dev
	zlib-dev
"
install="$pkgname.pre-install"
pkgusers="$pkgname"
pkggroups="$pkgname"
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/iv-org/invidious/archive/refs/tags/$pkgver.tar.gz
	$pkgname.initd
"
builddir="$srcdir/$pkgname-${pkgver:1}"

prepare() {
	default_prepare

	sed \
		-e 's/^CURRENT_BRANCH =.*/CURRENT_BRANCH = "release"/' \
		-e 's/^CURRENT_COMMIT  =.*/CURRENT_COMMIT  = "'$pkgver'"/' \
		-e 's/^CURRENT_VERSION =.*/CURRENT_VERSION = "'$pkgver'"/' \
		-e 's/^ASSET_COMMIT =.*/ASSET_COMMIT = "'$pkgver'"/' \
		-i src/invidious.cr

	datadir=/usr/share/webapps/invidious
	# fix paths
	sed -i src/invidious.cr \
		-e "s|\(public_folder\) \"assets\"|\1 \"$datadir/assets\"|"
	sed -i src/invidious/helpers/i18n.cr \
		-e "s|File.read(\"locales/|File.read(\"$datadir/locales/|"
	sed -i src/invidious/database/base.cr \
		-e "s|config/sql|/etc/$pkgname/\0|g"

}

build() {
	shards install
	crystal build \
		--release \
		-Ddisable_quic \
		src/invidious.cr
}

package() {
	install -Dm755 "$pkgname" "$pkgdir"/usr/bin/invidious
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	mkdir -p "$pkgdir"/usr/share/webapps/invidious
	cp -r "$builddir"/assets "$builddir"/locales \
		"$pkgdir"/usr/share/webapps/invidious
	install -Dm644 "$builddir"/config/config.example.yml \
		"$pkgdir"/etc/"$pkgname"/config.yml
}
sha512sums="
3ed9d47c520736d9df95541f6a85cc456c4b9ce03bd8f38905f7a11542ba0875d9d1736be82bee8d56039937b0321188ce0228d760ad616e6cc2d0aa7cbd8535  invidious-v2.20241110.0.tar.gz
ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596  invidious.initd
"