summaryrefslogtreecommitdiff
path: root/media-sound/qobine/qobine-2026.10.16.ebuild
blob: 4f8f392034bc1e8b24a2845acce9fe1f8262e874 (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 2025-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

declare -A GIT_CRATES=(
	[mpris-server]='https://github.com/SeaDve/mpris-server;f8b3f74e93910fffd0c93df687e05cf954dcdeba;mpris-server-%commit%'
	[rodio]='https://github.com/RustAudio/rodio;a352fb53846b47523d828b276b6d625f251aabb2;rodio-%commit%'
	[cpal]='https://github.com/RustAudio/cpal;fd3b945bffcaa493fa7cb5ceddf9db1f9330fd30;cpal-%commit%'
)

RUST_MIN_VER="1.92"

UPSTREAM_PV="${PV//./-}"

inherit cargo

DESCRIPTION="Tui, web and rfid player for Qobuz"
HOMEPAGE="https://github.com/SofusA/qobine"
SRC_URI="https://github.com/SofusA/${PN}/archive/refs/tags/v${UPSTREAM_PV}.tar.gz -> ${P}.tar.gz"
SRC_URI+=" https://github.com/gentoo-crate-dist/qobuz-player/releases/download/v${UPSTREAM_PV}/${PN}-${UPSTREAM_PV}-crates.tar.xz"
SRC_URI+=" ${CARGO_CRATE_URIS}"

S="${WORKDIR}/${PN}-${UPSTREAM_PV}"

LICENSE="GPL-3"
# Dependent crate licenses
LICENSE+="
	Apache-2.0 BSD-2 BSD CDLA-Permissive-2.0 ISC MIT MPL-2.0 UoI-NCSA
	Unicode-3.0 ZLIB
"
SLOT="0"
KEYWORDS="~amd64"
IUSE="server"
RESTRICT="test"

DEPEND="
	dev-db/sqlite:3=
	dev-libs/glib
	dev-libs/openssl
	media-libs/alsa-lib
	sys-apps/dbus
"
RDEPEND="${DEPEND}"
BDEPEND="virtual/pkgconfig"

src_prepare() {
	default

	local rodio_path="${WORKDIR}/rodio-a352fb53846b47523d828b276b6d625f251aabb2"
	local cpal_path="${WORKDIR}/cpal-fd3b945bffcaa493fa7cb5ceddf9db1f9330fd30"

	# Patch rodio's Cargo.toml to use local path for cpal
	sed -i \
		-e "s|cpal\s*=\s*{\s*version\s*=\s*\"[^\"]*\"|cpal = { path = \"${cpal_path}\"|" \
		-e "s|cpal\s*=\s*{\s*git\s*=\s*\"https://github.com/RustAudio/cpal\"[^}]*|cpal = { path = \"${cpal_path}\"|" \
		"${rodio_path}/Cargo.toml" || die "Failed to patch rodio Cargo.toml"

	grep -q "cpal = { path = \"${cpal_path}\"" "${rodio_path}/Cargo.toml" \
		|| die "Failed to verify cpal patch in rodio"
}

src_configure() {
	# high magic to allow system-libs
	export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
	default
}

src_compile() {
	cargo_src_compile --package connect-module
	use server && cargo_src_compile --package disconnect-server-module
	cargo_src_compile --package rfid-module
	cargo_src_compile --package tui-module
	cargo_src_compile --package web-module
}

src_install() {
	cargo_src_install --path connect-module
	use server && cargo_src_install --path disconnect-server-module
	cargo_src_install --path rfid-module
	cargo_src_install --path tui-module
	cargo_src_install --path web-module

	local DOCS=(
		README.md
	)
	einstalldocs
}