Index: PKGBUILD =================================================================== --- PKGBUILD (revision 1391892) +++ PKGBUILD (working copy) @@ -2,40 +2,80 @@ # Contributor: hexchain pkgname=telegram-desktop pkgver=4.5.3 -pkgrel=1 +_qtver=6.4.2 +pkgrel=2 pkgdesc='Official Telegram Desktop client' arch=('x86_64') url="https://desktop.telegram.org/" license=('GPL3') depends=('hunspell' 'ffmpeg' 'hicolor-icon-theme' 'lz4' 'minizip' 'openal' 'ttf-opensans' - 'qt6-imageformats' 'qt6-svg' 'qt6-wayland' 'qt6-5compat' 'xxhash' 'glibmm-2.68' - 'rnnoise' 'pipewire' 'libxtst' 'libxrandr' 'jemalloc' 'abseil-cpp' 'libdispatch' - 'openssl-1.1' 'protobuf') + 'xxhash' 'glibmm-2.68' 'rnnoise' 'pipewire' 'libxtst' 'libxrandr' 'jemalloc' 'abseil-cpp' + 'libdispatch' 'openssl-1.1' 'protobuf') makedepends=('cmake' 'git' 'ninja' 'python' 'range-v3' 'tl-expected' 'microsoft-gsl' 'meson' 'extra-cmake-modules' 'wayland-protocols' 'plasma-wayland-protocols' 'libtg_owt') optdepends=('webkit2gtk: embedded browser features' 'xdg-desktop-portal: desktop integration') -source=("https://github.com/telegramdesktop/tdesktop/releases/download/v${pkgver}/tdesktop-${pkgver}-full.tar.gz") -sha512sums=('58a9c5d096e236090347388e1ed480527f841045a80771079dc0c3e35e12ce8ac11753987e87bb57870d9bd8488fc6a4734114648ecec7823d8544744b06c6b1') +_pkgfn=qtbase-everywhere-src-$_qtver +source=("https://github.com/telegramdesktop/tdesktop/releases/download/v${pkgver}/tdesktop-${pkgver}-full.tar.gz" + https://download.qt.io/official_releases/qt/${_qtver%.*}/$_qtver/submodules/$_pkgfn.tar.xz + qt6-base-cflags.patch + qt6-base-nostrip.patch + https://github.com/desktop-app/patches/archive/9aa30bc44248eb620a720459ef4c81ed0bb65065.tar.gz) +sha512sums=('58a9c5d096e236090347388e1ed480527f841045a80771079dc0c3e35e12ce8ac11753987e87bb57870d9bd8488fc6a4734114648ecec7823d8544744b06c6b1' + 'b00cce7bfc29d3a34c9a2f08db147c4bfd962e178916d60033e1845b25eaeaa4fbd42f5c1d7e39453ddb412a4e91c22c8eae52745eda8a47e35a691054d5496e' + 'ce4c2b4aeb70073c1f68d68e9f03746bba5350e09605ca29f64b57c92d3ff9ab27279fe307307273cb4c23fd091bb9056d7b86eb02a802b695499d56b1f79cf0' + 'af061bb56d5079d11407e6eb352fa4af7fefa6aed7f8cc40b5b2d591ef7ff04e9da6c6d534ca1904355ea7552951a1610fdcefb04ef9d696cb2b23ad6a0606e8' + '5c00d63bab64dda4f1ce85cbfe0a3ffba233dccf835ada3fb3e533cea9442731afdefd99505e95fdea8eed7cf63430e10c9b181c6049afc6c17dbc2dc63d73a5') prepare() { - cd tdesktop-$pkgver-full + cd $_pkgfn + patch -Np1 -i ../qt6-base-cflags.patch + patch -Np1 -i ../qt6-base-nostrip.patch + for p in "$srcdir"/patches-*/qtbase_6_4_2/*.patch; do patch -Np1 -i "$p"; done + cd ../tdesktop-$pkgver-full rm -rf Telegram/ThirdParty/libtgvoip/webrtc_dsp/absl } build() { + # Telegram needs a specific and heavily patched version of Qt6 and so we + # can't use system dependencies. + cmake -B build-qt6-base -S $_pkgfn -G Ninja \ + -DBUILD_SHARED_LIBS=OFF \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \ + -DCMAKE_MESSAGE_LOG_LEVEL=STATUS \ + -DCMAKE_SKIP_RPATH=ON \ + -DINSTALL_BINDIR=lib/qt6/bin \ + -DINSTALL_PUBLICBINDIR=usr/bin \ + -DINSTALL_LIBEXECDIR=lib/qt6 \ + -DINSTALL_DOCDIR=share/doc/qt6 \ + -DINSTALL_ARCHDATADIR=lib/qt6 \ + -DINSTALL_DATADIR=share/qt6 \ + -DINSTALL_INCLUDEDIR=include/qt6 \ + -DINSTALL_MKSPECSDIR=lib/qt6/mkspecs \ + -DINSTALL_EXAMPLESDIR=share/doc/qt6/examples \ + -DQT_FEATURE_journald=ON \ + -DQT_FEATURE_openssl_linked=ON \ + -DQT_FEATURE_system_sqlite=ON \ + -DQT_FEATURE_system_xcb_xinput=ON + cmake --build build-qt6-base + DESTDIR=qt6-base cmake --install build-qt6-base + cd tdesktop-$pkgver-full - #Turns out we're allowed to use the official API key that telegram uses for their snap builds: + # Turns out we're allowed to use the official API key that telegram uses for their snap builds: # https://github.com/telegramdesktop/tdesktop/blob/8fab9167beb2407c1153930ed03a4badd0c2b59f/snap/snapcraft.yaml#L87-L88 # Thanks @primeos! + export QT_DIR="$srcdir"/qt6-base cmake \ -B build \ -G Ninja \ -DCMAKE_INSTALL_PREFIX="/usr" \ - -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_BUILD_TYPE=None \ -DTDESKTOP_API_ID=611335 \ - -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c + -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c \ + -DCMAKE_INSTALL_RPATH="\$ORIGIN/../lib/$pkgname" ninja -C build } @@ -43,5 +83,6 @@ cd tdesktop-$pkgver-full DESTDIR="$pkgdir" ninja -C build install # They botched the release and put a lot of stuff here. - rm -rf "$pkgdir/build" + # rm -rf "$pkgdir/build" + # install -D ../build-qt6-base/lib/libQt6OpenGL.so.$_qtver "$pkgdir/usr/lib/$pkgname/libQt6OpenGL.so.${_qtver%%.*}" }