SUMMARY="Telegram Desktop Messenger" DESCRIPTION="Unofficial build of the original Telegram client for Haiku." HOMEPAGE="https://www.telegram.org/" COPYRIGHT="2013-2025 Telegram" LICENSE="GNU GPL v3" REVISION="1" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" CHECKSUM_SHA256="856be2d5cc772a2511f6e861b7c3f122385d3b3424c35cd45776fcbfd648a66d" SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz" SOURCE_DIR="tdesktop-$portVersion-full" SOURCE_URI_2="https://github.com/ada-url/ada/releases/download/v2.9.0/singleheader.zip" CHECKSUM_SHA256_2="20b09948cf58362abe4de20b8e709d5041477fb798350fd1a02cde6aad121e08" srcGitRev_3="2b383fe05f8ae78ac99470b9a2b9ea22b3ee5a92" SOURCE_URI_3="https://salsa.debian.org/debian/telegram-desktop/-/raw/$srcGitRev_3/debian/rules#noarchive" CHECKSUM_SHA256_3="613e7e357518739e1f7d035337f37c344b248283fd4d916ddc95df73c2ff84ad" PATCHES=" libtgvoip-$portVersion.patchset telegram_desktop-$portVersion.patchset pch_disable-$portVersion.patchset " ADDITIONAL_FILES="telegram_desktop.rdef.in" ARCHITECTURES="all !x86_gcc2" SECONDARY_ARCHITECTURES="x86" PROVIDES=" telegram_desktop$secondaryArchSuffix = $portVersion app:Telegram " REQUIRES=" haiku$secondaryArchSuffix lib:libabsl_strings$secondaryArchSuffix lib:libatomic$secondaryArchSuffix lib:libavcodec$secondaryArchSuffix lib:libavformat$secondaryArchSuffix lib:libavutil$secondaryArchSuffix lib:libboost_filesystem$secondaryArchSuffix lib:libboost_regex$secondaryArchSuffix lib:libboost_system$secondaryArchSuffix lib:libboost_program_options$secondaryArchSuffix lib:libcrypto$secondaryArchSuffix lib:libfmt$secondaryArchSuffix lib:libgirepository_1.0$secondaryArchSuffix lib:libgiomm_2.68$secondaryArchSuffix lib:libglib_2.0$secondaryArchSuffix lib:libglibmm_2.68$secondaryArchSuffix lib:libgthread_2.0$secondaryArchSuffix lib:libhunspell_1.7$secondaryArchSuffix lib:libintl$secondaryArchSuffix lib:libjpeg$secondaryArchSuffix lib:liblz4$secondaryArchSuffix lib:liblzma$secondaryArchSuffix lib:libminizip$secondaryArchSuffix lib:libopenal$secondaryArchSuffix lib:libopenh264$secondaryArchSuffix lib:libopus$secondaryArchSuffix lib:libprotobuf$secondaryArchSuffix lib:libqrcodegen$secondaryArchSuffix lib:libQt6Core$secondaryArchSuffix lib:libQt6Gui$secondaryArchSuffix lib:libQt6Network$secondaryArchSuffix lib:libQt6Svg$secondaryArchSuffix lib:libQt6Widgets$secondaryArchSuffix lib:librnnoise$secondaryArchSuffix lib:libsigc_3.0$secondaryArchSuffix lib:libstdc++$secondaryArchSuffix lib:libswresample$secondaryArchSuffix lib:libswscale$secondaryArchSuffix lib:libvpx$secondaryArchSuffix lib:libxxhash$secondaryArchSuffix lib:libz$secondaryArchSuffix qt6_imageformats$secondaryArchSuffix open_sans " BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel qt6_tools${secondaryArchSuffix}_devel devel:libabsl_strings$secondaryArchSuffix >= 2301.0.0 devel:libavcodec$secondaryArchSuffix >= 60 devel:libboost_filesystem$secondaryArchSuffix >= 1.83.0 devel:libboost_regex$secondaryArchSuffix >= 1.83.0 devel:libboost_system$secondaryArchSuffix >= 1.83.0 devel:libboost_program_options$secondaryArchSuffix >= 1.83.0 devel:libcrypto$secondaryArchSuffix >= 3 devel:libfmt$secondaryArchSuffix devel:libgirepository_1.0$secondaryArchSuffix devel:libglib_2.0$secondaryArchSuffix devel:libglibmm_2.68$secondaryArchSuffix devel:libgthread_2.0$secondaryArchSuffix devel:libhunspell_1.7$secondaryArchSuffix devel:libjpeg$secondaryArchSuffix devel:liblz4$secondaryArchSuffix devel:liblzma$secondaryArchSuffix devel:libminizip$secondaryArchSuffix devel:libopenal$secondaryArchSuffix devel:libopenh264$secondaryArchSuffix devel:libopus$secondaryArchSuffix devel:libprotobuf$secondaryArchSuffix devel:libqrcodegen$secondaryArchSuffix devel:libQt6Core$secondaryArchSuffix devel:libQt6Gui$secondaryArchSuffix devel:libQt6Network$secondaryArchSuffix devel:libQt6Svg$secondaryArchSuffix devel:libQt6Widgets$secondaryArchSuffix devel:librapidjson$secondaryArchSuffix devel:librnnoise$secondaryArchSuffix devel:libsigc_3.0$secondaryArchSuffix devel:libtg_owt$secondaryArchSuffix devel:libvpx$secondaryArchSuffix devel:libxxhash$secondaryArchSuffix devel:libz$secondaryArchSuffix " BUILD_PREREQUIRES=" makefile_engine cmd:cmake cmd:find cmd:gawk cmd:gcc$secondaryArchSuffix cmd:g_ir_scanner cmd:make cmd:lld >= 19 cmd:ninja cmd:patch cmd:pkg_config$secondaryArchSuffix cmd:python3.10 cmd:sed cmd:xargs cmd:yasm " PATCH() { if [ $targetArchitecture == x86_gcc2 ]; then cd $sourceDir patch -p1 < $sourceDir/pch_disable.patchset fi } BUILD() { export DISABLE_ASLR=1 export GI_GIR_PATH="`finddir B_SYSTEM_DATA_DIRECTORY`"/gir-1.0 local DISABLE_PRECOMPILE_HEADERS="OFF" local CXX_FLAGS_RELEASE="-O3" if [ $targetArchitecture == x86_gcc2 ]; then sed -i -e '/-fstack-protector-all/d' cmake/options_linux.cmake sed -i -e '/_GLIBCXX_ASSERTIONS/d' cmake/options_linux.cmake DISABLE_PRECOMPILE_HEADERS="ON" CXX_FLAGS_RELEASE="-O1 -fuse-ld=lld -Wl,--no-keep-memory -Wl,--undefined-version" fi # copy ada library files cp $sourceDir2/ada.* Telegram/SourceFiles/iv # get API_ID and API_HASH from Debian local TELEGRAM_API_ID=`sed -n "/TDESKTOP_API_ID/p" $sourceDir3/rules | cut -d'=' -f2 | cut -d' ' -f1` local TELEGRAM_API_HASH=`sed -n "/TDESKTOP_API_HASH/p" $sourceDir3/rules | cut -d'=' -f2 | cut -d' ' -f1` if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then TELEGRAM_API_ID="17349" TELEGRAM_API_HASH="344583e45741c457fe1862106095a5eb" echo -e "\e[91m***************************************************************************\e[39m" echo -e "\e[91m Use demo API_ID = $TELEGRAM_API_ID and API_HASH = $TELEGRAM_API_HASH \e[39m" echo -e "\e[91m***************************************************************************\e[39m" else echo -e "\e[32m***************************************************************************\e[39m" echo -e "\e[32m Use custom API_ID = $TELEGRAM_API_ID and API_HASH = $TELEGRAM_API_HASH \e[39m" echo -e "\e[32m***************************************************************************\e[39m" fi cmake -S . -B build -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS_RELEASE="$CXX_FLAGS_RELEASE" \ -DCMAKE_DISABLE_PRECOMPILE_HEADERS=$DISABLE_PRECOMPILE_HEADERS \ -DBoost_USE_STATIC_LIBS=OFF \ -DBUILD_SHARED_LIBS=ON \ -DTDESKTOP_API_TEST=OFF \ -DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \ -DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \ -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \ -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \ -DDESKTOP_APP_DISABLE_GTK_INTEGRATION=ON \ -DDESKTOP_APP_DISABLE_JEMALLOC=ON \ -DDESKTOP_APP_DISABLE_WEBKITGTK=ON \ -DDESKTOP_APP_DISABLE_SCUDO=ON \ -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=ON \ -DDESKTOP_APP_DISABLE_X11_INTEGRATION=ON \ -DDESKTOP_APP_USE_PACKAGED_FONTS=ON \ -DDESKTOP_APP_USE_HUNSPELL_ONLY=ON \ -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \ -DLIBTGVOIP_DISABLE_ALSA=ON \ -DLIBTGVOIP_DISABLE_PULSEAUDIO=ON \ -DTDESKTOP_API_ID=$TELEGRAM_API_ID \ -DTDESKTOP_API_HASH=$TELEGRAM_API_HASH \ -DLZ4_INCLUDE_DIRS=/system/$relativeIncludeDir ninja -C build -v $jobArgs cd SendToAddon make $jobArgs } INSTALL() { mkdir -p $appsDir cp build/bin/Telegram $appsDir strip $appsDir/Telegram pushd SendToAddon make install INSTALL_DIR=$addOnsDir/Tracker popd local APP_SIGNATURE="application/x-vnd.telegram" local MAJOR="`echo "$portVersion" | cut -d. -f1`" local MIDDLE="`echo "$portVersion" | cut -d. -f2`" local MINOR="`echo "$portVersion" | cut -d. -f3`" local LONG_INFO="$SUMMARY" sed \ -e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \ -e "s|@MAJOR@|$MAJOR|" \ -e "s|@MIDDLE@|$MIDDLE|" \ -e "s|@MINOR@|$MINOR|" \ -e "s|@LONG_INFO@|$LONG_INFO|" \ $portDir/additional-files/telegram_desktop.rdef.in > build/telegram_desktop.rdef addResourcesToBinaries build/telegram_desktop.rdef $appsDir/Telegram addAppDeskbarSymlink $appsDir/Telegram }