apkbuilds @ 23e387a3f2ebe026a518c58ba6a8916b63733339

 1# Maintainer: Francesco Camuffo <dev@fmac.xyz>
 2pkgname=invidious
 3pkgver=0_git20240331
 4_commit=08390acd0c17875fddb84cabba54197a5b5740e4
 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="
725b3630cfbbc01f5967bcd24fd6b5c680854c4abdeb87fcbf4b181f8149e49b21f54b5140e3af0218a72f11917c813171945acfa2a16211b7697e70134e6aa65b  invidious-08390acd0c17875fddb84cabba54197a5b5740e4.tar.gz
73ed0a2e498751927c1ad82619395a07c169f7353a9c1453381ad288ad501b915010df5b799e4f102e034f0483b9101b9a8ae40d150b3d7db80605f87b9ca6f596  invidious.initd
74"