aboutsummaryrefslogtreecommitdiff
path: root/apks/invidious/APKBUILD
blob: 673c1c56d77f401f50c0459578e87f507f842151 (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
74
pkgname=invidious
pkgver=v2.20240825.2
_commit=4782a6703819e0babfa4792892b691dd096eeac3
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="
1f22e6a8042b440d303508c8fcf394241560ccbaf44078e350dc227ac0d845b9bb0d1d829eb3c8737426c779e7a58d553da03d7e094458dab78a28c9065ceb8a  invidious-v2.20240825.2.tar.gz
ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596  invidious.initd
"