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= )
27 >=dev-cpp/ms-gsl-2.1.0
31 dev-qt/qtgui:5[jpeg,png,wayland?,X(-)?]
32 dev-qt/qtimageformats:5
35 dev-qt/qtwidgets:5[png,X(-)?]
37 media-libs/fontconfig:=
38 >=media-libs/libtgvoip-2.4.4_p20200301[alsa?,pulseaudio?]
39 media-libs/openal[alsa?,pulseaudio?]
41 media-video/ffmpeg:=[alsa?,opus,pulseaudio?]
42 sys-libs/zlib[minizip]
46 dev-libs/libdbusmenu-qt[qt5(+)]
48 enchant? ( app-text/enchant:= )
49 hunspell? ( >=app-text/hunspell-1.7:= )
50 pulseaudio? ( media-sound/pulseaudio )
64 || ( alsa pulseaudio )
67 ^^ ( enchant hunspell )
71 S="${WORKDIR}/${MY_P}"
73 PATCHES=( "${FILESDIR}/${PV}-kde-dir.patch" )
77 -Wno-deprecated-declarations
78 -Wno-error=deprecated-declarations
82 append-cxxflags "${mycxxflags[@]}"
84 # TODO: unbundle header-only libs, ofc telegram uses git versions...
85 # it fals with tl-expected-1.0.0, so we use bundled for now to avoid git rev snapshots
88 -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON
89 -DDESKTOP_APP_USE_GLIBC_WRAPS=OFF
90 -DDESKTOP_APP_USE_PACKAGED=ON
91 -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF
92 -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
93 -DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF
94 -DTDESKTOP_LAUNCHER_BASENAME="${PN}"
95 -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)"
96 -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)" # enables hunspell (recommended)
97 -DDESKTOP_APP_USE_ENCHANT="$(usex enchant ON OFF)" # enables enchant and disables hunspell
100 if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
101 einfo "Found custom API credentials"
103 -DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
104 -DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
107 # https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
108 # Building with snapcraft API credentials by default
109 # Custom API credentials can be obtained here:
110 # https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
111 # After getting credentials you can export variables:
112 # export MY_TDESKTOP_API_ID="17349""
113 # export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
114 # and restart the build"
115 # you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
116 # portage will use custom variable every build automatically
118 -DTDESKTOP_API_ID="611335"
119 -DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
127 xdg_desktop_database_update
128 xdg_icon_cache_update
129 xdg_mimeinfo_database_update
133 xdg_desktop_database_update
134 xdg_icon_cache_update
135 xdg_mimeinfo_database_update