Gentoo Archives: gentoo-commits

From: Mikle Kolyada <zlogene@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-im/telegram-desktop-bin/files/, net-im/telegram-desktop-bin/
Date: Thu, 04 Oct 2018 20:51:24
Message-Id: 1538686230.056380a0e76e08e1bd2e5973219ff46a95b83ea5.zlogene@gentoo
1 commit: 056380a0e76e08e1bd2e5973219ff46a95b83ea5
2 Author: Henning Schild <henning <AT> hennsch <DOT> de>
3 AuthorDate: Wed Oct 3 17:43:28 2018 +0000
4 Commit: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 4 20:50:30 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=056380a0
7
8 net-im/telegram-desktop-bin: work around fontconfig issues
9
10 This commit makes telegram-desktop-bin bring its own fontconfig
11 file for the old version of fontconfig it has built in. It also allows
12 to fall back to the "old way" by removing the file from /etc/.
13
14 Signed-off-by: Henning Schild <henning <AT> hennsch.de>
15 Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
16 Closes: https://bugs.gentoo.org/664872
17 Closes: https://github.com/gentoo/gentoo/pull/10055
18
19 net-im/telegram-desktop-bin/files/fonts.conf | 60 +++++++++++++++++
20 .../files/telegram-desktop-bin-r2 | 15 +++++
21 .../telegram-desktop-bin-1.4.0-r1.ebuild | 75 ++++++++++++++++++++++
22 3 files changed, 150 insertions(+)
23
24 diff --git a/net-im/telegram-desktop-bin/files/fonts.conf b/net-im/telegram-desktop-bin/files/fonts.conf
25 new file mode 100644
26 index 00000000000..d3ddc32d777
27 --- /dev/null
28 +++ b/net-im/telegram-desktop-bin/files/fonts.conf
29 @@ -0,0 +1,60 @@
30 +<?xml version='1.0'?>
31 +<!--
32 + This file is only here to work around
33 + https://github.com/telegramdesktop/tdesktop/issues/4240
34 + It has been taken from (with slight modification)
35 + https://github.com/telegramdesktop/tdesktop/issues/4493
36 +-->
37 +<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
38 +<fontconfig>
39 + <dir>/usr/share/fonts</dir>
40 + <dir>/usr/local/share/fonts</dir>
41 + <dir prefix="xdg">fonts</dir>
42 + <match target="pattern">
43 + <test qual="any" name="family">
44 + <string>mono</string>
45 + </test>
46 + <edit name="family" mode="assign" binding="same">
47 + <string>monospace</string>
48 + </edit>
49 + </match>
50 + <match target="pattern">
51 + <test qual="any" name="family">
52 + <string>sans serif</string>
53 + </test>
54 + <edit name="family" mode="assign" binding="same">
55 + <string>sans-serif</string>
56 + </edit>
57 + </match>
58 + <match target="pattern">
59 + <test qual="any" name="family">
60 + <string>sans</string>
61 + </test>
62 + <edit name="family" mode="assign" binding="same">
63 + <string>sans-serif</string>
64 + </edit>
65 + </match>
66 + <cachedir>/var/cache/fontconfig</cachedir>
67 + <cachedir prefix="xdg">fontconfig</cachedir>
68 + <cachedir>~/.fontconfig</cachedir>
69 + <match target="font">
70 + <edit mode="assign" name="antialias">
71 + <bool>true</bool>
72 + </edit>
73 + <edit mode="assign" name="embeddedbitmap">
74 + <bool>false</bool>
75 + </edit>
76 + <edit mode="assign" name="hinting">
77 + <bool>true</bool>
78 + </edit>
79 + <edit mode="assign" name="hintstyle">
80 + <const>hintslight</const>
81 + </edit>
82 + <edit mode="assign" name="lcdfilter">
83 + <const>lcddefault</const>
84 + </edit>
85 + <edit mode="assign" name="rgba">
86 + <const>rgb</const>
87 + </edit>
88 + </match>
89 +</fontconfig>
90
91 diff --git a/net-im/telegram-desktop-bin/files/telegram-desktop-bin-r2 b/net-im/telegram-desktop-bin/files/telegram-desktop-bin-r2
92 new file mode 100644
93 index 00000000000..a8b0e3e6d99
94 --- /dev/null
95 +++ b/net-im/telegram-desktop-bin/files/telegram-desktop-bin-r2
96 @@ -0,0 +1,15 @@
97 +#!/bin/sh
98 +# this wrapper disables the auto-updater of telegram-desktop
99 +# This program is licensed under the same license as telegram-desktop
100 +
101 +# telegram-desktop fails to set RestartCommand with the session manager
102 +# exclude it from session management to prevent restarts without the argument
103 +unset SESSION_MANAGER
104 +
105 +# telegram-desktop expects old fontconfig configuration files
106 +# this is a workaround to try and deal with that
107 +[ -e /etc/telegram-desktop-bin/fonts.conf ] && \
108 + [ -z $( printenv FONTCONFIG_FILE ) ] && \
109 + export FONTCONFIG_FILE=/etc/telegram-desktop-bin/fonts.conf
110 +
111 +exec /usr/lib/telegram-desktop-bin/Telegram -externalupdater $@
112
113 diff --git a/net-im/telegram-desktop-bin/telegram-desktop-bin-1.4.0-r1.ebuild b/net-im/telegram-desktop-bin/telegram-desktop-bin-1.4.0-r1.ebuild
114 new file mode 100644
115 index 00000000000..c709f83a671
116 --- /dev/null
117 +++ b/net-im/telegram-desktop-bin/telegram-desktop-bin-1.4.0-r1.ebuild
118 @@ -0,0 +1,75 @@
119 +# Copyright 1999-2018 Gentoo Foundation
120 +# Distributed under the terms of the GNU General Public License v2
121 +
122 +EAPI=6
123 +
124 +inherit desktop gnome2-utils xdg
125 +
126 +DESCRIPTION="Official desktop client for Telegram (binary package)"
127 +HOMEPAGE="https://desktop.telegram.org"
128 +SRC_URI="
129 + https://github.com/telegramdesktop/tdesktop/archive/v${PV}.tar.gz -> tdesktop-${PV}.tar.gz
130 + amd64? ( https://updates.tdesktop.com/tlinux/tsetup.${PV}.tar.xz )
131 + x86? ( https://updates.tdesktop.com/tlinux32/tsetup32.${PV}.tar.xz )
132 +"
133 +
134 +LICENSE="telegram"
135 +SLOT="0"
136 +KEYWORDS="-* ~amd64 ~x86"
137 +
138 +QA_PREBUILT="usr/lib/${PN}/Telegram"
139 +
140 +RDEPEND="
141 + dev-libs/glib:2
142 + dev-libs/gobject-introspection
143 + >=sys-apps/dbus-1.4.20
144 + x11-libs/libX11
145 + >=x11-libs/libxcb-1.10[xkb]
146 + >=media-libs/fontconfig-2.13
147 +"
148 +
149 +S="${WORKDIR}/Telegram"
150 +
151 +src_install() {
152 + exeinto /usr/lib/${PN}
153 + doexe "Telegram"
154 + newbin "${FILESDIR}"/${PN}-r2 "telegram-desktop"
155 +
156 + local icon_size
157 + for icon_size in 16 32 48 64 128 256 512; do
158 + newicon -s "${icon_size}" \
159 + "${WORKDIR}/tdesktop-${PV}/Telegram/Resources/art/icon${icon_size}.png" \
160 + telegram-desktop.png
161 + done
162 +
163 + dodir /etc/${PN}
164 + insinto /etc/${PN}/
165 + doins ${FILESDIR}/fonts.conf
166 +
167 + domenu "${WORKDIR}/tdesktop-${PV}"/lib/xdg/telegramdesktop.desktop
168 +}
169 +
170 +pkg_preinst() {
171 + xdg_pkg_preinst
172 +}
173 +
174 +pkg_postinst() {
175 + xdg_pkg_postinst
176 + gnome2_icon_cache_update
177 + einfo
178 + einfo "Previous versions of ${PN} have created "
179 + einfo "\"~/.local/share/applications/telegram.desktop\". These files"
180 + einfo "conflict with the one shipped by portage and should be removed"
181 + einfo "from all homedirs. (https://bugs.gentoo.org/618662)"
182 + einfo
183 + einfo "This versions fixes fontconfig issues that have been reported"
184 + einfo "by several users. However, the fix might have side-effects on"
185 + einfo "non-latin fonts. If you have font issues with this version just"
186 + einfo "delete \"/etc/${PN}/fonts.conf\" and leave a comment here"
187 + einfo "https://bugs.gentoo.org/664872"
188 +}
189 +
190 +pkg_postrm() {
191 + xdg_pkg_postrm
192 + gnome2_icon_cache_update
193 +}