You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.8 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit desktop optfeature xdg
DESCRIPTION="Official desktop client for Telegram (binary package)"
HOMEPAGE="https://desktop.telegram.org"
hashbin="_f79d601e26a782fd149b3ffb098aae9f"
SRC_URI="
https://github.com/telegramdesktop/tdesktop/archive/v${PV}.tar.gz -> tdesktop-${PV}.tar.gz
amd64? ( https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/tsetup.${PV}.tar.xz )
"
LICENSE="GPL-3-with-openssl-exception"
SLOT="0"
KEYWORDS="-* ~amd64"
QA_PREBUILT="usr/bin/telegram-desktop"
RDEPEND="
!net-im/telegram-desktop
sys-libs/glibc
dev-libs/glib:2
>=media-libs/fontconfig-2.13
media-libs/freetype:2
virtual/opengl
x11-libs/gtk+:3[X,wayland]
x11-libs/libX11
>=x11-libs/libxcb-1.10[xkb]
"
RESTRICT="bindist mirror strip"
S="${WORKDIR}/Telegram"
src_prepare() {
default
mkdir -p "${WORKDIR}/usr/share/mime/packages/" || die
cp -r "${WORKDIR}/tdesktop-${PV}/lib/xdg/"*.xml "${WORKDIR}/usr/share/mime/packages/" || die
sed -i -E -e 's/^Exec=.*telegram-desktop/Exec=\/usr\/bin\/telegram-desktop/' \
"${WORKDIR}/tdesktop-${PV}"/lib/xdg/org.telegram.desktop.service || die
#Добавим HASH для desktop-файла, иначе при запуске с ярлыка будет падать с ошибкой.
#У каждого бинарного файла HASH свой.
#Чтобы узнать HASH, необходимо создать папку TelegramForcePortable рядом с бинарным файлом Telegram.
#При запуске содаётся журнал, где можно подсмотреть HASH командой:
# grep "] App ID:" TelegramForcePortable/log.txt
mv "${WORKDIR}/tdesktop-${PV}"/lib/xdg/org.telegram.desktop.desktop \
"${WORKDIR}/tdesktop-${PV}"/lib/xdg/org.telegram.desktop.${hashbin}.desktop || die
}
src_install() {
newbin Telegram telegram-desktop
insinto /etc/tdesktop
newins - externalupdater <<<"${EPREFIX}/usr/bin/telegram-desktop"
for icon in "${WORKDIR}/tdesktop-${PV}/Telegram/Resources/art/"icon*.png; do
if [[ ${icon} =~ "^_" ]] ; then
size=${icon##*/icon}
size=${size%.png}
size=${size%\@2x}
dodir "/usr/share/icons/hicolor/${size}/apps"
if [[ ${icon} =~ "@2x" ]] ; then
newicon -s ${size%%x*} "$icon" ${PN}@2x.png
else newicon -s ${size%%x*} "$icon" ${PN}.png
fi
fi
done
dosym ../icons/hicolor/512x512/apps/${PN}.png \
/usr/share/pixmaps/${PN}.png
domenu "${WORKDIR}/tdesktop-${PV}"/lib/xdg/*.desktop
insinto /usr/share/dbus-1/services
doins "${WORKDIR}/tdesktop-${PV}"/lib/xdg/*.service
cp -Lr "${WORKDIR}/usr/"* "${D}/usr/" || die
}
pkg_postinst() {
rm -f /home/*/.local/share/applications/org.telegram.desktop.*
rm -f /home/*/.local/share/applications/mimeinfo.cache
xdg_pkg_postinst
optfeature "spell checker support" app-text/enchant
}