summaryrefslogtreecommitdiff
blob: 6e6329011f16220ba7f10df32185be9c87b3104d (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PLOCALES="be bg ca cs de el en eo es et fa fi fr he hu it ja kk mk nl pl pt_BR pt ru sk sl sr@latin sv sw uk ur_PK vi zh_CN zh_TW"
PLOCALE_BACKUP="en"

inherit git-r3 cmake l10n qmake-utils xdg

DESCRIPTION="Qt XMPP client"
HOMEPAGE="https://psi-im.org"

PSI_URI="https://github.com/psi-im"
PSI_PLUS_URI="https://github.com/psi-plus"
EGIT_REPO_URI="${PSI_URI}/${PN}.git"
PSI_LANGS_URI="${PSI_URI}/psi-l10n.git"
PSI_PLUS_LANGS_URI="${PSI_PLUS_URI}/psi-plus-l10n.git"
EGIT_MIN_CLONE_TYPE="single"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS=""
IUSE="aspell crypt dbus debug doc enchant extras +hunspell iconsets keyring webengine webkit xscreensaver"

REQUIRED_USE="
	?? ( aspell enchant hunspell )
	iconsets? ( extras )
"

BDEPEND="
	dev-qt/linguist-tools:5
	virtual/pkgconfig
	doc? ( app-doc/doxygen )
	extras? ( >=sys-devel/qconf-2.4 )
"
DEPEND="
	app-crypt/qca:2[ssl]
	dev-qt/qtconcurrent:5
	dev-qt/qtcore:5
	dev-qt/qtgui:5
	dev-qt/qtmultimedia:5
	dev-qt/qtnetwork:5
	dev-qt/qtsql:5[sqlite]
	dev-qt/qtsvg:5
	dev-qt/qtwidgets:5
	dev-qt/qtx11extras:5
	dev-qt/qtxml:5
	net-dns/libidn:0
	net-libs/http-parser:=
	sys-libs/zlib[minizip]
	x11-libs/libX11
	x11-libs/libxcb
	aspell? ( app-text/aspell )
	dbus? ( dev-qt/qtdbus:5 )
	enchant? ( app-text/enchant:2 )
	hunspell? ( app-text/hunspell:= )
	keyring? ( dev-libs/qtkeychain:= )
	webengine? (
		dev-qt/qtwebchannel:5
		dev-qt/qtwebengine:5[widgets]
		net-libs/http-parser
	)
	webkit? ( dev-qt/qtwebkit:5 )
"
RDEPEND="${DEPEND}
	dev-qt/qtimageformats
	crypt? ( app-crypt/qca[gpg] )
"

RESTRICT="test iconsets? ( bindist )"

pkg_setup() {
	MY_PN=psi
	if use extras; then
		MY_PN=psi-plus
		ewarn "You're about to build patched version of Psi called Psi+."
		ewarn "It has new nice features not yet included to Psi."
		ewarn "Take a look at homepage for more info: http://psi-plus.com/"

		if use iconsets; then
			ewarn
			ewarn "Some artwork is from open source projects, but some is provided 'as-is'"
			ewarn "and has not clear licensing."
			ewarn "Possibly this build is not redistributable in some countries."
		fi

		EGIT_REPO_URI="${PSI_PLUS_URI}/${MY_PN}-snapshots.git"
	fi
}

src_unpack() {
	git-r3_src_unpack

	# fetch translations
	unset EGIT_BRANCH EGIT_COMMIT
	EGIT_REPO_URI=$(usex extras "${PSI_PLUS_LANGS_URI}" "${PSI_LANGS_URI}")
	EGIT_CHECKOUT_DIR="${WORKDIR}/psi-l10n"
	git-r3_src_unpack

	if use iconsets; then
		unset EGIT_BRANCH EGIT_COMMIT
		EGIT_CHECKOUT_DIR="${WORKDIR}/resources" \
		EGIT_REPO_URI="${PSI_URI}/resources.git" \
		git-r3_src_unpack
	fi
}

src_prepare() {
	cmake_src_prepare
	if use iconsets; then
		cp -a "${WORKDIR}/resources/iconsets" "${S}" || die "failed to copy additional iconsets"
	fi
}

src_configure() {
	local chattype=basic
	use webengine && chattype=webengine
	use webkit && chattype=webkit

	local mycmakeargs=(
		-DUSE_ASPELL=$(usex aspell)
		-DUSE_ENCHANT=$(usex enchant)
		-DUSE_HUNSPELL=$(usex hunspell)
		-DUSE_DBUS=$(usex dbus)
		-DINSTALL_PLUGINS_SDK=1
		-DUSE_KEYCHAIN=$(usex keyring)
		-DCHAT_TYPE=$chattype
		-DUSE_XSS=$(usex xscreensaver)
		-DPSI_PLUS=$(usex extras)
	)
	cmake_src_configure
}

src_compile() {
	cmake_src_compile
	use doc && emake -C doc api_public
}

src_install() {
	cmake_src_install

	# this way the docs will be installed in the standard gentoo dir
	rm "${ED}"/usr/share/${MY_PN}/{COPYING,README.html} || die "doc files set seems to have changed"
	newdoc iconsets/roster/README README.roster
	newdoc iconsets/system/README README.system
	newdoc certs/README README.certs
	dodoc README.html

	use doc && HTML_DOCS=( doc/api/. )
	einstalldocs

	# install translations
	local mylrelease="$(qt5_get_bindir)"/lrelease
	cd "${WORKDIR}/psi-l10n" || die
	insinto /usr/share/${MY_PN}
	install_locale() {
		"${mylrelease}" "translations/${PN}_${1}.ts" || die "lrelease ${1} failed"
		doins "translations/${PN}_${1}.qm"
	}
	l10n_for_each_locale_do install_locale
}

pkg_postinst() {
	xdg_pkg_postinst
	einfo "For GPG support make sure app-crypt/qca is compiled with gpg USE flag."
}