apkbuilds @ 12050f56fa54894f28f2651d67d9d4777d20b430

 1pkgname=invidious
 2pkgver=v2.20240825.2
 3_commit=4782a6703819e0babfa4792892b691dd096eeac3
 4pkgrel=0
 5pkgdesc="Alternative front-end to YouTube"
 6url="https://github.com/iv-org/invidious"
 7arch="x86_64"
 8license="AGPL-3.0-or-later"
 9depends="
10	rsvg-convert
11"
12options="!check" # testing breaks for now fixing later
13makedepends="
14	crystal
15	git
16	libxml2-dev
17	openssl-dev
18	shards
19	sqlite-dev
20	yaml-dev
21	zlib-dev
22"
23install="$pkgname.pre-install"
24pkgusers="$pkgname"
25pkggroups="$pkgname"
26subpackages="$pkgname-openrc"
27source="
28	$pkgname-$pkgver.tar.gz::https://github.com/iv-org/invidious/archive/refs/tags/$pkgver.tar.gz
29	$pkgname.initd
30"
31builddir="$srcdir/$pkgname-${pkgver:1}"
32
33prepare() {
34	default_prepare
35
36	sed \
37		-e 's/^CURRENT_BRANCH =.*/CURRENT_BRANCH = "release"/' \
38		-e 's/^CURRENT_COMMIT  =.*/CURRENT_COMMIT  = "'$pkgver'"/' \
39		-e 's/^CURRENT_VERSION =.*/CURRENT_VERSION = "'$pkgver'"/' \
40		-e 's/^ASSET_COMMIT =.*/ASSET_COMMIT = "'$pkgver'"/' \
41		-i src/invidious.cr
42
43	datadir=/usr/share/webapps/invidious
44	# fix paths
45	sed -i src/invidious.cr \
46		-e "s|\(public_folder\) \"assets\"|\1 \"$datadir/assets\"|"
47	sed -i src/invidious/helpers/i18n.cr \
48		-e "s|File.read(\"locales/|File.read(\"$datadir/locales/|"
49	sed -i src/invidious/database/base.cr \
50		-e "s|config/sql|/etc/$pkgname/\0|g"
51
52}
53
54build() {
55	shards install
56	crystal build \
57		--release \
58		-Ddisable_quic \
59		src/invidious.cr
60}
61
62package() {
63	install -Dm755 "$pkgname" "$pkgdir"/usr/bin/invidious
64	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
65	mkdir -p "$pkgdir"/usr/share/webapps/invidious
66	cp -r "$builddir"/assets "$builddir"/locales \
67		"$pkgdir"/usr/share/webapps/invidious
68	install -Dm644 "$builddir"/config/config.example.yml \
69		"$pkgdir"/etc/"$pkgname"/config.yml
70}
71sha512sums="
721f22e6a8042b440d303508c8fcf394241560ccbaf44078e350dc227ac0d845b9bb0d1d829eb3c8737426c779e7a58d553da03d7e094458dab78a28c9065ceb8a  invidious-v2.20240825.2.tar.gz
73ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596  invidious.initd
74"