snapcraft.yaml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  1. name: telegram-desktop
  2. adopt-info: telegram
  3. base: core24
  4. grade: stable
  5. confinement: strict
  6. compression: lzo
  7. apps:
  8. telegram-desktop:
  9. command: usr/bin/telegram-desktop
  10. command-chain:
  11. - bin/desktop-launch
  12. common-id: org.telegram.desktop
  13. desktop: usr/share/applications/org.telegram.desktop.desktop
  14. autostart: telegram-desktop_telegram-desktop.desktop
  15. plugs:
  16. - alsa
  17. - audio-playback
  18. - audio-record
  19. - camera
  20. - desktop
  21. - desktop-legacy
  22. - gsettings
  23. - hardware-observe
  24. - home
  25. - network
  26. - network-bind
  27. - network-status
  28. - opengl
  29. - removable-media
  30. - unity7
  31. - wayland
  32. - x11
  33. slots:
  34. - mpris
  35. hooks:
  36. configure:
  37. command-chain:
  38. - bin/hooks-configure-desktop
  39. plugs:
  40. - desktop
  41. plugs:
  42. desktop:
  43. mount-host-font-cache: false
  44. # Support for common GTK themes
  45. # https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
  46. gtk-3-themes:
  47. interface: content
  48. target: $SNAP/data-dir/themes
  49. default-provider: gtk-common-themes
  50. icon-themes:
  51. interface: content
  52. target: $SNAP/data-dir/icons
  53. default-provider: gtk-common-themes
  54. sound-themes:
  55. interface: content
  56. target: $SNAP/data-dir/sounds
  57. default-provider: gtk-common-themes
  58. layout:
  59. /usr/share/alsa:
  60. bind: $SNAP/usr/share/alsa
  61. /usr/share/pipewire:
  62. bind: $SNAP/usr/share/pipewire
  63. /usr/share/X11:
  64. bind: $SNAP/usr/share/X11
  65. /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gtk-3.0:
  66. bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gtk-3.0
  67. /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pipewire-0.3:
  68. bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pipewire-0.3
  69. /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/spa-0.2:
  70. bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/spa-0.2
  71. /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1:
  72. bind: $SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/webkit2gtk-4.1
  73. parts:
  74. telegram:
  75. plugin: cmake
  76. source: .
  77. source-type: git
  78. parse-info: [usr/share/metainfo/org.telegram.desktop.metainfo.xml]
  79. build-environment:
  80. - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  81. - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s
  82. build-packages:
  83. - clang
  84. - libtool-bin
  85. - python3
  86. - protobuf-compiler
  87. - libasound2-dev
  88. - libavif-dev
  89. - libboost-regex-dev
  90. - libgirepository1.0-dev
  91. - libglib2.0-dev
  92. - libheif-dev
  93. - libopenal-dev
  94. - libopus-dev
  95. - libprotobuf-dev
  96. - libpulse-dev
  97. - libssl-dev
  98. - libxcb1-dev
  99. - libxcb-keysyms1-dev
  100. - libxcb-record0-dev
  101. - libxcb-screensaver0-dev
  102. - zlib1g-dev
  103. stage-packages:
  104. - libasound2t64
  105. - libavif16
  106. - libboost-regex1.83.0
  107. - libgeoclue-2-0
  108. - libgeocode-glib-2-0
  109. - libglib2.0-0t64
  110. - libheif1
  111. - libopenal1
  112. - libopus0
  113. - libprotobuf-lite32t64
  114. - libpulse0
  115. - libssl3t64
  116. - libwebkit2gtk-4.1-0
  117. - libxcb1
  118. - libxcb-keysyms1
  119. - libxcb-record0
  120. - libxcb-screensaver0
  121. - zlib1g
  122. - glib-networking
  123. cmake-generator: Ninja
  124. cmake-parameters:
  125. - -DCMAKE_BUILD_TYPE=Release
  126. - -DCMAKE_INSTALL_PREFIX=/usr
  127. - -DCMAKE_PREFIX_PATH=$CRAFT_STAGE/usr
  128. - -DTDESKTOP_API_ID=611335
  129. - -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
  130. - -DDESKTOP_APP_USE_PACKAGED_LAZY=ON
  131. override-pull: |
  132. craftctl default
  133. version_file=Telegram/build/version
  134. version=$(sed -n "s/AppVersionStr[ ]\+\(.*\)\+/\1/p" $version_file)
  135. beta=$(sed -n "s/BetaChannel[ ]\+\(.*\)\+/\1/p" $version_file)
  136. if [ "$beta" != "0" ]; then
  137. version="$version-beta"
  138. fi
  139. version="${version}$(git describe --tags | sed 's,^v[^-]\+,,')"
  140. craftctl set version="$version"
  141. override-build: |
  142. craftctl default
  143. APP_ID=org.telegram.desktop
  144. sed -i "s/^Icon=$APP_ID$/Icon=snap.telegram-desktop./g" "$CRAFT_PART_INSTALL/usr/share/applications/$APP_ID.desktop"
  145. for i in $(find "$CRAFT_PART_INSTALL/usr/share/icons" -name "$APP_ID*.svg" -o -name "$APP_ID*.png"); do
  146. PREFIXED="$(dirname "$i")/snap.$CRAFT_PROJECT_NAME.$(basename "$i" | sed "s/$APP_ID//")"
  147. mv "$i" "$PREFIXED"
  148. DEST="$(dirname "$i" | sed 's@usr/share@meta/gui@')"
  149. mkdir -p "$DEST"
  150. cp -r "$PREFIXED" "$DEST"
  151. done
  152. after:
  153. - ada
  154. - ffmpeg
  155. - libjxl
  156. - qt
  157. - rnnoise
  158. - webrtc
  159. patches:
  160. source: https://github.com/desktop-app/patches.git
  161. source-depth: 1
  162. source-commit: fb35ec726cf0a99eead201ddf80e1e717b9fa7c2
  163. plugin: dump
  164. override-pull: |
  165. craftctl default
  166. cp -r . "$CRAFT_STAGE/patches"
  167. override-prime: |
  168. rm -rf patches
  169. stage: [-./*]
  170. desktop-qt:
  171. source: https://github.com/desktop-app/snapcraft-desktop-helpers.git
  172. source-depth: 1
  173. source-subdir: qt
  174. plugin: make
  175. make-parameters: ["FLAVOR=qt5"]
  176. build-environment:
  177. - LD_LIBRARY_PATH: $CRAFT_STAGE/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
  178. build-packages:
  179. - build-essential
  180. - dpkg-dev
  181. - gtk-update-icon-cache
  182. - libglib2.0-bin
  183. - libgtk-3-0t64
  184. stage-packages:
  185. - libc-bin
  186. - libgdk-pixbuf-2.0-0
  187. - libnvidia-egl-wayland1
  188. - libxkbcommon0
  189. - locales-all
  190. - shared-mime-info
  191. - xdg-user-dirs
  192. override-prime: |
  193. craftctl default
  194. update-mime-database usr/share/mime
  195. glib-compile-schemas usr/share/glib-2.0/schemas
  196. for theme in usr/share/icons/*; do
  197. if [ -f "$theme/index.theme" ] && [ ! -f "$theme/icon-theme.cache" ]; then
  198. update-icon-caches "$theme"
  199. fi
  200. done
  201. GTK_PATH=$PWD/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gtk-3.0 /usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libgtk-3-0t64/gtk-query-immodules-3.0 > usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/gtk-3.0/3.0.0/immodules/immodules.cache
  202. after:
  203. - telegram
  204. ada:
  205. source: https://github.com/ada-url/ada.git
  206. source-depth: 1
  207. source-tag: v2.9.0
  208. plugin: cmake
  209. build-environment:
  210. - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s
  211. cmake-generator: Ninja
  212. cmake-parameters:
  213. - -DCMAKE_BUILD_TYPE=Release
  214. - -DCMAKE_INSTALL_PREFIX=/usr
  215. - -DADA_TESTING=OFF
  216. - -DADA_TOOLS=OFF
  217. prime:
  218. - -./usr/include
  219. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/cmake
  220. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.a
  221. ffmpeg:
  222. plugin: nil
  223. build-packages:
  224. - libavcodec-dev
  225. - libavfilter-dev
  226. - libavformat-dev
  227. - libavutil-dev
  228. - libswresample-dev
  229. - libswscale-dev
  230. stage-packages:
  231. - libavcodec60
  232. - libavfilter9
  233. - libavformat60
  234. - libavutil58
  235. - libswresample4
  236. - libswscale7
  237. - va-driver-all
  238. - vdpau-driver-all
  239. override-build: |
  240. craftctl default
  241. mv "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas/"* "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR"
  242. rmdir "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/blas"
  243. mv "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack/"* "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR"
  244. rmdir "$CRAFT_PART_INSTALL/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/lapack"
  245. libjxl:
  246. source: https://github.com/libjxl/libjxl.git
  247. source-depth: 1
  248. source-tag: v0.11.1
  249. plugin: cmake
  250. build-environment:
  251. - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s
  252. cmake-generator: Ninja
  253. cmake-parameters:
  254. - -DCMAKE_BUILD_TYPE=Release
  255. - -DCMAKE_INSTALL_PREFIX=/usr
  256. - -DBUILD_TESTING=OFF
  257. - -DJPEGXL_ENABLE_DEVTOOLS=OFF
  258. - -DJPEGXL_ENABLE_TOOLS=OFF
  259. - -DJPEGXL_INSTALL_JPEGLI_LIBJPEG=ON
  260. - -DJPEGXL_ENABLE_DOXYGEN=OFF
  261. - -DJPEGXL_ENABLE_MANPAGES=OFF
  262. - -DJPEGXL_ENABLE_BENCHMARK=OFF
  263. - -DJPEGXL_ENABLE_EXAMPLES=OFF
  264. - -DJPEGXL_ENABLE_JNI=OFF
  265. - -DJPEGXL_ENABLE_SJPEG=OFF
  266. - -DJPEGXL_ENABLE_OPENEXR=OFF
  267. - -DJPEGXL_ENABLE_SKCMS=OFF
  268. stage:
  269. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libbrotli*
  270. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/libhwy*
  271. prime:
  272. - -./usr/bin
  273. - -./usr/include
  274. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/cmake
  275. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pkgconfig
  276. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.a
  277. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.so
  278. - -./usr/share
  279. qt:
  280. plugin: nil
  281. build-environment:
  282. - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s
  283. build-packages:
  284. - libdbus-1-dev
  285. - libegl-dev
  286. - libfontconfig1-dev
  287. - libfreetype-dev
  288. - libglib2.0-dev
  289. - libglx-dev
  290. - libgtk-3-dev
  291. - libharfbuzz-dev
  292. - libice-dev
  293. - libicu-dev
  294. - liblcms2-dev
  295. - libopengl-dev
  296. - libpcre2-dev
  297. - libpng-dev
  298. - libsm-dev
  299. - libssl-dev
  300. - libvulkan-dev
  301. - libwayland-dev
  302. - libx11-dev
  303. - libx11-xcb-dev
  304. - libxcb1-dev
  305. - libxcb-cursor-dev
  306. - libxcb-glx0-dev
  307. - libxcb-icccm4-dev
  308. - libxcb-image0-dev
  309. - libxcb-keysyms1-dev
  310. - libxcb-randr0-dev
  311. - libxcb-render0-dev
  312. - libxcb-render-util0-dev
  313. - libxcb-shape0-dev
  314. - libxcb-shm0-dev
  315. - libxcb-sync-dev
  316. - libxcb-util-dev
  317. - libxcb-xfixes0-dev
  318. - libxcb-xkb-dev
  319. - libxkbcommon-dev
  320. - libxkbcommon-x11-dev
  321. - zlib1g-dev
  322. stage-packages:
  323. - libdbus-1-3
  324. - libegl1
  325. - libfontconfig1
  326. - libfreetype6
  327. - libglib2.0-0t64
  328. - libglx0
  329. - libgtk-3-0t64
  330. - libharfbuzz0b
  331. - libice6
  332. - libicu74
  333. - liblcms2-2
  334. - libopengl0
  335. - libpcre2-16-0
  336. - libpng16-16t64
  337. - libsm6
  338. - libssl3t64
  339. - libvulkan1
  340. - libwayland-client0
  341. - libwayland-cursor0
  342. - libwayland-egl1
  343. - libwayland-server0
  344. - libx11-6
  345. - libx11-xcb1
  346. - libxcb1
  347. - libxcb-cursor0
  348. - libxcb-glx0
  349. - libxcb-icccm4
  350. - libxcb-image0
  351. - libxcb-keysyms1
  352. - libxcb-randr0
  353. - libxcb-render0
  354. - libxcb-render-util0
  355. - libxcb-shape0
  356. - libxcb-shm0
  357. - libxcb-sync1
  358. - libxcb-util1
  359. - libxcb-xfixes0
  360. - libxcb-xkb1
  361. - libxkbcommon0
  362. - libxkbcommon-x11-0
  363. - zlib1g
  364. - mesa-vulkan-drivers
  365. - xkb-data
  366. override-pull: |
  367. QT=6.8.2
  368. git clone -b v${QT} --depth=1 https://github.com/qt/qt5.git .
  369. git submodule update --init --recursive --depth=1 qtbase qtdeclarative qtwayland qtimageformats qtsvg qtshadertools
  370. cd qtbase
  371. find $CRAFT_STAGE/patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply
  372. cd ../qtwayland
  373. find $CRAFT_STAGE/patches/qtwayland_${QT} -type f -print0 | sort -z | xargs -r0 git apply
  374. cd ..
  375. override-build: |
  376. cmake -GNinja -B $CRAFT_PART_BUILD \
  377. -DCMAKE_BUILD_TYPE=Release \
  378. -DCMAKE_INSTALL_PREFIX=/usr \
  379. -DCMAKE_PREFIX_PATH=$CRAFT_STAGE/usr \
  380. -DINSTALL_LIBDIR=/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR \
  381. -DQT_GENERATE_SBOM=OFF \
  382. -DINPUT_openssl=linked
  383. cmake --build . -j$CRAFT_PARALLEL_BUILD_COUNT
  384. DESTDIR="$CRAFT_PART_INSTALL" cmake --install .
  385. prime:
  386. - -./usr/bin
  387. - -./usr/doc
  388. - -./usr/include
  389. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/cmake
  390. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pkgconfig
  391. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.a
  392. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.la
  393. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.prl
  394. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.so
  395. - -./usr/libexec
  396. - -./usr/metatypes
  397. - -./usr/mkspecs
  398. - -./usr/modules
  399. - -./**/objects-*
  400. after:
  401. - libjxl
  402. - patches
  403. rnnoise:
  404. source: https://gitlab.xiph.org/xiph/rnnoise.git
  405. source-depth: 1
  406. source-commit: 7f449bf8bd3b933891d12c30112268c4090e4d59
  407. plugin: autotools
  408. build-environment:
  409. - CFLAGS: -O2 -s
  410. autotools-configure-parameters:
  411. - --prefix=/usr
  412. - --libdir=\${exec_prefix}/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR
  413. - --disable-static
  414. - --disable-examples
  415. - --disable-doc
  416. prime:
  417. - -./usr/include
  418. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/pkgconfig
  419. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.la
  420. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.so
  421. - -./usr/share
  422. systemd:
  423. plugin: nil
  424. stage-packages:
  425. - systemd
  426. stage:
  427. - ./usr/bin/systemd-detect-virt
  428. webrtc:
  429. source: https://github.com/desktop-app/tg_owt.git
  430. source-depth: 1
  431. source-commit: 8198c4d8b91e22d68eb5c7327fd408e3b6abcc79
  432. plugin: cmake
  433. build-environment:
  434. - LDFLAGS: ${LDFLAGS:+$LDFLAGS} -s
  435. build-packages:
  436. - yasm
  437. - libdrm-dev
  438. - libegl-dev
  439. - libgbm-dev
  440. - libgl-dev
  441. - libglib2.0-dev
  442. - libopenh264-dev
  443. - libopus-dev
  444. - libpipewire-0.3-dev
  445. - libssl-dev
  446. - libvpx-dev
  447. - libx11-dev
  448. - libxcomposite-dev
  449. - libxdamage-dev
  450. - libxext-dev
  451. - libxfixes-dev
  452. - libxrender-dev
  453. - libxrandr-dev
  454. - libxtst-dev
  455. stage-packages:
  456. - libdrm2
  457. - libegl1
  458. - libgbm1
  459. - libgl1
  460. - libglib2.0-0t64
  461. - libopenh264-7
  462. - libopus0
  463. - libssl3t64
  464. - libvpx9
  465. - libx11-6
  466. - libxcomposite1
  467. - libxdamage1
  468. - libxext6
  469. - libxfixes3
  470. - libxrender1
  471. - libxrandr2
  472. - libxtst6
  473. - pipewire
  474. cmake-generator: Ninja
  475. cmake-parameters:
  476. - -DCMAKE_BUILD_TYPE=Release
  477. - -DCMAKE_INSTALL_PREFIX=/usr
  478. - -DCMAKE_PREFIX_PATH=$CRAFT_STAGE/usr
  479. prime:
  480. - -./usr/include
  481. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/cmake
  482. - -./usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR/*.a
  483. after:
  484. - ffmpeg
  485. - libjxl