1# Maintainer: Francesco Camuffo <dev@fmac.xyz>
2pkgname=invidious
3pkgver=0_git20231007
4_commit=60fae015d8b5e4b0bfac8306065db07f93c4c661
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="
72bc2295d5d43ac3b793914e4baa0bdd6c4d6ff1746629b3db0b81a22ca057acb5cc28a7af984573ace936acaabedc2ce134d9ecf76386101893af408976f8f44c invidious-60fae015d8b5e4b0bfac8306065db07f93c4c661.tar.gz
73ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596 invidious.initd
74"