Date: Wednesday, February 8, 2023 @ 06:25:52
  Author: svenstaro
Revision: 1396051

upgpkg: telegram-desktop 4.6.1-2: Build static patched Qt6

This is what upstream wants us to do and should hopefully fix a bunch
of issues at once.

Modified:
  telegram-desktop/trunk/PKGBUILD

----------+
 PKGBUILD |   61 ++++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 44 insertions(+), 17 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-02-08 06:25:03 UTC (rev 1396050)
+++ PKGBUILD    2023-02-08 06:25:52 UTC (rev 1396051)
@@ -2,46 +2,73 @@
 # Contributor: hexchain <[email protected]>
 pkgname=telegram-desktop
 pkgver=4.6.1
-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'
+         'xcb-util-cursor' 'xcb-util-keysyms' 'xcb-util-wm' 'libxcomposite' 
'libxkbcommon-x11' 'libxrender'
+         'vulkan-headers' 'libproxy' 'double-conversion' 'pcre2')
 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=('980421c5ebff8b3d4fc4c98c2d17b39c0484d58faedfd5cf21639b390f7f23bc4388dfa1e7ea40950a4624b21f6d7a2632ff553fb307ca3e22f40bce2bdda7db')
+_pkgfn=qt-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/single/$_pkgfn.tar.xz
+         
https://github.com/desktop-app/patches/archive/9aa30bc44248eb620a720459ef4c81ed0bb65065.tar.gz)
+sha512sums=('980421c5ebff8b3d4fc4c98c2d17b39c0484d58faedfd5cf21639b390f7f23bc4388dfa1e7ea40950a4624b21f6d7a2632ff553fb307ca3e22f40bce2bdda7db'
+            
'1b41ad1bd3f4b0780e8cd32219a5f0b037dc2c500c491a9e4a5ad7f5844356a3553856eb8aef8d73528a26f9e2bf058318ac239f55962b3368a9539f6c5d1dbe'
+            
'5c00d63bab64dda4f1ce85cbfe0a3ffba233dccf835ada3fb3e533cea9442731afdefd99505e95fdea8eed7cf63430e10c9b181c6049afc6c17dbc2dc63d73a5')
 
 prepare() {
-    cd tdesktop-$pkgver-full
-    rm -rf Telegram/ThirdParty/libtgvoip/webrtc_dsp/absl
+    cd $_pkgfn
+    for p in "$srcdir"/patches-*/qtbase_6_4_2/*.patch; do
+        patch -Np1 -i "$p" -d qtbase;
+    done
+    # cd ../tdesktop-$pkgver-full
+
+    # rm -r Telegram/ThirdParty/libtgvoip/webrtc_dsp/absl
 }
 
 build() {
-    cd tdesktop-$pkgver-full
+    CXXFLAGS+=' -ffat-lto-objects'
+    # Telegram needs a specific and heavily patched version of Qt6 and so we
+    # can't use system dependencies.
+    
QT_BUILD_SUBMODULES="qtdeclarative;qtwayland;qtimageformats;qtsvg;qt5compat;qtshadertools"
 \
+    cmake -B build-qt6-base -S $_pkgfn -G Ninja \
+        -DBUILD_SHARED_LIBS=OFF \
+        -DCMAKE_INSTALL_PREFIX=/usr \
+        -DCMAKE_BUILD_TYPE=Release \
+        -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
+        -DCMAKE_MESSAGE_LOG_LEVEL=STATUS \
+        -DCMAKE_SKIP_RPATH=ON \
+        -DQT_FEATURE_openssl_linked=ON \
+        -DQT_FEATURE_sql=OFF \
+        -DQT_FEATURE_icu=OFF \
+        -DQT_FEATURE_libproxy=ON \
+        -DQT_FEATURE_system_xcb_xinput=ON
+    cmake --build build-qt6-base
+    DESTDIR=qt6-base cmake --install build-qt6-base
 
-    #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!
-    cmake \
-        -B build \
-        -G Ninja \
+    export CMAKE_PREFIX_PATH="$srcdir"/qt6-base/usr
+    cmake -B build -S tdesktop-$pkgver-full -G Ninja \
+        -DCMAKE_VERBOSE_MAKEFILE=ON \
         -DCMAKE_INSTALL_PREFIX="/usr" \
         -DCMAKE_BUILD_TYPE=Release \
         -DTDESKTOP_API_ID=611335 \
         -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
-    ninja -C build
+    cmake --build build
 }
 
 package() {
-    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"
+    DESTDIR="$pkgdir" cmake --install build
 }

Reply via email to