tdesktop/snap/snapcraft.yaml

474 lines
12 KiB
YAML

name: telegram-desktop
adopt-info: telegram
icon: Telegram/Resources/art/icon512@2x.png
base: core18
grade: stable
confinement: strict
architectures:
- build-on: amd64
- build-on: i386
- build-on: arm64
- build-on: armhf
- build-on: ppc64el
apps:
telegram-desktop:
command: telegram-desktop
common-id: org.telegram.desktop
desktop: share/applications/telegramdesktop.desktop
environment:
# Use GTK3 cursor theme, icon theme and open/save file dialogs.
QT_QPA_PLATFORMTHEME: gtk3
extensions:
- kde-neon
plugs:
- alsa
- audio-playback
- audio-record
- desktop
- desktop-legacy
- home
- network
- network-manager
- opengl
- pulseaudio
- removable-media
- unity7
- wayland
- x11
plugs:
# Support for common GTK themes
# https://forum.snapcraft.io/t/how-to-use-the-system-gtk-theme-via-the-gtk-common-themes-snap/6235
gsettings:
gtk-3-themes:
interface: content
target: $SNAP/data-dir/themes
default-provider: gtk-common-themes
icon-themes:
interface: content
target: $SNAP/data-dir/icons
default-provider: gtk-common-themes
sound-themes:
interface: content
target: $SNAP/data-dir/sounds
default-provider: gtk-common-themes
layout:
/usr/share/alsa:
bind: $SNAP/usr/share/alsa
/usr/share/X11:
bind: $SNAP/usr/share/X11
parts:
telegram:
plugin: cmake
source: .
source-type: git
parse-info: [share/metainfo/telegramdesktop.appdata.xml]
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- gcc-8
- g++-8
- libmapbox-variant-dev
- libasound2-dev
- libglvnd-dev
- libhunspell-dev
- liblz4-dev
- liblzma-dev
- libminizip-dev
- libopus-dev
- libpulse-dev
- libssl-dev
- zlib1g-dev
stage-packages:
- libasound2
- libhunspell-1.6-0
- liblz4-1
- liblzma5
- libminizip1
- libopus0
- libpulse0
- libssl1.1
- zlib1g
configflags:
- -DCMAKE_C_COMPILER=gcc-8
- -DCMAKE_CXX_COMPILER=g++-8
- -DCMAKE_BUILD_TYPE=Release
- -DTDESKTOP_API_ID=611335
- -DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c
- -DDESKTOP_APP_USE_PACKAGED_FONTS=OFF
- -DDESKTOP_APP_USE_PACKAGED_GSL=OFF
- -DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF
- -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
- -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF
- -DTDESKTOP_USE_FONTCONFIG_FALLBACK=ON
override-pull: |
snapcraftctl pull
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[^-]\+,,')"
snapcraftctl set-version "$version"
sed -i 's|^Icon=.*|Icon=/share/icons/hicolor/512x512/apps/telegram.png|g' lib/xdg/telegramdesktop.desktop
after:
- cmake
- ffmpeg
- libdbusmenu-qt
- openal
- range-v3
- xxhash
patches:
plugin: dump
source: Telegram/Patches
prime: [-./*]
qtconf:
plugin: nil
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
cat << EOF > "$SNAPCRAFT_STAGE/qt.conf"
[Paths]
Prefix=$KF5_DIR/usr
ArchData=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5
Binaries=lib/qt5/bin
Data=share/qt5
Documentation=share/qt5/doc
Examples=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/examples
Headers=include/$SNAPCRAFT_ARCH_TRIPLET/qt5
HostBinaries=lib/qt5/bin
HostData=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5
HostLibraries=lib/$SNAPCRAFT_ARCH_TRIPLET
Imports=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/imports
Libraries=lib/$SNAPCRAFT_ARCH_TRIPLET
LibraryExecutables=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/libexec
Plugins=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins
Qml2Imports=lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/qml
Settings=/etc/xdg
Translations=share/qt5/translations
EOF
prime: [-./*]
cmake:
source: "https://gitlab.kitware.com/cmake/cmake.git"
source-depth: 1
source-tag: v3.16.4
source-type: git
plugin: make
override-build: |
${SNAPCRAFT_PART_SRC}/bootstrap \
--parallel=${SNAPCRAFT_PARALLEL_BUILD_COUNT} \
-- \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/ \
-DBUILD_TESTING=OFF
snapcraftctl build
build-packages:
- build-essential
- libssl-dev
- libncurses5-dev
stage-packages:
- libssl1.1
- libncurses5
- libtinfo5
prime: [-./*]
nasm:
source: https://repo.or.cz/nasm.git
source-depth: 1
source-tag: nasm-2.14.02
plugin: autotools
override-build: |
./autogen.sh
./configure --prefix=
make
install -d "$SNAPCRAFT_PART_INSTALL/bin"
install nasm "$SNAPCRAFT_PART_INSTALL/bin/nasm"
install ndisasm "$SNAPCRAFT_PART_INSTALL/bin/ndisasm"
prime: [-./*]
dav1d:
source: https://github.com/videolan/dav1d.git
source-depth: 1
source-tag: 0.6.0
plugin: meson
meson-parameters:
- --prefix=/usr
- -Denable_tools=false
- -Denable_tests=false
prime:
- -./usr/include
- -./usr/lib/*/pkgconfig
after:
- nasm
fcitx-qt5:
source: https://github.com/fcitx/fcitx-qt5.git
source-depth: 1
source-tag: 1.2.4
plugin: cmake
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DENABLE_LIBRARY=OFF
ffmpeg:
source: https://github.com/FFmpeg/FFmpeg.git
source-depth: 1
source-branch: release/4.2
plugin: autotools
build-packages:
- libasound2-dev
- libopus-dev
- libva-dev
- libvdpau-dev
stage-packages:
- libasound2
- libopus0
- libva2
- libva-drm2
- libvdpau1
configflags:
- --prefix=/usr
- --disable-static
- --disable-debug
- --disable-programs
- --disable-doc
- --disable-network
- --disable-autodetect
- --disable-everything
- --disable-neon
- --disable-iconv
- --enable-shared
- --enable-libdav1d
- --enable-libopus
- --enable-vaapi
- --enable-vdpau
- --enable-protocol=file
- --enable-hwaccel=h264_vaapi
- --enable-hwaccel=h264_vdpau
- --enable-hwaccel=mpeg4_vaapi
- --enable-hwaccel=mpeg4_vdpau
- --enable-decoder=aac
- --enable-decoder=aac_fixed
- --enable-decoder=aac_latm
- --enable-decoder=aasc
- --enable-decoder=alac
- --enable-decoder=flac
- --enable-decoder=gif
- --enable-decoder=h264
- --enable-decoder=hevc
- --enable-decoder=libdav1d
- --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=msmpeg4v2
- --enable-decoder=msmpeg4v3
- --enable-decoder=opus
- --enable-decoder=pcm_alaw
- --enable-decoder=pcm_f32be
- --enable-decoder=pcm_f32le
- --enable-decoder=pcm_f64be
- --enable-decoder=pcm_f64le
- --enable-decoder=pcm_lxf
- --enable-decoder=pcm_mulaw
- --enable-decoder=pcm_s16be
- --enable-decoder=pcm_s16be_planar
- --enable-decoder=pcm_s16le
- --enable-decoder=pcm_s16le_planar
- --enable-decoder=pcm_s24be
- --enable-decoder=pcm_s24daud
- --enable-decoder=pcm_s24le
- --enable-decoder=pcm_s24le_planar
- --enable-decoder=pcm_s32be
- --enable-decoder=pcm_s32le
- --enable-decoder=pcm_s32le_planar
- --enable-decoder=pcm_s64be
- --enable-decoder=pcm_s64le
- --enable-decoder=pcm_s8
- --enable-decoder=pcm_s8_planar
- --enable-decoder=pcm_u16be
- --enable-decoder=pcm_u16le
- --enable-decoder=pcm_u24be
- --enable-decoder=pcm_u24le
- --enable-decoder=pcm_u32be
- --enable-decoder=pcm_u32le
- --enable-decoder=pcm_u8
- --enable-decoder=pcm_zork
- --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-parser=aac
- --enable-parser=aac_latm
- --enable-parser=flac
- --enable-parser=h264
- --enable-parser=hevc
- --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=hevc
- --enable-demuxer=m4v
- --enable-demuxer=mov
- --enable-demuxer=mp3
- --enable-demuxer=ogg
- --enable-demuxer=wav
- --enable-muxer=ogg
- --enable-muxer=opus
override-pull: |
snapcraftctl pull
patch -p1 < "$SNAPCRAFT_STAGE/ffmpeg.diff"
prime:
- -./usr/include
- -./usr/lib/pkgconfig
after:
- patches
- nasm
- dav1d
libdbusmenu-qt:
source: https://github.com/unity8-team/libdbusmenu-qt.git
source-depth: 1
source-tag: 0.9.3+16.04.20160218-0ubuntu1
plugin: cmake
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DWITH_DOC=OFF
prime:
- -./include
- -./lib/cmake
- -./lib/pkgconfig
openal:
source: https://github.com/kcat/openal-soft.git
source-depth: 1
source-tag: openal-soft-1.20.1
plugin: cmake
build-packages:
- libasound2-dev
- libpulse-dev
- libsndio-dev
- portaudio19-dev
stage-packages:
- libasound2
- libpulse0
- libportaudio2
- libsndio6.1
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DALSOFT_EXAMPLES=OFF
- -DALSOFT_TESTS=OFF
- -DALSOFT_UTILS=OFF
- -DALSOFT_CONFIG=OFF
prime:
- -./include
- -./lib/cmake
- -./lib/pkgconfig
range-v3:
source: https://github.com/ericniebler/range-v3.git
source-depth: 1
source-tag: 0.10.0
plugin: cmake
configflags:
- -DRANGE_V3_TESTS=OFF
- -DRANGE_V3_EXAMPLES=OFF
- -DRANGE_V3_DOCS=OFF
prime: [-./*]
qgnomeplatform:
source: https://github.com/FedoraQt/QGnomePlatform.git
source-depth: 1
source-tag: 0.6.0
plugin: dump
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
- libgtk-3-dev
stage-packages:
- libgtk-3-0
- cinnamon-desktop-data
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make sub-theme-all
install -D "$SNAPCRAFT_PART_BUILD/theme/libqgnomeplatform.so" "$SNAPCRAFT_PART_INSTALL/usr/lib/$SNAPCRAFT_ARCH_TRIPLET/qt5/plugins/platformthemes/libqgnomeplatform.so"
after:
- qtconf
qtimageformats:
source: https://github.com/qt/qtimageformats.git
source-depth: 1
source-tag: v5.12.3
plugin: dump
build-snaps:
- kde-frameworks-5-core18-sdk
- kde-frameworks-5-core18
build-packages:
- libglvnd-dev
override-build: |
KF5_DIR=/snap/kde-frameworks-5-core18-sdk/current
$KF5_DIR/usr/lib/qt5/bin/qmake -qtconf "$SNAPCRAFT_STAGE/qt.conf"
make
make INSTALL_ROOT="$SNAPCRAFT_PART_INSTALL" install
mv "$SNAPCRAFT_PART_INSTALL/$KF5_DIR/usr" "$SNAPCRAFT_PART_INSTALL/usr"
rmdir "$SNAPCRAFT_PART_INSTALL/$KF5_DIR"
after:
- qtconf
xxhash:
source: https://github.com/Cyan4973/xxHash.git
source-depth: 1
source-tag: v0.7.2
plugin: make
make-parameters: [PREFIX=]
prime:
- -./bin
- -./include
- -./share