# Maintainer: Leo # Contributor: Leo # TODO(Leo): remove pulseaudio dep, use system xxhash pkgname=telegram-desktop pkgver=1.8.15 # https://github.com/telegramdesktop/tdesktop/blob/v$pkgver/docs/building-cmake.md _catch2_commit=5ca44b68721833ae3731802ed99af67c6f38a53a _gsl_commit=d846fe50a3f0bb7767c7e087a05f4be95f4da0ec _crl_commit=52baf11aaeb7f5ea6955a438abaa1aee4c4308d8 _libtgvoip_commit=d4a0f719ffd8d29e88474f67abc9fc862661c3b9 _rlottie_commit=589db026ec211bc4979e3bffe074f6e48ce7cedc _variant_commit=550ac2f159ca883d360c196149b466955c77a573 _xxhash_commit=7cc9639699f64b750c0b82333dced9ea77e8436e pkgrel=0 pkgdesc="Telegram Desktop messaging app" options="!check" # Requires Catch2 to be packaged. url="https://desktop.telegram.org/" arch="all !s390x" # ARM are failing due to range-v3 license="GPL-3.0-or-later WITH OpenSSL" depends="qt5-qtimageformats libappindicator" makedepends=" dos2unix gyp grep cmake zlib-dev opus-dev libva-dev libvdpau-dev ffmpeg-dev portaudio-dev openal-soft-dev openssl-dev libxkbcommon-dev qt5-qtbase-dev libexif-dev xz-dev minizip-dev alsa-lib-dev libexecinfo-dev python2 rapidjson-dev lz4-dev pulseaudio-dev qtchooser range-v3-dev libdbusmenu-glib-dev libappindicator-dev " source=" $pkgname-$pkgver.tar.gz::https://github.com/telegramdesktop/tdesktop/archive/v$pkgver.tar.gz libtgvoip-$_libtgvoip_commit.tar.gz::https://github.com/telegramdesktop/libtgvoip/archive/$_libtgvoip_commit.tar.gz GSL-$_gsl_commit.tar.gz::https://github.com/Microsoft/GSL/archive/$_gsl_commit.tar.gz variant-$_variant_commit.tar.gz::https://github.com/mapbox/variant/archive/$_variant_commit.tar.gz crl-$_crl_commit.tar.gz::https://github.com/telegramdesktop/crl/archive/$_crl_commit.tar.gz rlottie-$_rlottie_commit.tar.gz::https://github.com/john-preston/rlottie/archive/$_rlottie_commit.tar.gz Catch2-$_catch2_commit.tar.gz::https://github.com/catchorg/Catch2/archive/$_catch2_commit.tar.gz xxhash-$_xxhash_commit.tar.gz::https://github.com/Cyan4973/xxHash/archive/$_xxhash_commit.tar.gz CMakeLists.inj 0001-musl.patch 0002-tdesktop.patch 0003-fix-missing-use-of-pch.patch 0004-xdg.patch 0005-system-wide-fonts.patch 0006-ppc64le-enable-arch.patch 0009-lz4.patch 0010-libtgvoip.patch 0014-clock_gettime.patch 0015-revert-headers.patch 0016-no-gtk2.patch minizip-includes.patch " builddir="$srcdir/tdesktop-$pkgver" prepare() { rmdir Telegram/ThirdParty/libtgvoip rmdir Telegram/ThirdParty/GSL rmdir Telegram/ThirdParty/variant rmdir Telegram/ThirdParty/crl rmdir Telegram/ThirdParty/rlottie rmdir Telegram/ThirdParty/Catch rmdir Telegram/ThirdParty/xxHash # Copy fetched libraries to their appropriate locations mv ../libtgvoip-${_libtgvoip_commit} "$builddir"/Telegram/ThirdParty/libtgvoip mv ../GSL-${_gsl_commit} "$builddir"/Telegram/ThirdParty/GSL mv ../variant-${_variant_commit} "$builddir"/Telegram/ThirdParty/variant mv ../crl-${_crl_commit} "$builddir"/Telegram/ThirdParty/crl mv ../rlottie-${_rlottie_commit} "$builddir"/Telegram/ThirdParty/rlottie mv ../Catch2-${_catch2_commit} "$builddir"/Telegram/ThirdParty/Catch mv ../xxHash-${_xxhash_commit} "$builddir"/Telegram/ThirdParty/xxHash cd "$builddir/Telegram/ThirdParty" rm -rf minizip lz4 # we have these system-wide dos2unix "$builddir/.appveyor/install.bat" default_prepare unix2dos "$builddir/.appveyor/install.bat" # disable static-qt for rlottie sed "/RLOTTIE_WITH_STATIC_QT/d" -i "$builddir/Telegram/gyp/lib_rlottie.gyp" } build() { export LANG=en_US.UTF-8 export GYP_DEFINES="TDESKTOP_DISABLE_CRASH_REPORTS,TDESKTOP_DISABLE_AUTOUPDATE" export GYP_DEFINES="${GYP_DEFINES},TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME" export GYP_DEFINES="${GYP_DEFINES},TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION" export EXTRA_FLAGS="-Winvalid-pch -O2" export CPPFLAGS="$CPPFLAGS $EXTRA_FLAGS" export CXXFLAGS="$CXXFLAGS $EXTRA_FLAGS" gyp \ -Dapi_id=17349 \ -Dapi_hash=344583e45741c457fe1862106095a5eb \ -Dbuild_defines=${GYP_DEFINES} \ -Gconfig=Release \ --depth=Telegram/gyp --generator-output=../.. -Goutput_dir=out \ Telegram/gyp/Telegram.gyp --format=cmake NUM=$(( $(wc -l < out/Release/CMakeLists.txt) - 2)) sed -i "$NUM r ../CMakeLists.inj" out/Release/CMakeLists.txt cd out/Release cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -UTDESKTOP_OFFICIAL_TARGET make } package() { install -dm755 "$pkgdir"/usr/bin install -m755 "$builddir/out/Release/Telegram" "$pkgdir/usr/bin/telegram-desktop" install -d "$pkgdir/usr/share/applications" install -m644 "$builddir/lib/xdg/telegramdesktop.desktop" \ "$pkgdir/usr/share/applications/telegramdesktop.desktop" for icon_size in 16 32 48 64 128 256 512; do icon_dir="$pkgdir/usr/share/icons/hicolor/${icon_size}x$icon_size/apps" install -d "$icon_dir" install -m644 "$builddir/Telegram/Resources/art/icon$icon_size.png" \ "$icon_dir/telegram.png" done } sha512sums="d31fbcc6737a4a00c0d17b000d82cb9c7038aae19a2ea2692a6707623cf83ccd0327d6ff06e4a330a0197073ca9a63b90ebb3d046312b74aaeec318571767a6d telegram-desktop-1.8.15.tar.gz 14eaadcb4ec25e7d603d3965f8dc003f0509bc215916e0f5e092564c76d2a440a8edc9e5e61ae279c0b18edffaa401df6aedc766c1e7355357bfb1c95e2b5f50 libtgvoip-d4a0f719ffd8d29e88474f67abc9fc862661c3b9.tar.gz 83560cb0c39b6a4781e916c6081ad2728296e1b19760ca1b6426a8431fb6d7093760a882c539dd77152f5892fe081b1795af6366ea91385bb10aba6adf27170f GSL-d846fe50a3f0bb7767c7e087a05f4be95f4da0ec.tar.gz 537ce0a1731274da63a5be063311f7113c1391081e43970663a994b82a7b2e860302406c2931184789661d86343b2c60064c7014b73dc42799573f5b93bc12ff variant-550ac2f159ca883d360c196149b466955c77a573.tar.gz cfe28a69cff822fab8ebb4379b105e3d69e610614359ba7b6b91cbf676c23067f75d34f259500ab7fb61d3e4b45a0dd77ee4bf4f0bdc6d6463dab5f3f447f6fe crl-52baf11aaeb7f5ea6955a438abaa1aee4c4308d8.tar.gz 60f2020b103fc2090d3c89f9ba5aeeba5be2d9e01f1954a4abbd7fdfe8ca64c28e86ead1646292bd9b5cb8beb9cb25d8ab077405ebe286007a437ea969ec4a0a rlottie-589db026ec211bc4979e3bffe074f6e48ce7cedc.tar.gz 5b151e0a8c4594b19258a8aade7132521ffbdc97233c9d4a0e5cb2ea31eb9cb3ee51769884a8a08ab821571215ff32854bd76d2929e3b4c14a39e56657109dd6 Catch2-5ca44b68721833ae3731802ed99af67c6f38a53a.tar.gz cada36066c14ed735f8f45a2d1e0c2d1bdb564dc18154aaabc12552d41065426d88cdeb8a67b8e697678b01f2e415c0a6caf428baa591d013739d7ac95048d4d xxhash-7cc9639699f64b750c0b82333dced9ea77e8436e.tar.gz 5361828c11d3653552db28d4695891766468a7b785611da5b33a8865e953a9e2c0dac79601bf2b2098f496bdccfdf4d8ede45d466e0187c18b23336d8e5dfddf CMakeLists.inj 74e8adfe9cb6c224b12fb653798be1abb55cff40f326a9542e5ae23fb82b57a117b5f74dc8a2af80efcd8e261bbbc46c8e5c10fdb6a55ae3196429fd67afd183 0001-musl.patch d9812a06ae4cf3599e74a77ff23b94519cf1469c0ace5dade886f8cddeb0a72e037e82ab6bc61aa587702329a4521ed296173f8b5cf771430021e172c53885f3 0002-tdesktop.patch 6289d5a3eb224ebb05ab64e23ca3d081e617d905cec07edbba423265dc617548005eeb643ce5dfb2fcef9ac774e9f7b64150729bd894ca0e94af0e2aea9c823b 0003-fix-missing-use-of-pch.patch 8de8c0508177da5fcac4f2dcee4d8baef4b99f74f1dca296567bc3689a6bd17a47c1c945df504abc8811b82a687010d0709503c7c32e47d2ebb1cf0e374c80c5 0004-xdg.patch 0a6104710a2d98ba38b97e0a35c08f17d86ece05090d89d9de17b88652bcf6035c13cff31f48f94d9caa4e80bfb9d87448c88ce4c282ff972312daf819f7437d 0005-system-wide-fonts.patch 3647ad5fff6326ba9c75fa98189a08c0909af8d1c2b704c8c62fd9da6603f5162af3176c37daa67eb5896bebe3814bf1fd66b9e93c78cbd9b439e472d0db4b44 0006-ppc64le-enable-arch.patch d1fc59b573c857a64607a8d08e916ab668facd01404cabe1c7ea451e272133c8819c79b71635df9a23292a8c1c0ebd4d8b95ffe6cbcaaf831726b8af18486bab 0009-lz4.patch 7d5642672f42f435e206acd047a20b7e38346ed95548f16c0059913546e4e4f54a58927fccb8c1da8e43b6a691bbce2a9608d0db032774d7874d4800e7202d53 0010-libtgvoip.patch e1a3c7c7d593dc50b234202e9fdf5ff145a105b828a8373d4e52009c395e26b10faa58bb028a44aaf122debe1ed60a7e66033687fac686f13c4455084da986df 0014-clock_gettime.patch d564ee17a610864b1708f7ad1050804e24921b8bb3c4da9713f804b3738ba63d6ee0e594b3fe7c28d0fb9a082a22021b1c7f2b60498265bbca08e89775a4f60a 0015-revert-headers.patch 117b0c2bae3d3d3aa94d41382621be4e05c3314a2831dba59e1bcfb443e7b8ff4bcd0403544fa0cb6def85b444146bf59eef9da25f96b041d3ce8f5429b4a867 0016-no-gtk2.patch 99e3e72a93473b45f2912ed1c553662506c5e332c949b5e879965309bcdf6f8735836a51a0f72ebec617f1afd9cad615cc62dfd57a584d79a0d421066167c3d9 minizip-includes.patch"