aboutsummaryrefslogtreecommitdiff
path: root/apks/invidious/APKBUILD
blob: 4728a971856858fbfb8878ec4ee80a3c88201f22 (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
# Maintainer: Francesco Camuffo <dev@fmac.xyz>
pkgname=invidious
pkgver=0_git20240429
_commit=eda7444ca46dbc3941205316baba8030fe0b2989
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"
_mocks_commit=cb16e0343c8f94182615610bfe3c503db89717a7
source="
	$pkgname-$_commit.tar.gz::https://github.com/iv-org/invidious/archive/$_commit.tar.gz
	$pkgname.initd
"
builddir="$srcdir/invidious-$_commit"

prepare() {
	sed -i src/invidious.cr \
		-e 's/\(CURRENT_BRANCH \) = .*/\1 = "master"/' \
		-e "s/\(CURRENT_COMMIT \) = .*/\1 = \"${_commit:0:7}\"/" \
		-e "s/\(CURRENT_VERSION\) = .*/\1 = \"$pkgver\"/" \
		-e "s/\(ASSET_COMMIT\) = .*/\1 = \"${_commit:0:7}\"/"

	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"

	default_prepare
}

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="
1d28d44fb4f201f579123f93aa446b0b0878909a4ca4bb522c14ac14e05572eebb32ec3e57bedb2e27657d4e75a57c376e30d21eba511814785200f72bc7f706  invidious-eda7444ca46dbc3941205316baba8030fe0b2989.tar.gz
ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596  invidious.initd
"