-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtelegram-desktop.spec
266 lines (239 loc) · 8.79 KB
/
telegram-desktop.spec
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
# Build conditionals (with - OFF, without - ON)...
%bcond_with rlottie
%bcond_with gtk3
# FIXME as of 2.8.1, telegram-desktop crashes on startup with
# an illegal instruction while calling global constructors
# if built with clang.
# It works fine when built with gcc - but we need to figure
# out why at some point.
%bcond_with clang
%bcond_without spellcheck
%bcond_without fonts
%bcond_without ipo
%bcond_without mindbg
%bcond_without gsl
# Telegram Desktop's constants...
%global appname tdesktop
%global launcher telegramdesktop
%global tarsuffix -full
# Telegram API tokens...
%global apiid 208164
%global apihash dfbe1bc42dc9d20507e17d1814cc2f0a
# Applying workaround to RHBZ#1559007...
%if %{with clang}
%global optflags %(echo %{optflags} | sed -e 's/-mcet//g' -e 's/-fcf-protection//g' -e 's/-fstack-clash-protection//g' -e 's/$/ -Qunused-arguments -Wno-unknown-warning-option/') -I%{_includedir}/minizip -Wno-missing-template-arg-list-after-template-kw
%else
%global optflags %{optflags} -fno-lto -I%{_includedir}/minizip -Wno-missing-template-arg-list-after-template-kw
%endif
%global build_ldflags %(echo %{build_ldflags} -Wl,-z,notext)
# Decrease debuginfo verbosity to reduce memory consumption...
%if %{with mindbg}
%global optflags %(echo %{optflags} | sed 's/-g3 /-gdwarf-5 -g1 /')
%endif
Name: telegram-desktop
# before every upgrade
# try to up tg_owt project first
Version: 5.10.7
Release: 3
# Application and 3rd-party modules licensing:
# * Telegram Desktop - GPLv3+ with OpenSSL exception -- main tarball;
# * rlottie - LGPLv2+ -- static dependency;
# * qt_functions.cpp - LGPLv3 -- build-time dependency.
License: GPLv3+ and LGPLv2+ and LGPLv3
URL: https://github.com/telegramdesktop/%{appname}
Summary: Telegram Desktop official messaging app
# Source files...
# Upstream frequently forgets to make the -full release. When that happens,
# use the package-source.sh script in this repository.
Source0: https://github.com/telegramdesktop/tdesktop/releases/download/v%{version}/%{appname}-%{version}%{tarsuffix}.tar.gz
Patch1: tdesktop-4.11.3-system-libyuv.patch
Patch2: tdesktop-4.6.5-workaround-assert-on-startup.patch
Patch4: tdesktop-4.16.4-compile.patch
Patch5: tdesktop-2.3.2-no-underlinking.patch
Patch6: tdesktop-4.11.3-zlib-ng.patch
Patch7: tdesktop-3.3.2-system-minizip.patch
Patch8: tdesktop-4.15.6-compile.patch
#Patch10: tdesktop-4.16.2-ffmpeg-7.0.patch
Requires: hicolor-icon-theme
# Telegram Desktop require patched version of rlottie since 1.8.0.
# Pull Request pending: https://github.com/Samsung/rlottie/pull/252
%if %{with rlottie}
BuildRequires: pkgconfig(rlottie)
%else
Provides: bundled(rlottie) = 0~git
%endif
# Telegram Desktop require patched version of lxqt-qtplugin.
# Pull Request pending: https://github.com/lxqt/lxqt-qtplugin/pull/52
Provides: bundled(lxqt-qtplugin) = 0.14.0~git
# Compilers and tools...
BuildRequires: desktop-file-utils
BuildRequires: cmake
# Development packages for Telegram Desktop...
BuildRequires: cmake(Microsoft.GSL)
BuildRequires: pkgconfig(protobuf)
BuildRequires: mapbox-variant-devel
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(glibmm-2.68)
BuildRequires: cmake(ECM)
BuildRequires: cmake(tl-expected)
BuildRequires: pkgconfig(libyuv)
BuildRequires: qr-code-generator-devel
BuildRequires: qr-code-generator-c++-devel
BuildRequires: pkgconfig(openal)
BuildRequires: pkgconfig(tgvoip)
BuildRequires: pkgconfig(xcb-keysyms)
BuildRequires: libstdc++-devel
BuildRequires: range-v3-devel
BuildRequires: atomic-devel
BuildRequires: boost-devel
BuildRequires: pkgconfig(openssl)
BuildRequires: pkgconfig(minizip)
BuildRequires: pkgconfig(libxxhash)
BuildRequires: appstream-util
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(liblzma)
BuildRequires: pkgconfig(json11)
BuildRequires: pkgconfig(liblz4)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(hunspell)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(libpulse)
BuildRequires: pkgconfig(openh264)
BuildRequires: pkgconfig(vpx)
BuildRequires: pkgconfig(rnnoise)
BuildRequires: pkgconfig(libzip)
BuildRequires: pkgconfig(gobject-introspection-1.0)
# FIXME is this really necessary? It's there because
# cppgir forces -lstdc++fs, but that may not actually
# be needed...
BuildRequires: stdc++-static-devel
BuildRequires: cmake(fmt)
BuildRequires: cmake(ada)
BuildRequires: cmake(RapidJSON)
BuildRequires: qmake-qt6
BuildRequires: qt6-qtbase-tools
BuildRequires: cmake(Qt6)
BuildRequires: cmake(Qt6Core)
BuildRequires: cmake(Qt6Core5Compat)
BuildRequires: cmake(Qt6DBus)
BuildRequires: cmake(Qt6Network)
BuildRequires: cmake(Qt6Gui)
BuildRequires: cmake(Qt6Svg)
BuildRequires: cmake(Qt6WaylandClient)
BuildRequires: cmake(Qt6OpenGL)
BuildRequires: cmake(Qt6OpenGLWidgets)
BuildRequires: cmake(Qt6Qml)
BuildRequires: cmake(Qt6Quick)
BuildRequires: cmake(Qt6QuickWidgets)
BuildRequires: cmake(Qt6Widgets)
BuildRequires: cmake(Qt6WaylandClient)
BuildRequires: cmake(Qt6WaylandCompositor)
BuildRequires: cmake(KF6CoreAddons)
BuildRequires: cmake(tg_owt)
BuildRequires: wayland-devel
BuildRequires: qt6-qtwayland
BuildRequires: ninja
%ifarch %{x86_64} %{ix86}
BuildRequires: yasm
%endif
# FIXME At some point the cmake files should stop looking
# for libraries that aren't being used
#BuildRequires: cmake(Qt5Svg)
#BuildRequires: cmake(KF5CoreAddons)
%if %{with gtk3}
BuildRequires: pkgconfig(appindicator3-0.1)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(dee-1.0)
Requires: %{_lib}gtk3_0
%endif
%if %{with spellcheck}
BuildRequires: enchant2-devel
BuildRequires: glib2.0-devel
%endif
%if %{with clang}
BuildRequires: clang
BuildRequires: llvm
%endif
%if %{with fonts}
Requires: open-sans-fonts
%endif
%description
Telegram is a messaging app with a focus on speed and security, it’s super
fast, simple and free. You can use Telegram on all your devices at the same
time — your messages sync seamlessly across any number of your phones,
tablets or computers.
With Telegram, you can send messages, photos, videos and files of any type
(doc, zip, mp3, etc), as well as create groups for up to 50,000 people or
channels for broadcasting to unlimited audiences. You can write to your
phone contacts and find people by their usernames. As a result, Telegram is
like SMS and email combined — and can take care of all your personal or
business messaging needs.
%prep
export LC_ALL=en_US.utf-8
# Unpacking Telegram Desktop source archive...
%autosetup -p1 -n %{appname}-%{version}%{tarsuffix}
# Unbundling libraries...
rm -rf Telegram/ThirdParty/{Catch,GSL,QR,SPMediaKeyTap,expected,libdbusmenu-qt,libtgvoip,lz4,variant,xxHash,mallocng,minizip,zlib}
export PATH=%{_libdir}/qt6/bin:$PATH
%cmake -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DDESKTOP_APP_QT6:BOOL=ON \
-DQT_VERSION_MAJOR=6 \
-DDESKTOP_APP_DISABLE_JEMALLOC:BOOL=ON \
%if %{without gtk3}
-DDESKTOP_APP_DISABLE_GTK_INTEGRATION:BOOL=ON \
-DDESKTOP_APP_DISABLE_WEBKITGTK:BOOL=ON \
%endif
%if %{without spellcheck}
-DDESKTOP_APP_DISABLE_SPELLCHECK:BOOL=ON \
%endif
%if %{without fonts}
-DDESKTOP_APP_USE_PACKAGED_FONTS:BOOL=OFF \
%endif
%if %{with ipo} && %{with mindbg} && %{without clang}
-DDESKTOP_APP_ENABLE_IPO_OPTIMIZATIONS:BOOL=ON \
%endif
%if %{with rlottie}
-DDESKTOP_APP_USE_PACKAGED_RLOTTIE:BOOL=ON \
-DDESKTOP_APP_LOTTIE_USE_CACHE:BOOL=OFF \
%else
-DDESKTOP_APP_USE_PACKAGED_RLOTTIE:BOOL=OFF \
-Drlottie_DIR=`pwd`/../Telegram/ThirdParty/rlottie \
%endif
-DTDESKTOP_API_ID=%{apiid} \
-DTDESKTOP_API_HASH=%{apihash} \
-DDESKTOP_APP_USE_PACKAGED:BOOL=ON \
-DDESKTOP_APP_USE_PACKAGED_GSL:BOOL=OFF \
-DDESKTOP_APP_USE_PACKAGED_EXPECTED:BOOL=ON \
-DDESKTOP_APP_USE_PACKAGED_VARIANT:BOOL=ON \
-DDESKTOP_APP_USE_PACKAGED_QRCODE:BOOL=ON \
-DDESKTOP_APP_USE_GLIBC_WRAPS:BOOL=OFF \
-DDESKTOP_APP_DISABLE_CRASH_REPORTS:BOOL=ON \
-DTDESKTOP_USE_PACKAGED_TGVOIP:BOOL=OFF \
-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME:BOOL=ON \
-DTDESKTOP_DISABLE_DESKTOP_FILE_GENERATION:BOOL=ON \
-DTDESKTOP_LAUNCHER_BASENAME=%{launcher}
%build
touch build/changelog.txt
PROCESSES="$(expr $(echo $(getconf _NPROCESSORS_ONLN)) - 2)"
# Linking Telegram with LTO enabled is VERY RAM intensive
# and breaks boxes that have loads of CPU cores but not
# terabytes of RAM...
#[ "$PROCESSES" -gt 4 ] && PROCESSES=4
%ninja_build -C build -j${PROCESSES}
%install
%ninja_install -C build
%check
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/org.telegram.desktop.metainfo.xml
# validate hates "SingleMainWindow"
#desktop-file-validate %{buildroot}%{_datadir}/applications/%{launcher}.desktop
%files
%doc README.md changelog.txt
%license LICENSE LEGAL
%{_bindir}/%{name}
%{_datadir}/applications/org.telegram.desktop.desktop
%{_datadir}/icons/hicolor/*/apps/*.*
%{_datadir}/dbus-1/services/org.telegram.desktop.service
%optional %{_metainfodir}/org.telegram.desktop.metainfo.xml