void-packages/srcpkgs/telegram-desktop/template

105 lines
4.0 KiB
Bash

# Template file for 'telegram-desktop'
pkgname=telegram-desktop
version=1.3.14
revision=3
_libtgvoip_commit=bfa1e6ab76a467c6c6bff7eabb7c213acc7a1b34
_GSL_commit=d846fe50a3f0bb7767c7e087a05f4be95f4da0ec
_variant_commit=550ac2f159ca883d360c196149b466955c77a573
_crl_commit=527ad273b683d52c5adf5b45b73c6466aa0d0cf0
_Catch_commit=5ca44b68721833ae3731802ed99af67c6f38a53a
build_style=cmake
create_wrksrc=yes
build_wrksrc="tdesktop-${version}/Telegram"
cmake_builddir=build-telegram
configure_args="-DENABLE_CRASH_REPORTS=OFF -DENABLE_GTK_INTEGRATION=ON
-DENABLE_PULSEAUDIO=ON"
hostmakedepends="pkg-config qt5-qmake qt5-host-tools python"
makedepends="alsa-lib-devel ffmpeg-devel gtk+3-devel libappindicator-devel
libdbusmenu-glib-devel libopenal-devel minizip-devel opus-devel
pulseaudio-devel qt5-devel range-v3 libva-devel"
depends="qt5-imageformats"
short_desc="Telegram Desktop messaging app"
maintainer="John <johnz@posteo.net>"
license="GPL-3.0-or-later WITH OpenSSL"
homepage="https://desktop.telegram.org/"
changelog="https://github.com/telegramdesktop/tdesktop/blob/v${version}/changelog.txt"
distfiles="https://github.com/telegramdesktop/tdesktop/archive/v${version}.tar.gz
https://github.com/telegramdesktop/libtgvoip/archive/${_libtgvoip_commit}.tar.gz
https://github.com/Microsoft/GSL/archive/${_GSL_commit}.tar.gz
https://github.com/mapbox/variant/archive/${_variant_commit}.tar.gz
https://github.com/telegramdesktop/crl/archive/${_crl_commit}.tar.gz
https://github.com/catchorg/Catch2/archive/${_Catch_commit}.tar.gz"
checksum="83daeded641f79bd370b5e83be88242ab57520e7754f1371a9e5c1f3d9863f2a
74cf9046687e88ab6074e8f8946da53d95b11abb34a51db1f042ab0ae14f1b91
be81db4ab1b57102a0fa1cd0c4a6469294eb9daf24294347592245b754f65ff6
aa794dfefe0a90501587e36d977b958d0df888503117a8d9aa43dc14f8526d9d
d7e64fc8a2e284a5be8c0b0c6e7bfbaf951751081919829cb3bb290544c732e8
d24e6d9df2b8aa5739d3b9077c6b0ff0ef4d5ef8acc52c3a57e32893854d8d18"
build_options=clang
if [ "$build_option_clang" ]; then
CFLAGS="-fPIE -fPIC -fstack-protector-strong"
CXXFLAGS="-fPIE -fPIC -fstack-protector-strong"
LDFLAGS="-pie"
hostmakedepends+=" clang"
configure_args+=" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++"
nocross=yes
fi
case $XBPS_TARGET_MACHINE in
i686*) nodebug=yes;; # ENOMEM
mips*) broken="unsupported";;
esac
case $XBPS_TARGET_MACHINE in
*-musl) makedepends+=" libexecinfo-devel" ;;
esac
case "$XBPS_TARGET_MACHINE" in
arm*|mips*)
makedepends+=" libatomic-devel"
configure_args+=" -DUSE_LIBATOMIC=ON" ;;
esac
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" qt5-devel"
fi
post_extract() {
cp -rup ${wrksrc}/libtgvoip-${_libtgvoip_commit}/* ${build_wrksrc}/ThirdParty/libtgvoip
cp -rup ${wrksrc}/GSL-${_GSL_commit}/* ${build_wrksrc}/ThirdParty/GSL
cp -rup ${wrksrc}/variant-${_variant_commit}/* ${build_wrksrc}/ThirdParty/variant
cp -rup ${wrksrc}/crl-${_crl_commit}/* ${build_wrksrc}/ThirdParty/crl
cp -rup ${wrksrc}/Catch2-${_Catch_commit}/* ${build_wrksrc}/ThirdParty/Catch
cp ${FILESDIR}/Telegram.cmake ${build_wrksrc}/CMakeLists.txt
cp ${FILESDIR}/ThirdParty-crl.cmake ${build_wrksrc}/ThirdParty/crl/CMakeLists.txt
cp ${FILESDIR}/ThirdParty-libtgvoip.cmake ${build_wrksrc}/ThirdParty/libtgvoip/CMakeLists.txt
cp ${FILESDIR}/ThirdParty-libtgvoip-webrtc.cmake \
${build_wrksrc}/ThirdParty/libtgvoip/webrtc_dsp/webrtc/CMakeLists.txt
mkdir -p ${build_wrksrc}/cmake
cp ${FILESDIR}/FindBreakpad.cmake ${build_wrksrc}/cmake
cp ${FILESDIR}/TelegramCodegen.cmake ${build_wrksrc}/cmake
cp ${FILESDIR}/TelegramTests.cmake ${build_wrksrc}/cmake
mkdir -p ${build_wrksrc}/native
cp ${FILESDIR}/TelegramCodegenTools.cmake ${build_wrksrc}/native/CMakeLists.txt
# change wrksrc temporarily so that patches can be applied
wrksrc="${wrksrc}/tdesktop-${version}"
}
pre_configure() {
cd native
CC= CXX= CPP= LD= AR= AS= RANLIB= CFLAGS= CXXFLAGS= LDFLAGS= cmake .
make ${makejobs}
}
post_install() {
for i in 16 32 48 64 128 256 512; do
vinstall Resources/art/icon$i.png 644 usr/share/icons/hicolor/${i}x${i} telegram-desktop.png
done
}