apkbuilds @ f2581286292531e3c371e56208af46b97df37062

 1# Maintainer: Francesco Camuffo <dev@fmac.xyz>
 2pkgname=invidious
 3pkgver=0_git20240429
 4_commit=eda7444ca46dbc3941205316baba8030fe0b2989
 5pkgrel=0
 6pkgdesc="Alternative front-end to YouTube"
 7url="https://github.com/iv-org/invidious"
 8arch="x86_64"
 9license="AGPL-3.0-or-later"
10depends="
11	rsvg-convert
12"
13options="!check" # testing breaks for now fixing later
14makedepends="
15	crystal
16	git
17	libxml2-dev
18	openssl-dev
19	shards
20	sqlite-dev
21	yaml-dev
22	zlib-dev
23"
24install="$pkgname.pre-install"
25pkgusers="$pkgname"
26pkggroups="$pkgname"
27subpackages="$pkgname-openrc"
28_mocks_commit=cb16e0343c8f94182615610bfe3c503db89717a7
29source="
30	$pkgname-$_commit.tar.gz::https://github.com/iv-org/invidious/archive/$_commit.tar.gz
31	$pkgname.initd
32"
33builddir="$srcdir/invidious-$_commit"
34
35prepare() {
36	sed -i src/invidious.cr \
37		-e 's/\(CURRENT_BRANCH \) = .*/\1 = "master"/' \
38		-e "s/\(CURRENT_COMMIT \) = .*/\1 = \"${_commit:0:7}\"/" \
39		-e "s/\(CURRENT_VERSION\) = .*/\1 = \"$pkgver\"/" \
40		-e "s/\(ASSET_COMMIT\) = .*/\1 = \"${_commit:0:7}\"/"
41
42	datadir=/usr/share/webapps/invidious
43	# fix paths
44	sed -i src/invidious.cr \
45		-e "s|\(public_folder\) \"assets\"|\1 \"$datadir/assets\"|"
46	sed -i src/invidious/helpers/i18n.cr \
47		-e "s|File.read(\"locales/|File.read(\"$datadir/locales/|"
48	sed -i src/invidious/database/base.cr \
49		-e "s|config/sql|/etc/$pkgname/\0|g"
50
51	default_prepare
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="
721d28d44fb4f201f579123f93aa446b0b0878909a4ca4bb522c14ac14e05572eebb32ec3e57bedb2e27657d4e75a57c376e30d21eba511814785200f72bc7f706  invidious-eda7444ca46dbc3941205316baba8030fe0b2989.tar.gz
73ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596  invidious.initd
74"