summaryrefslogtreecommitdiff
blob: 1670f29ba929b10e7490096410621b540832a666 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit qmake-utils toolchain-funcs

DESCRIPTION="Tool to quickly switch between multiple Qt installations"
HOMEPAGE="https://code.qt.io/cgit/qtsdk/qtchooser.git/"

if [[ ${PV} == *9999* ]]; then
	EGIT_REPO_URI="https://code.qt.io/qtsdk/qtchooser.git"
	inherit git-r3
else
	SRC_URI="https://download.qt.io/official_releases/${PN}/${P}.tar.xz"
	KEYWORDS="amd64 arm arm64 ~hppa ppc ~ppc64 ~riscv ~sparc x86"
fi

LICENSE="|| ( LGPL-2.1 GPL-3 )"
SLOT="0"
IUSE="test"
RESTRICT="!test? ( test )"

DEPEND="test? (
		dev-qt/qtcore:5
		dev-qt/qttest:5
	)"
RDEPEND="!<dev-qt/qtcore-5.15.3:5"

PATCHES=( "${FILESDIR}/${PN}-66-qt-5.15.3-compat.patch" )

qtchooser_make() {
	emake \
		CXX="$(tc-getCXX)" \
		LFLAGS="${LDFLAGS}" \
		prefix="${EPREFIX}/usr" \
		"$@"
}

src_compile() {
	qtchooser_make
}

src_test() {
	pushd tests/auto >/dev/null || die
	eqmake5
	popd >/dev/null || die

	qtchooser_make check
}

src_install() {
	qtchooser_make INSTALL_ROOT="${D}" install

	# install configuration file
	cat > "${T}/qt5-${CHOST}.conf" <<-_EOF_ || die
		$(qt5_get_bindir)
		$(qt5_get_libdir)
	_EOF_

	(
		insinto /etc/xdg/qtchooser
		doins "${T}/qt5-${CHOST}.conf"
	)

	# convenience symlinks
	dosym qt5-"${CHOST}".conf /etc/xdg/qtchooser/5.conf
	dosym qt5-"${CHOST}".conf /etc/xdg/qtchooser/qt5.conf
	dosym qt5.conf /etc/xdg/qtchooser/default.conf

	# TODO: bash and zsh completion
	# newbashcomp scripts/${PN}.bash ${PN}
}