net-im/telegram-desktop-bin: work around fontconfig issues
[gentoo.git] / net-im / telegram-desktop-bin / telegram-desktop-bin-1.4.0-r1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 inherit desktop gnome2-utils xdg
7
8 DESCRIPTION="Official desktop client for Telegram (binary package)"
9 HOMEPAGE="https://desktop.telegram.org"
10 SRC_URI="
11         https://github.com/telegramdesktop/tdesktop/archive/v${PV}.tar.gz -> tdesktop-${PV}.tar.gz
12         amd64? ( https://updates.tdesktop.com/tlinux/tsetup.${PV}.tar.xz )
13         x86? ( https://updates.tdesktop.com/tlinux32/tsetup32.${PV}.tar.xz )
14 "
15
16 LICENSE="telegram"
17 SLOT="0"
18 KEYWORDS="-* ~amd64 ~x86"
19
20 QA_PREBUILT="usr/lib/${PN}/Telegram"
21
22 RDEPEND="
23         dev-libs/glib:2
24         dev-libs/gobject-introspection
25         >=sys-apps/dbus-1.4.20
26         x11-libs/libX11
27         >=x11-libs/libxcb-1.10[xkb]
28         >=media-libs/fontconfig-2.13
29 "
30
31 S="${WORKDIR}/Telegram"
32
33 src_install() {
34         exeinto /usr/lib/${PN}
35         doexe "Telegram"
36         newbin "${FILESDIR}"/${PN}-r2 "telegram-desktop"
37
38         local icon_size
39         for icon_size in 16 32 48 64 128 256 512; do
40                 newicon -s "${icon_size}" \
41                         "${WORKDIR}/tdesktop-${PV}/Telegram/Resources/art/icon${icon_size}.png" \
42                         telegram-desktop.png
43         done
44
45         dodir /etc/${PN}
46         insinto /etc/${PN}/
47         doins ${FILESDIR}/fonts.conf
48
49         domenu "${WORKDIR}/tdesktop-${PV}"/lib/xdg/telegramdesktop.desktop
50 }
51
52 pkg_preinst() {
53         xdg_pkg_preinst
54 }
55
56 pkg_postinst() {
57         xdg_pkg_postinst
58         gnome2_icon_cache_update
59         einfo
60         einfo "Previous versions of ${PN} have created "
61         einfo "\"~/.local/share/applications/telegram.desktop\". These files"
62         einfo "conflict with the one shipped by portage and should be removed"
63         einfo "from all homedirs. (https://bugs.gentoo.org/618662)"
64         einfo
65         einfo "This versions fixes fontconfig issues that have been reported"
66         einfo "by several users. However, the fix might have side-effects on"
67         einfo "non-latin fonts. If you have font issues with this version just"
68         einfo "delete \"/etc/${PN}/fonts.conf\" and leave a comment here"
69         einfo "https://bugs.gentoo.org/664872"
70 }
71
72 pkg_postrm() {
73         xdg_pkg_postrm
74         gnome2_icon_cache_update
75 }