summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 35a01e54cf56598063fea5f9ea8367d664db96a7 (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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# Maintainer:
# Contributor: westpain <homicide@disroot.org>
# Contributor: rikki48 <xdxdxdxdlmao@mail.ru>

## options
: ${_branch:=dev}

_pkgname="ayugram-desktop"
pkgname="$_pkgname-git"
pkgver=5.8.3.r0.g87da02a
pkgrel=1
pkgdesc="Desktop Telegram client with good customization and Ghost mode"
url="https://github.com/AyuGram/AyuGramDesktop"
license=('GPL-3.0-or-later')
arch=('x86_64' 'aarch64')

depends=(
  ada
  ffmpeg
  hunspell
  jemalloc
  kcoreaddons
  libdispatch
  libpipewire
  libvpx
  libxcomposite
  libxdamage
  libxrandr
  libxtst
  minizip
  openal
  openh264
  opus
  protobuf
  qt6-base
  qt6-declarative
  qt6-svg
  qt6-wayland
  rnnoise
  xcb-util-keysyms
  xxhash
)
makedepends=(
  boost
  cmake
  extra-cmake-modules
  fmt
  git
  glib2-devel
  gobject-introspection
  libtg_owt
  microsoft-gsl
  mm-common
  ninja
  perl-xml-parser
  plasma-wayland-protocols
  python
  python-packaging
  range-v3
  tl-expected
  wayland-protocols
)
optdepends=(
  'webkit2gtk: embedded browser features'
  'xdg-desktop-portal: desktop integration'
)

provides=("$_pkgname")
conflicts=("$_pkgname")

_source_main() {
  _pkgsrc="$_pkgname"
  source=("$_pkgsrc"::"git+$url.git#branch=${_branch:-dev}")
  sha256sums=('SKIP')
}

_source_ayugram() {
  source+=(
    #'apple.swift-corelibs-libdispatch'::'git+https://github.com/apple/swift-corelibs-libdispatch.git'
    'ayugram.codegen'::'git+https://github.com/AyuGram/codegen.git'
    'ayugram.lib_tl'::'git+https://github.com/AyuGram/lib_tl.git'
    'ayugram.lib_ui'::'git+https://github.com/AyuGram/lib_ui.git'
    'cyan4973.xxhash'::'git+https://github.com/Cyan4973/xxHash.git'
    'desktop-app.cmake_helpers'::'git+https://github.com/desktop-app/cmake_helpers.git'
    'desktop-app.lib_base'::'git+https://github.com/desktop-app/lib_base.git'
    'desktop-app.lib_crl'::'git+https://github.com/desktop-app/lib_crl.git'
    'desktop-app.lib_lottie'::'git+https://github.com/desktop-app/lib_lottie.git'
    'desktop-app.lib_qr'::'git+https://github.com/desktop-app/lib_qr.git'
    'desktop-app.lib_rpl'::'git+https://github.com/desktop-app/lib_rpl.git'
    'desktop-app.lib_spellcheck'::'git+https://github.com/desktop-app/lib_spellcheck.git'
    'desktop-app.lib_storage'::'git+https://github.com/desktop-app/lib_storage.git'
    'desktop-app.lib_webrtc'::'git+https://github.com/desktop-app/lib_webrtc.git'
    'desktop-app.lib_webview'::'git+https://github.com/desktop-app/lib_webview.git'
    'desktop-app.libprisma'::'git+https://github.com/desktop-app/libprisma.git'
    'desktop-app.rlottie'::'git+https://github.com/desktop-app/rlottie.git'
    #'ericniebler.range-v3'::'git+https://github.com/ericniebler/range-v3.git'
    'fcitx.fcitx5-qt'::'git+https://github.com/fcitx/fcitx5-qt.git'
    'flatpak.xdg-desktop-portal'::'git+https://github.com/flatpak/xdg-desktop-portal.git'
    'google.cld3'::'git+https://github.com/google/cld3.git'
    'hamonikr.nimf'::'git+https://github.com/hamonikr/nimf.git'
    'hime-ime.hime'::'git+https://github.com/hime-ime/hime.git'
    #'hunspell'::'git+https://github.com/hunspell/hunspell.git'
    #'jemalloc'::'git+https://github.com/jemalloc/jemalloc.git'
    #'kde.kcoreaddons'::'git+https://github.com/KDE/kcoreaddons.git'
    #'kde.kimageformats'::'git+https://github.com/KDE/kimageformats.git'
    #'lz4'::'git+https://github.com/lz4/lz4.git'
    'microsoft.gsl'::'git+https://github.com/Microsoft/GSL.git'
    'nayuki.qr-code-generator'::'git+https://github.com/nayuki/QR-Code-generator.git'
    'tartanllama.expected'::'git+https://github.com/TartanLlama/expected.git'
    'telegramdesktop.libtgvoip'::'git+https://github.com/telegramdesktop/libtgvoip.git'
    'telegrammessenger.tgcalls'::'git+https://github.com/TelegramMessenger/tgcalls.git'
  )
  sha256sums+=(
    #'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'
  )

  _prepare_ayugram() (
    cd "$srcdir/$_pkgsrc"
    local _submodules=(
      #'apple.swift-corelibs-libdispatch'::'Telegram/ThirdParty/dispatch'
      'ayugram.codegen'::'Telegram/codegen'
      'ayugram.lib_tl'::'Telegram/lib_tl'
      'ayugram.lib_ui'::'Telegram/lib_ui'
      'cyan4973.xxhash'::'Telegram/ThirdParty/xxHash'
      'desktop-app.cmake_helpers'::'cmake'
      'desktop-app.lib_base'::'Telegram/lib_base'
      'desktop-app.lib_crl'::'Telegram/lib_crl'
      'desktop-app.lib_lottie'::'Telegram/lib_lottie'
      'desktop-app.lib_qr'::'Telegram/lib_qr'
      'desktop-app.lib_rpl'::'Telegram/lib_rpl'
      'desktop-app.lib_spellcheck'::'Telegram/lib_spellcheck'
      'desktop-app.lib_storage'::'Telegram/lib_storage'
      'desktop-app.lib_webrtc'::'Telegram/lib_webrtc'
      'desktop-app.lib_webview'::'Telegram/lib_webview'
      'desktop-app.libprisma'::'Telegram/ThirdParty/libprisma'
      'desktop-app.rlottie'::'Telegram/ThirdParty/rlottie'
      #'ericniebler.range-v3'::'Telegram/ThirdParty/range-v3'
      'fcitx.fcitx5-qt'::'Telegram/ThirdParty/fcitx5-qt'
      'flatpak.xdg-desktop-portal'::'Telegram/ThirdParty/xdg-desktop-portal'
      'google.cld3'::'Telegram/ThirdParty/cld3'
      'hamonikr.nimf'::'Telegram/ThirdParty/nimf'
      'hime-ime.hime'::'Telegram/ThirdParty/hime'
      #'hunspell'::'Telegram/ThirdParty/hunspell'
      #'jemalloc'::'Telegram/ThirdParty/jemalloc'
      #'kde.kcoreaddons'::'Telegram/ThirdParty/kcoreaddons'
      #'kde.kimageformats'::'Telegram/ThirdParty/kimageformats'
      #'lz4'::'Telegram/ThirdParty/lz4'
      'microsoft.gsl'::'Telegram/ThirdParty/GSL'
      'nayuki.qr-code-generator'::'Telegram/ThirdParty/QR'
      'tartanllama.expected'::'Telegram/ThirdParty/expected'
      'telegramdesktop.libtgvoip'::'Telegram/ThirdParty/libtgvoip'
      'telegrammessenger.tgcalls'::'Telegram/ThirdParty/tgcalls'
    )
    _submodule_update
  )
}

_source_desktop_app_cmake_helpers() {
  source+=(
    'mnauw.cppgir'::'git+https://gitlab.com/mnauw/cppgir.git'
    'yugr.implib.so'::'git+https://github.com/yugr/Implib.so.git'
  )
  sha256sums+=(
    'SKIP'
    'SKIP'
  )

  _prepare_desktop_app_cmake_helpers() (
    cd "$srcdir/$_pkgsrc"
    cd "cmake"
    local _submodules=(
      'mnauw.cppgir'::'external/glib/cppgir'
      'yugr.implib.so'::'external/Implib.so'
    )
    _submodule_update
  )
}

_source_mnauw_cppgir() {
  source+=(
    'martinmoene.expected-lite'::'git+https://github.com/martinmoene/expected-lite.git'
  )
  sha256sums+=(
    'SKIP'
  )

  _prepare_mnauw_cppgir() (
    cd "$srcdir/$_pkgsrc"
    cd "cmake"
    cd "external/glib/cppgir"
    local _submodules=(
      'martinmoene.expected-lite'::'expected-lite'
    )
    _submodule_update
  )
}

_source_main
_source_ayugram

_source_desktop_app_cmake_helpers
_source_mnauw_cppgir

prepare() {
  _submodule_update() {
    local _module
    for _module in "${_submodules[@]}"; do
      git submodule init "${_module##*::}"
      git submodule set-url "${_module##*::}" "$srcdir/${_module%::*}"
      git -c protocol.file.allow=always submodule update "${_module##*::}"
    done
  }

  _prepare_ayugram
  _prepare_desktop_app_cmake_helpers
  _prepare_mnauw_cppgir
}

pkgver() {
  cd "$_pkgsrc"
  git describe --long --tags --abbrev=7 \
    | sed -E 's/^[^0-9]*//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  local _cmake_options=(
    -B build
    -S "$_pkgsrc"
    -G Ninja
    -DCMAKE_BUILD_TYPE=None
    -DCMAKE_INSTALL_PREFIX=/usr
    -DDESKTOP_APP_DISABLE_AUTOUPDATE=ON
    -DTDESKTOP_API_TEST=ON
    -DTDESKTOP_API_ID=611335
    -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
    -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF
    -Wno-dev
  )

  cmake "${_cmake_options[@]}"
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}