forked from telegramdesktop/tdesktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsnapcraft.yaml
437 lines (413 loc) · 11.3 KB
/
snapcraft.yaml
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
name: telegram-desktop
version: git
adopt-info: telegram
description: |
Telegram is a popular messaging protocol with encryption and security as
its key focus.
Fast and secure desktop app, perfectly synced with your mobile phone.
grade: stable
confinement: strict
version-script: |
set -x
version_file=Telegram/build/version
version=$(sed -n "s/AppVersionStr[ ]\+\(.*\)\+/\1/p" $version_file)
beta=$(sed -n "s/BetaChannel[ ]\+\(.*\)\+/\1/p" $version_file)
if [ "$beta" != "0" ]; then
version="$version-beta"
fi
version="${version}$(git describe --tags | sed 's,^v[^-]\+,,')"
echo $version
apps:
telegram-desktop:
command: telegram-launch
common-id: org.telegram.desktop
environment:
DISABLE_WAYLAND: 1
WAYLAND_DISPLAY: no-display
QTCOMPOSE: $SNAP/usr/share/X11/locale
HOME: "$SNAP_USER_COMMON"
plugs:
- desktop
- desktop-legacy
- gsettings
- home
- network
- network-bind
- network-manager
- pulseaudio
- removable-media
- unity7
plugs:
gtk-3-themes:
interface: content
target: $SNAP/usr/share/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/usr/share/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/usr/share/sounds
default-provider: gtk-common-themes
parts:
telegram:
plugin: gyp-cmake
source: .
source-type: git
parse-info: [lib/xdg/telegramdesktop.appdata.xml]
build-packages:
- libappindicator-dev
- libappindicator3-dev
- libexif-dev
- libicu-dev
- liblzma-dev
- libssl-dev
- libdee-dev
- zlib1g-dev
gyp-file: Telegram/gyp/Telegram.gyp
build-type: 'Release'
artifacts: ['Telegram']
environment:
- CC: gcc-7
- CXX: g++-7
organize:
Telegram: bin/Telegram
configflags:
- -Dapi_id=611335
- -Dapi_hash=d524b414d21f4d37f08684c1df41ac9c
- -Dlinux_path_breakpad=$SNAPCRAFT_STAGE
- -Dlinux_path_range=$SNAPCRAFT_STAGE/range-v3
- -Dlinux_path_ffmpeg=$SNAPCRAFT_STAGE
- -Dlinux_path_libexif_lib=$SNAPCRAFT_STAGE
- -Dlinux_path_openal=$SNAPCRAFT_STAGE
- -Dlinux_path_opus_include=$SNAPCRAFT_STAGE/include/opus
- -Dlinux_path_qt=$SNAPCRAFT_STAGE
- -Dlinux_path_va=$SNAPCRAFT_STAGE
- -Dlinux_path_vdpau=$SNAPCRAFT_STAGE
- -Dlinux_path_xkbcommon=$SNAPCRAFT_STAGE
- -Dlinux_lib_ssl=-lssl
- -Dlinux_lib_crypto=-lcrypto
- -Dlinux_lib_icu=-licuuc -licutu -licui18n
- -Dbuild_defines=TDESKTOP_DISABLE_AUTOUPDATE,
TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME,
TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION
- --depth=.
override-build: |
set -xe
snapcraftctl build
part_src=$SNAPCRAFT_PART_INSTALL/../src
snap_gui=$SNAPCRAFT_STAGE/../snap/gui
mkdir -vp $snap_gui
cp -v $part_src/lib/xdg/telegramdesktop.desktop $snap_gui
cp -v $part_src/Telegram/Resources/art/[email protected] $snap_gui/icon.png
sed -i "s|^Icon=.*|Icon=\${SNAP}/meta/gui/icon.png|g" $snap_gui/telegramdesktop.desktop
after:
- breakpad
- ffmpeg
- gyp
- libva
- openal
- qt
- range-v3
- gcc7
telegram-launcher:
plugin: dump
source: snap/scripts
organize:
telegram-launch: bin/telegram-launch
desktop-integration:
plugin: nil
stage-packages:
- libappindicator3-1
- libnotify4
- libpulse0
after: [desktop-gtk3]
stage:
- -./usr/share/fonts/**
- -./usr/share/themes/**
- -./usr/share/icons/**
- -./usr/share/sounds/**
desktop-gtk3:
stage:
- -./usr/share/fonts/**
- -./usr/share/themes/**
- -./usr/share/icons/**
- -./usr/share/sounds/**
override-build: |
set -xe
snapcraftctl build
export XDG_DATA_DIRS=$SNAPCRAFT_PART_INSTALL/usr/share
update-mime-database $SNAPCRAFT_PART_INSTALL/usr/share/mime
for dir in $SNAPCRAFT_PART_INSTALL/usr/share/icons/*/; do
if [ -f $dir/index.theme ]; then
gtk-update-icon-cache-3.0 -q $dir
fi
done
libva:
source: https://github.com/01org/libva.git
source-depth: 1
plugin: autotools
build-packages:
- libdrm-dev
- libegl1-mesa-dev
- libgl1-mesa-dev
- libx11-dev
- libxext-dev
- libxfixes-dev
configflags:
- --enable-static
prime: [-./*]
libvdpau:
source: git://anongit.freedesktop.org/vdpau/libvdpau
source-depth: 1
source-branch: libvdpau-1.2
plugin: autotools
build-packages:
- libx11-dev
- x11proto-dri2-dev
- libxext-dev
configflags:
- --enable-static
prime: [-./*]
opus:
source: https://github.com/xiph/opus.git
source-depth: 1
source-branch: v1.2.1
plugin: autotools
prime: [-./*]
ffmpeg:
source: https://github.com/FFmpeg/FFmpeg.git
source-depth: 1
source-branch: release/3.4
plugin: autotools
build-packages:
- libass-dev
- libfreetype6-dev
- libgpac-dev
- liblzma-dev
- libsdl1.2-dev
- libtheora-dev
- libtool
- libvorbis-dev
- libxcb1-dev
- libxcb-shm0-dev
- libxcb-xfixes0-dev
- pkg-config
- texi2html
- yasm
- zlib1g-dev
configflags:
- --prefix=/
- --disable-debug
- --disable-programs
- --disable-doc
- --disable-everything
- --enable-gpl
- --enable-version3
- --enable-libopus
- --enable-decoder=aac
- --enable-decoder=aac_latm
- --enable-decoder=aasc
- --enable-decoder=flac
- --enable-decoder=gif
- --enable-decoder=h264
- --enable-decoder=h264_vdpau
- --enable-decoder=mp1
- --enable-decoder=mp1float
- --enable-decoder=mp2
- --enable-decoder=mp2float
- --enable-decoder=mp3
- --enable-decoder=mp3adu
- --enable-decoder=mp3adufloat
- --enable-decoder=mp3float
- --enable-decoder=mp3on4
- --enable-decoder=mp3on4float
- --enable-decoder=mpeg4
- --enable-decoder=mpeg4_vdpau
- --enable-decoder=msmpeg4v2
- --enable-decoder=msmpeg4v3
- --enable-decoder=opus
- --enable-decoder=vorbis
- --enable-decoder=wavpack
- --enable-decoder=wmalossless
- --enable-decoder=wmapro
- --enable-decoder=wmav1
- --enable-decoder=wmav2
- --enable-decoder=wmavoice
- --enable-encoder=libopus
- --enable-hwaccel=h264_vaapi
- --enable-hwaccel=h264_vdpau
- --enable-hwaccel=mpeg4_vaapi
- --enable-hwaccel=mpeg4_vdpau
- --enable-parser=aac
- --enable-parser=aac_latm
- --enable-parser=flac
- --enable-parser=h264
- --enable-parser=mpeg4video
- --enable-parser=mpegaudio
- --enable-parser=opus
- --enable-parser=vorbis
- --enable-demuxer=aac
- --enable-demuxer=flac
- --enable-demuxer=gif
- --enable-demuxer=h264
- --enable-demuxer=mov
- --enable-demuxer=mp3
- --enable-demuxer=ogg
- --enable-demuxer=wav
- --enable-muxer=ogg
- --enable-muxer=opus
after:
- libva
- libvdpau
- opus
prime: [-./*]
openal:
source: https://github.com/kcat/openal-soft.git
source-depth: 1
source-tag: openal-soft-1.19.1
plugin: cmake
build-packages:
- oss4-dev
- portaudio19-dev
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DALSOFT_EXAMPLES=OFF
- -DALSOFT_TESTS=OFF
- -DALSOFT_UTILS=OFF
- -DLIBTYPE=STATIC
after:
- ffmpeg
prime: [-./*]
libxkbcommon:
source: https://github.com/xkbcommon/libxkbcommon.git
source-depth: 1
plugin: autotools
build-packages:
- xutils-dev
- bison
- python-xcbgen
configflags:
- --disable-x11
prime: [-./*]
qt:
plugin: qtbuilder
qt-version: 5.6.2
qt-source-git: https://code.qt.io/qt/qt5.git
qt-submodules: ['qtbase', 'qtimageformats']
qt-patches-path: Telegram/Patches
qt-extra-plugins:
- platforminputcontexts:
- https://github.com/telegramdesktop/fcitx.git
- https://github.com/telegramdesktop/hime.git
- https://github.com/telegramdesktop/nimf.git
environment:
- CC: gcc-7
- CXX: g++-7
- QMAKE_CC: gcc-7
- QMAKE_CXX: g++-7
build-packages:
- libasound2-dev
- libdbusmenu-glib-dev
- libffi-dev
- liblzma-dev
- libpulse-dev
- libssl-dev
- libx11-xcb-dev
- libxcb-icccm4-dev
- libxcb-image0-dev
- libxcb-keysyms1-dev
- libxcb-randr0-dev
- libxcb-render-util0-dev
- libxcb-sync-dev
- libxcb-util0-dev
- libxcb-xfixes0-dev
- libxcb1-dev
- libxrender-dev
configflags:
- -prefix
- $SNAPCRAFT_STAGE
- -release
- -force-debug-info
- -opensource
- -confirm-license
- -qt-zlib
- -qt-libpng
- -qt-libjpeg
- -qt-freetype
- -qt-harfbuzz
- -qt-pcre
- -qt-xcb
- -qt-xkbcommon-x11
- -no-gstreamer
- -no-gtkstyle
- -no-mirclient
- -no-opengl
- -static
- -dbus-runtime
- -openssl-linked
- -nomake
- examples
- -nomake
- tests
after:
- libxkbcommon
- gcc7
prime: [-./*]
breakpad:
plugin: autotools-subsource
source: https://chromium.googlesource.com/breakpad/breakpad
source-type: git
source-commit: bc8fb886
sub-sources:
- linux-syscall-support:
dest: src/third_party/lss
source: https://chromium.googlesource.com/linux-syscall-support
source-type: git
source-commit: a91633d1
prime: [-./*]
range-v3:
source: https://github.com/ericniebler/range-v3.git
source-depth: 1
plugin: nil
override-build: |
set -x
snapcraftctl build
mkdir $SNAPCRAFT_PART_INSTALL/range-v3
cp -rv * $SNAPCRAFT_PART_INSTALL/range-v3
prime: [-./*]
gyp:
plugin: patched-python
source: https://chromium.googlesource.com/external/gyp
source-type: git
source-commit: 702ac58e47
python-version: python2
patches:
- Telegram/Patches/gyp.diff
prime: [-./*]
# Since this is supposed to be built against ubuntu 16.04, we need to manually
# install gcc7, and this is a workaround to achieve this.
# This part can be safely removed when build.snapcraft.io will allow
# to build against 18.04.
gcc7:
plugin: nil
build-packages:
- libmpc-dev
- libcloog-ppl-dev
override-pull: |
set -x
echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu xenial main" | \
sudo tee /etc/apt/sources.list.d/ubuntu-toolchain-r.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C317803A41BA51845E371A1E9377A2BA9EF27F
sudo apt-get update \
-o Dir::Etc::sourcelist="sources.list.d/ubuntu-toolchain-r.list" \
-o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"
snapcraftctl pull
override-build: |
set -x
snapcraftctl build
sudo apt install gcc-7 g++-7 -o Debug::pkgProblemResolver=yes --no-install-recommends -y
sudo apt-mark auto gcc-7 g++-7
sudo rm -f /etc/apt/sources.list.d/ubuntu-toolchain-r.list
prime: [-./*]