summaryrefslogtreecommitdiff
blob: d62e1b7badd789b8fa726e8f1b00e2b19f16770f (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CMAKE_MAKEFILE_GENERATOR=emake

inherit cmake flag-o-matic systemd xdg-utils

CMAKE_USE_DIR="${S}/src"

DESCRIPTION="Multi Purpose Voice Services System, including Qtel for EchoLink"
HOMEPAGE="https://www.svxlink.org"
SRC_URI="https://github.com/sm0svx/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2 LGPL-2.1"
SLOT="0"
KEYWORDS="amd64 ~x86"
IUSE="ogg qt5 rtlsdr"

DEPEND="dev-lang/tcl:=
	dev-libs/jsoncpp:=
	dev-libs/libgcrypt:=
	=dev-libs/libgpiod-1*:=
	dev-libs/libsigc++:2
	dev-libs/popt
	media-libs/alsa-lib
	media-sound/gsm
	media-libs/speex
	media-libs/opus
	net-misc/curl
	ogg? ( media-libs/libogg )
	rtlsdr? ( net-wireless/rtl-sdr )
	qt5? (
		dev-qt/qtcore:5
		dev-qt/qtgui:5
		dev-qt/qtnetwork:5
		dev-qt/qtwidgets:5
	)"
RDEPEND="${DEPEND}
	acct-group/svxlink
	acct-user/svxlink"
BDEPEND="
	virtual/pkgconfig
	qt5? ( dev-qt/linguist-tools:5 )"

src_prepare() {
	# fix build for MUSL (bug #936813)
	if use elibc_musl ; then
		eapply -p1 "${FILESDIR}/${P}-musl.patch"
	fi
	if ! use ogg ; then
		# drop automatic discovery of dependency
		sed -i -e "s/find_package(OGG)/#/g" \
				src/async/audio/CMakeLists.txt || die
	fi
	if ! use rtlsdr ; then
		# drop automatic discovery of dependency
		sed -i -e "s/find_package(RtlSdr)/#/g" \
				src/svxlink/trx/CMakeLists.txt || die
	fi
	cmake_src_prepare
	# drop deprecated desktop category (bug #475730)
	sed -i -e "s:Categories=Application;:Categories=:g" src/qtel/qtel.desktop || die
}

src_configure() {
	# -Wodr warnings, see bug #860414
	filter-lto

	local mycmakeargs=(
		-DUSE_QT="$(usex qt5)"
		-DSYSCONF_INSTALL_DIR=/etc
		-DLOCAL_STATE_DIR=/var
		-DUSE_OSS=NO
	)
	cmake_src_configure
}

src_install() {
	cmake_src_install

	fowners -R svxlink:svxlink /var/spool/svxlink

	doman src/doc/man/*.1 src/doc/man/*.5

	insinto /etc/logrotate.d
	doins   distributions/gentoo/etc/logrotate.d/*

	newinitd "${FILESDIR}"/remotetrx.init remotetrx
	newinitd "${FILESDIR}"/svxlink.init svxlink
	newconfd "${FILESDIR}"/remotetrx.rc remotetrx
	newconfd "${FILESDIR}"/svxlink.rc svxlink

	systemd_dounit "${FILESDIR}"/remotetrx.service
	systemd_dounit "${FILESDIR}"/svxlink.service

	keepdir /var/spool/${PN}/propagation_monitor
	keepdir /var/spool/${PN}/qso_recorder
	keepdir /var/spool/${PN}/voice_mail
}

pkg_postinst() {
	xdg_icon_cache_update
}

pkg_postrm() {
	xdg_icon_cache_update
}