summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ec4ca02c2178ddaf0836cae4e9460bc668fe4f1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Maintainer: westpain <homicide@disroot.org>
pkgname=rabbitgram-desktop-git
pkgver=4.10.3.r0.g597c15bbf
pkgrel=2
pkgdesc='Unofficial desktop version of Telegram messaging app'
arch=('x86_64' 'aarch64')
url="https://github.com/rabbitGramDesktop/rabbitGramDesktop"
license=('GPL3')
depends=('hunspell' 'ffmpeg' 'hicolor-icon-theme' 'lz4' 'minizip' 'openal' 'rnnoise' 'ttf-opensans' 'glibmm-2.68'
         'qt6-imageformats' 'qt6-svg' 'qt6-wayland' 'xxhash'
         'pipewire' 'libxtst' 'libxrandr' 'jemalloc' 'abseil-cpp' 'libdispatch'
         'openssl' 'protobuf')
makedepends=('cmake' 'git' 'ninja' 'python' 'boost' 'fmt' 'range-v3' 'tl-expected' 'microsoft-gsl' 'meson'
             'extra-cmake-modules' 'wayland-protocols' 'plasma-wayland-protocols' 'libtg_owt'
             'gobject-introspection' 'mm-common')
optdepends=('webkit2gtk: embedded browser features'
            'xdg-desktop-portal: desktop integration')
provides=('rabbitgram-desktop')
conflicts=('rabbitgram-desktop' 'exteragram-desktop' 'exteragram-desktop-git')
source=("tdesktop::git+https://github.com/rabbitGramDesktop/rabbitGramDesktop.git#branch=dev"
        "telegram-desktop-libtgvoip::git+https://github.com/telegramdesktop/libtgvoip.git"
        "telegram-desktop-GSL::git+https://github.com/desktop-app/GSL.git"
        "telegram-desktop-xxHash::git+https://github.com/Cyan4973/xxHash.git"
        "telegram-desktop-rlottie::git+https://github.com/desktop-app/rlottie.git"
        "telegram-desktop-lz4::git+https://github.com/lz4/lz4.git"
        "telegram-desktop-lib_crl::git+https://github.com/desktop-app/lib_crl.git"
        "telegram-desktop-lib_rpl::git+https://github.com/desktop-app/lib_rpl.git"
        "telegram-desktop-lib_base::git+https://github.com/desktop-app/lib_base.git"
        "telegram-desktop-codegen::git+https://github.com/desktop-app/codegen.git"
        "telegram-desktop-lib_ui::git+https://github.com/desktop-app/lib_ui.git"
        "telegram-desktop-lib_lottie::git+https://github.com/desktop-app/lib_lottie.git"
        "telegram-desktop-lib_tl::git+https://github.com/desktop-app/lib_tl.git"
        "telegram-desktop-lib_spellcheck::git+https://github.com/desktop-app/lib_spellcheck.git"
        "telegram-desktop-lib_storage::git+https://github.com/desktop-app/lib_storage.git"
        "telegram-desktop-cmake::git+https://github.com/desktop-app/cmake_helpers.git"
        "telegram-desktop-expected::git+https://github.com/TartanLlama/expected.git"
        "telegram-desktop-QR::git+https://github.com/nayuki/QR-Code-generator.git"
        "telegram-desktop-lib_qr::git+https://github.com/desktop-app/lib_qr.git"
        "telegram-desktop-hunspell::git+https://github.com/hunspell/hunspell.git"
        "telegram-desktop-range-v3::git+https://github.com/ericniebler/range-v3.git"
        "telegram-desktop-fcitx-qt5::git+https://github.com/fcitx/fcitx-qt5.git"
        "telegram-desktop-nimf::git+https://github.com/hamonikr/nimf.git"
        "telegram-desktop-hime::git+https://github.com/hime-ime/hime.git"
        "telegram-desktop-fcitx5-qt::git+https://github.com/fcitx/fcitx5-qt.git"
        "telegram-desktop-lib_webrtc::git+https://github.com/desktop-app/lib_webrtc.git"
        "telegram-desktop-tgcalls::git+https://github.com/TelegramMessenger/tgcalls.git"
        "telegram-desktop-lib_webview::git+https://github.com/desktop-app/lib_webview.git"
        "telegram-desktop-jemalloc::git+https://github.com/jemalloc/jemalloc.git"
        "telegram-desktop-dispatch::git+https://github.com/apple/swift-corelibs-libdispatch.git"
        "telegram-desktop-plasma-wayland-protocols::git+https://github.com/KDE/plasma-wayland-protocols.git"
        "telegram-desktop-wayland-protocols::git+https://github.com/gitlab-freedesktop-mirrors/wayland-protocols.git"
        "telegram-desktop-kimageformats::git+https://github.com/KDE/kimageformats.git"
        "telegram-desktop-kcoreaddons::git+https://github.com/KDE/kcoreaddons.git"
        "telegram-desktop-cld3::git+https://github.com/google/cld3.git"
        "cppgir::git+https://gitlab.com/mnauw/cppgir.git"
        "cppgir-expected-lite::git+https://github.com/martinmoene/expected-lite.git"
        "fix-arch-linux-desktop-portal.patch"
        "workaround-for-dbusactivatable.patch"
        "qt_scale_factor-fix.patch_"
)
prepare() {
    #
    # Applying custom patches
    #
    for patch_filepath in *.patch; do
        echo "Applying patch $patch_filepath"

        patch -i $patch_filepath -u -p0 -N -r- || true
    done

    if [[ $PATCH_QT_SCALING -eq 1 ]]; then
        echo "Applying QT_SCALE_FACTOR patch!"

        patch -i qt_scale_factor-fix.patch_ -u -p0 -N -r- || true
    fi

    #
    # Patch end
    #

    cd "$srcdir/tdesktop"
    git submodule init
    git config submodule.Telegram/ThirdParty/libtgvoip.url "$srcdir/telegram-desktop-libtgvoip"
    git config submodule.Telegram/ThirdParty/GSL.url "$srcdir/telegram-desktop-GSL"
    git config submodule.Telegram/ThirdParty/xxHash.url "$srcdir/telegram-desktop-xxHash"
    git config submodule.Telegram/ThirdParty/rlottie.url "$srcdir/telegram-desktop-rlottie"
    git config submodule.Telegram/ThirdParty/lz4.url "$srcdir/telegram-desktop-lz4"
    git config submodule.Telegram/lib_crl.url "$srcdir/telegram-desktop-lib_crl"
    git config submodule.Telegram/lib_rpl.url "$srcdir/telegram-desktop-lib_rpl"
    git config submodule.Telegram/lib_base.url "$srcdir/telegram-desktop-lib_base"
    git config submodule.Telegram/codegen.url "$srcdir/telegram-desktop-codegen"
    git config submodule.Telegram/lib_ui.url "$srcdir/telegram-desktop-lib_ui"
    git config submodule.Telegram/lib_lottie.url "$srcdir/telegram-desktop-lib_lottie"
    git config submodule.Telegram/lib_tl.url "$srcdir/telegram-desktop-lib_tl"
    git config submodule.Telegram/lib_spellcheck.url "$srcdir/telegram-desktop-lib_spellcheck"
    git config submodule.Telegram/lib_storage.url "$srcdir/telegram-desktop-lib_storage"
    git config submodule.cmake.url "$srcdir/telegram-desktop-cmake"
    git config submodule.Telegram/ThirdParty/expected.url "$srcdir/telegram-desktop-expected"
    git config submodule.Telegram/ThirdParty/QR.url "$srcdir/telegram-desktop-QR"
    git config submodule.Telegram/lib_qr.url "$srcdir/telegram-desktop-lib_qr"
    git config submodule.Telegram/ThirdParty/hunspell.url "$srcdir/telegram-desktop-hunspell"
    git config submodule.Telegram/ThirdParty/range-v3.url "$srcdir/telegram-desktop-range-v3"
    git config submodule.Telegram/ThirdParty/fcitx-qt5.url "$srcdir/telegram-desktop-fcitx-qt5"
    git config submodule.Telegram/ThirdParty/nimf.url "$srcdir/telegram-desktop-nimf"
    git config submodule.Telegram/ThirdParty/hime.url "$srcdir/telegram-desktop-hime"
    git config submodule.Telegram/ThirdParty/fcitx5-qt.url "$srcdir/telegram-desktop-fcitx5-qt"
    git config submodule.Telegram/lib_webrtc.url "$srcdir/telegram-desktop-lib_webrtc"
    git config submodule.Telegram/ThirdParty/tgcalls.url "$srcdir/telegram-desktop-tgcalls"
    git config submodule.Telegram/lib_webview.url "$srcdir/telegram-desktop-lib_webview"
    git config submodule.Telegram/ThirdParty/jemalloc.url "$srcdir/telegram-desktop-jemalloc"
    git config submodule.Telegram/ThirdParty/dispatch.url "$srcdir/telegram-desktop-dispatch"
    git config submodule.Telegram/ThirdParty/plasma-wayland-protocols.url "$srcdir/telegram-desktop-plasma-wayland-protocols"
    git config submodule.Telegram/ThirdParty/wayland-protocols.url "$srcdir/telegram-desktop-wayland-protocols"
    git config submodule.Telegram/ThirdParty/kimageformats.url "$srcdir/telegram-desktop-kimageformats"
    git config submodule.Telegram/ThirdParty/kcoreaddons.url "$srcdir/telegram-desktop-kcoreaddons"
    git config submodule.Telegram/ThirdParty/cld3.url "$srcdir/telegram-desktop-cld3"
    git -c protocol.file.allow=always submodule update

    cd "$srcdir/tdesktop/cmake"
    git submodule init
    git config submodule.external/glib/cppgir.url "$srcdir/cppgir"
    git -c protocol.file.allow=always submodule update

    cd "$srcdir/tdesktop/cmake/external/glib/cppgir"
    git submodule init
    git config submodule.expected-lite.url "$srcdir/cppgir-expected-lite"
    git -c protocol.file.allow=always submodule update
}

build() {
    cd "$srcdir/tdesktop"

    export PKG_CONFIG_PATH='/usr/lib/ffmpeg4.4/pkgconfig'
    cmake \
        -B build \
        -G Ninja \
        -DCMAKE_INSTALL_PREFIX="/usr" \
        -DCMAKE_BUILD_TYPE=Release \
        -DTDESKTOP_API_ID=2040 \
        -DTDESKTOP_API_HASH=b18441a1ff607e10a989891a5462e627 \
        -DDESKTOP_APP_DISABLE_AUTOUPDATE=True \
        -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
    # Use Qt5 for the time being until kwayland has an easier way to work with Qt6.
    ninja -C build
}

package() {
    cd "$srcdir/tdesktop"
    DESTDIR=$pkgdir ninja -C build install
}

pkgver() {
    cd "$srcdir/tdesktop"
    git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

sha512sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'SKIP'
            'a69525873609afda7c7a08c7045595cd558880c7b5e5b5ab27b12b3cb0db1c3b424b80f165b96101d7225b11a671578c815e66d1abb4f0637d0deff9911406e2'
            'fe8568a4e1c225102d78c7935bd6324be5369cd0efbbcb497f1e95371bd524cefe3019b9c28f316f9a9bc3dcc8be5e45c80714d24dd02efcd704f91589e82961'
            '8c2b0e1d4e5e91c4453e99cdbf70a38eda9833a109a1c31ce61795492d1935790fc1569764006e0478f0be0c192d1773986f4a47f722794f90b51626b73ebb58')