summaryrefslogtreecommitdiff
blob: b4f6fa98e1c855d0ef122cd1ba860dca612694ef (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
# Copyright 2023-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit qt6-build

DESCRIPTION="Bluetooth and NFC support library for the Qt6 framework"

if [[ ${QT6_BUILD_TYPE} == release ]]; then
	KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
fi

IUSE="+bluetooth neard nfc smartcard"
REQUIRED_USE="
	|| ( bluetooth nfc )
	nfc? ( ?? ( neard smartcard ) )
"

DEPEND="
	~dev-qt/qtbase-${PV}:6[network]
	bluetooth? (
		~dev-qt/qtbase-${PV}:6[dbus]
		net-wireless/bluez:=
	)
	nfc? (
		neard? ( ~dev-qt/qtbase-${PV}:6[dbus] )
		smartcard? ( sys-apps/pcsc-lite )
	)
"
RDEPEND="
	${DEPEND}
	nfc? (
		neard? ( net-wireless/neard )
	)
"

CMAKE_SKIP_TESTS=(
	# most hardware tests are auto-skipped, but some still misbehave
	# if bluez/hardware is available (generally tests here may not be
	# very relevant without hardware, lists may need to be extended)
	tst_qbluetoothlocaldevice
	tst_qbluetoothserver
	tst_qbluetoothservicediscoveryagent
	tst_qbluetoothserviceinfo
	tst_qlowenergycontroller
)

src_prepare() {
	qt6-build_src_prepare

	use bluetooth ||
		sed -i '/add_subdirectory(bluetooth)/d' src/CMakeLists.txt || die
	use nfc ||
		sed -i '/add_subdirectory(nfc)/d' src/CMakeLists.txt || die
}

src_configure() {
	local mycmakeargs=(
		$(usev nfc "
			$(qt_feature neard)
			$(qt_feature smartcard pcsclite)
		")
	)

	qt6-build_src_configure
}

src_install() {
	qt6-build_src_install

	# broken (unnecessary) symlink due to add_app() being used over add_tool()
	use !bluetooth || rm -- "${ED}"/usr/bin/sdpscanner6 || die

	if use test; then
		local delete=( # sigh
			"${D}${QT6_BINDIR}"/bluetoothtestdevice
			"${D}${QT6_BINDIR}"/bttestui
			"${D}${QT6_BINDIR}"/qlecontroller-server
		)
		# using -f given not tracking which tests may be skipped or not
		rm -f -- "${delete[@]}" || die
	fi
}