1 # Copyright 2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python3_{6,7,8} )
8 inherit cmake desktop flag-o-matic python-any-r1 xdg-utils
10 MY_P="tdesktop-${PV}-full"
12 DESCRIPTION="Official desktop client for Telegram"
13 HOMEPAGE="https://desktop.telegram.org"
14 SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
16 LICENSE="GPL-3-with-openssl-exception"
18 KEYWORDS="~amd64 ~ppc64"
19 IUSE="+alsa +dbus enchant +hunspell libressl pulseaudio +spell wayland +X"
22 !net-im/telegram-desktop-bin
25 !libressl? ( dev-libs/openssl:0= )
26 libressl? ( dev-libs/libressl:0= )
30 dev-qt/qtgui:5[jpeg,png,wayland?,X(-)?]
31 dev-qt/qtimageformats:5
34 dev-qt/qtwidgets:5[png,X(-)?]
36 media-libs/fontconfig:=
37 >=media-libs/libtgvoip-2.4.4_p20200301[alsa?,pulseaudio?]
38 media-libs/openal[alsa?,pulseaudio?]
40 media-video/ffmpeg:=[alsa?,opus,pulseaudio?]
41 sys-libs/zlib[minizip]
45 dev-libs/libdbusmenu-qt[qt5(+)]
47 enchant? ( app-text/enchant:= )
48 hunspell? ( >=app-text/hunspell-1.7:= )
49 pulseaudio? ( media-sound/pulseaudio )
63 || ( alsa pulseaudio )
66 ^^ ( enchant hunspell )
70 S="${WORKDIR}/${MY_P}"
73 if has ccache ${FEATURES}; then
75 ewarn "ccache does not work with ${PN} out of the box"
76 ewarn "due to usage of precompiled headers"
77 ewarn "check bug https://bugs.gentoo.org/715114 for more info"
84 -Wno-deprecated-declarations
85 -Wno-error=deprecated-declarations
89 append-cxxflags "${mycxxflags[@]}"
91 # TODO: unbundle header-only libs, ofc telegram uses git versions...
92 # it fals with tl-expected-1.0.0, so we use bundled for now to avoid git rev snapshots
94 # TODO: unbundle GSL, version 3.0.1 required and has nasty googletest dep
96 -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON
97 -DDESKTOP_APP_USE_GLIBC_WRAPS=OFF
98 -DDESKTOP_APP_USE_PACKAGED=ON
99 -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF
100 -DDESKTOP_APP_USE_PACKAGED_GSL=OFF
101 -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
102 -DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF
103 -DTDESKTOP_LAUNCHER_BASENAME="${PN}"
104 -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)"
105 -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)" # enables hunspell (recommended)
106 -DDESKTOP_APP_USE_ENCHANT="$(usex enchant ON OFF)" # enables enchant and disables hunspell
109 if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
110 einfo "Found custom API credentials"
112 -DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
113 -DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
116 # https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
117 # Building with snapcraft API credentials by default
118 # Custom API credentials can be obtained here:
119 # https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
120 # After getting credentials you can export variables:
121 # export MY_TDESKTOP_API_ID="17349""
122 # export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
123 # and restart the build"
124 # you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
125 # portage will use custom variable every build automatically
127 -DTDESKTOP_API_ID="611335"
128 -DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
136 xdg_desktop_database_update
137 xdg_icon_cache_update
138 xdg_mimeinfo_database_update
142 xdg_desktop_database_update
143 xdg_icon_cache_update
144 xdg_mimeinfo_database_update