commit:     4cf52650cf5f437a1c845283e1121a251b7083e4
Author:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
AuthorDate: Sat Jan 25 10:05:41 2020 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Sat Jan 25 10:32:08 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cf52650

net-im/telegram-desktop: new package, source version

should work on musl as well

Package-Manager: Portage-2.3.85, Repoman-2.3.20
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 net-im/telegram-desktop/Manifest                   |   1 +
 .../files/0002-PPC-big-endian.patch                |  25 ++++
 .../telegram-desktop/files/0003-PPC-config.patch   |  28 ++++
 net-im/telegram-desktop/files/musl.patch           |  12 ++
 net-im/telegram-desktop/metadata.xml               |  11 ++
 .../telegram-desktop/telegram-desktop-1.9.8.ebuild | 142 +++++++++++++++++++++
 6 files changed, 219 insertions(+)

diff --git a/net-im/telegram-desktop/Manifest b/net-im/telegram-desktop/Manifest
new file mode 100644
index 00000000000..33d52dd8916
--- /dev/null
+++ b/net-im/telegram-desktop/Manifest
@@ -0,0 +1 @@
+DIST tdesktop-1.9.8-full.tar.gz 25225784 BLAKE2B 
d938dc5d82740f93c575f621697e4bae430dc045c18437957bead6cc949ad0643b0422d8fd2a1695af921ea7f259ca323094a4a7821855d842edfaf4f328c840
 SHA512 
5562eb99812a8faec74fe073323d6e04e36311c1e4ce984035212ecfed8bd5d12df92cd0f0022401201136315fb5556971b267b4bf47edf4eeddc9926c7969dc

diff --git a/net-im/telegram-desktop/files/0002-PPC-big-endian.patch 
b/net-im/telegram-desktop/files/0002-PPC-big-endian.patch
new file mode 100644
index 00000000000..b1af3deb587
--- /dev/null
+++ b/net-im/telegram-desktop/files/0002-PPC-big-endian.patch
@@ -0,0 +1,25 @@
+From d4c11502175e2a7821dbd92e029a90d54498e3e8 Mon Sep 17 00:00:00 2001
+From: John Zimmermann <[email protected]>
+Date: Thu, 2 Jan 2020 12:57:33 +0100
+Subject: [PATCH] PPC big endian
+
+---
+ Telegram/SourceFiles/config.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git Telegram/SourceFiles/config.h Telegram/SourceFiles/config.h
+index fb7b54e4d..6a873fbd7 100644
+--- a/Telegram/SourceFiles/config.h
++++ b/Telegram/SourceFiles/config.h
+@@ -177,7 +177,7 @@ constexpr auto ApiHash = 
"344583e45741c457fe1862106095a5eb";
+ #endif // TDESKTOP_API_ID && TDESKTOP_API_HASH
+ 
+ #if Q_BYTE_ORDER == Q_BIG_ENDIAN
+-#error "Only little endian is supported!"
++#warning "Only little endian is supported!"
+ #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN
+ 
+ #if (TDESKTOP_ALPHA_VERSION != 0)
+-- 
+2.24.1
+

diff --git a/net-im/telegram-desktop/files/0003-PPC-config.patch 
b/net-im/telegram-desktop/files/0003-PPC-config.patch
new file mode 100644
index 00000000000..95b7b639d58
--- /dev/null
+++ b/net-im/telegram-desktop/files/0003-PPC-config.patch
@@ -0,0 +1,28 @@
+From af5f8d19f0fdded987beee4568f02cc8dcbd20f4 Mon Sep 17 00:00:00 2001
+From: John Zimmermann <[email protected]>
+Date: Thu, 2 Jan 2020 12:58:45 +0100
+Subject: [PATCH] PPC config
+
+---
+ base/build_config.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git Telegram/lib_base/base/build_config.h 
Telegram/lib_base/base/build_config.h
+index a02c9b0..b3f4860 100644
+--- a/Telegram/lib_base/base/build_config.h
++++ b/Telegram/lib_base/base/build_config.h
+@@ -46,9 +46,9 @@
+ #define ARCH_CPU_X86_FAMILY 1
+ #define ARCH_CPU_X86 1
+ #define ARCH_CPU_32_BITS 1
+-#elif defined(__aarch64__)
++#elif defined(__aarch64__) || defined(__powerpc64__)
+ #define ARCH_CPU_64_BITS 1
+-#elif defined(_M_ARM) || defined(__arm__)
++#elif defined(_M_ARM) || defined(__arm__) || defined(__powerpc__)
+ #define ARCH_CPU_32_BITS 1
+ #else
+ #error Please add support for your architecture in base/build_config.h
+-- 
+2.24.1
+

diff --git a/net-im/telegram-desktop/files/musl.patch 
b/net-im/telegram-desktop/files/musl.patch
new file mode 100644
index 00000000000..dece8ec216f
--- /dev/null
+++ b/net-im/telegram-desktop/files/musl.patch
@@ -0,0 +1,12 @@
+Should send this one upstream; it would work with glibc as well.
+
+--- 
tdesktop-1.9.6-full/Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp.old   
   2020-01-21 12:16:27.000000000 +0000
++++ tdesktop-1.9.6-full/Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp  
2020-01-22 17:44:42.185530350 +0000
+@@ -6,6 +6,7 @@
+ 
+ #include "AudioPulse.h"
+ #include <dlfcn.h>
++#include <libgen.h>
+ #include "../../logging.h"
+ 
+ #define DECLARE_DL_FUNCTION(name) typeof(name)* 
AudioPulse::_import_##name=NULL

diff --git a/net-im/telegram-desktop/metadata.xml 
b/net-im/telegram-desktop/metadata.xml
new file mode 100644
index 00000000000..36b8a035d4c
--- /dev/null
+++ b/net-im/telegram-desktop/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>[email protected]</email>
+               <name>Georgy Yakovlev</name>
+       </maintainer>
+       <use>
+               <flag name="gtk3">Enable GTK3 integration (tray, theme, 
filepicker, etc)</flag>
+       </use>
+</pkgmetadata>

diff --git a/net-im/telegram-desktop/telegram-desktop-1.9.8.ebuild 
b/net-im/telegram-desktop/telegram-desktop-1.9.8.ebuild
new file mode 100644
index 00000000000..a5baf8e9c57
--- /dev/null
+++ b/net-im/telegram-desktop/telegram-desktop-1.9.8.ebuild
@@ -0,0 +1,142 @@
+# Copyright 2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7} )
+
+inherit cmake desktop flag-o-matic python-any-r1 xdg-utils
+
+MY_P="tdesktop-${PV}-full"
+
+DESCRIPTION="Official desktop client for Telegram"
+HOMEPAGE="https://desktop.telegram.org";
+SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz";
+
+LICENSE="GPL-3-with-openssl-exception Unlicense"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64"
+IUSE="dbus gtk3 spell"
+
+RDEPEND="!net-im/telegram-desktop-bin
+       app-arch/lz4
+       app-arch/xz-utils
+       dev-libs/openssl:0
+       dev-libs/xxhash
+       dev-qt/qtcore:5
+       dev-qt/qtgui:5[png,X(-)]
+       dev-qt/qtimageformats:5
+       dev-qt/qtnetwork:5
+       dev-qt/qtwidgets:5[png,X(-)]
+       media-libs/openal[pulseaudio]
+       media-libs/opus
+       media-sound/pulseaudio
+       sys-libs/zlib[minizip]
+       virtual/ffmpeg
+       x11-libs/libva[X,drm]
+       x11-libs/libX11
+       dbus? ( dev-qt/qtdbus:5 )
+       gtk3? (
+               dev-libs/libappindicator:3
+               x11-libs/gtk+:3
+       )
+       spell? ( app-text/enchant )
+"
+
+DEPEND="${RDEPEND}
+       ${PYTHON_DEPS}"
+
+BDEPEND="
+       >=dev-util/cmake-3.16
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       "${FILESDIR}/0002-PPC-big-endian.patch"
+       "${FILESDIR}/0003-PPC-config.patch"
+       "${FILESDIR}/musl.patch"
+)
+
+S="${WORKDIR}/${MY_P}"
+
+src_configure() {
+       local mycxxflags=(
+               -Wno-deprecated-declarations
+               -Wno-error=deprecated-declarations
+               -Wno-switch
+       )
+
+       append-cxxflags "${mycxxflags[@]}"
+
+       local mycmakeargs=(
+               -Ddisable_autoupdate=1
+               -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON
+               -DDESKTOP_APP_USE_GLIBC_WRAPS=OFF
+               -DDESKTOP_APP_USE_PACKAGED=ON
+               -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
+               -DTDESKTOP_DISABLE_DESKTOP_FILE_GENERATION=ON
+               -DTDESKTOP_LAUNCHER_BASENAME="${PN}"
+               -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF
+               -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)"
+               -DTDESKTOP_DISABLE_GTK_INTEGRATION="$(usex gtk3 OFF ON)"
+               -DTDESKTOP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)"
+               -DTDESKTOP_FORCE_GTK_FILE_DIALOG="$(usex gtk3)"
+       )
+
+       if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
+               einfo "Found custom API credentials"
+               mycmakeargs+=(
+                       -DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
+                       -DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
+               )
+       else
+               mycmakeargs+=( -DTDESKTOP_API_TEST=ON )
+               ewarn
+               ewarn "Building ${PN} with test API credentials."
+               ewarn "Connectivity to API servers will be throttled."
+               ewarn "To build ${PN} custom API credentials cancel build now 
and obtain"
+               ewarn "credentials here: 
https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md";
+               ewarn "After getting credentials you can export variables:"
+               ewarn "export MY_TDESKTOP_API_ID=\"17349\""
+               ewarn "export 
MY_TDESKTOP_API_HASH=\"344583e45741c457fe1862106095a5eb\""
+               ewarn "and restart the build"
+               ewarn "you can save variables in 
/etc/portage/env/${CATEGORY}/${PN}"
+               ewarn "portage will use the file every build automatically"
+               ewarn
+       fi
+
+       cmake_src_configure
+}
+
+src_install() {
+       dobin "${BUILD_DIR}/bin/${PN}"
+
+       newmenu lib/xdg/telegramdesktop.desktop "${PN}.desktop"
+
+       local icon_size
+       for icon_size in 16 32 48 64 128 256 512
+       do
+               newicon -s ${icon_size} \
+                       Telegram/Resources/art/icon${icon_size}.png telegram.png
+       done
+
+       insinto /usr/share/appdata
+       doins lib/xdg/telegramdesktop.appdata.xml
+
+       insinto /usr/share/kservices5
+       doins lib/xdg/tg.protocol
+
+       einstalldocs
+}
+
+pkg_postinst() {
+       xdg_desktop_database_update
+       xdg_icon_cache_update
+       xdg_mimeinfo_database_update
+}
+
+pkg_postrm() {
+       xdg_desktop_database_update
+       xdg_icon_cache_update
+       xdg_mimeinfo_database_update
+}

Reply via email to