Files
haikuports/net-im/telegram-desktop/telegram_desktop-2.1.12.recipe
Gerasim Troeglazov 0832762270 Telegram: bump version
2020-06-18 21:59:37 +10:00

167 lines
5.6 KiB
Bash

SUMMARY="Telegram Desktop Messenger"
DESCRIPTION="Unofficial build of the original Telegram client for Haiku."
HOMEPAGE="https://www.telegram.org/"
COPYRIGHT="2013-2020 Telegram"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz"
CHECKSUM_SHA256="a89ad7e91b7ecbd20fa9c9735b069d5cb319456878b52fb8754cf696567c33ad"
SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz"
SOURCE_DIR="tdesktop-$portVersion-full"
srcGitRev_2="0663103551379b958b2e79c51d51d163ec484300"
SOURCE_URI_2="https://salsa.debian.org/debian/telegram-desktop/raw/$srcGitRev_2/debian/rules#noarchive"
CHECKSUM_SHA256_2="2b24fb808acee36b5a15824c4ff8bd8b8e83a326a9e4593d2b21922425c5ffb3"
PATCHES="telegram_desktop-$portVersion.patchset"
ADDITIONAL_FILES="
telegram_desktop.rdef.in
logo_256_no_margin.png
"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
telegram_desktop$secondaryArchSuffix = $portVersion
app:Telegram$secondaryArchSuffix
cmd:tg_notify_gate
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libavformat$secondaryArchSuffix
lib:libavutil$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libglib_2.0$secondaryArchSuffix
lib:libgthread_2.0$secondaryArchSuffix
lib:libhunspell_1.7$secondaryArchSuffix
lib:liblz4$secondaryArchSuffix
lib:liblzma$secondaryArchSuffix
lib:libminizip$secondaryArchSuffix
lib:libopenal$secondaryArchSuffix
lib:libopus$secondaryArchSuffix
lib:libQt5Core$secondaryArchSuffix
lib:libQt5Gui$secondaryArchSuffix
lib:libQt5Network$secondaryArchSuffix
lib:libQt5Widgets$secondaryArchSuffix
lib:libswresample$secondaryArchSuffix
lib:libswscale$secondaryArchSuffix
lib:libxxhash$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libavcodec$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
devel:libgthread_2.0$secondaryArchSuffix
devel:libhunspell_1.7$secondaryArchSuffix
devel:liblz4$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libminizip$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libopus$secondaryArchSuffix
devel:libqrcodegen$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libQt5Network$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:librapidjson$secondaryArchSuffix
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libxxhash$secondaryArchSuffix
devel:libz$secondaryArchSuffix
devel:range_v3$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:lrelease$secondaryArchSuffix >= 5
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:python
cmd:sed
"
PATCH()
{
cp -f $sourceDir/../../../additional-files/logo_256_no_margin.png Telegram/Resources/art
}
BUILD()
{
# get API_ID and API_HASH from Debian
local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir2/rules`
local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir2/rules`
if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then
TELEGRAM_API_ID="17349"
TELEGRAM_API_HASH="344583e45741c457fe1862106095a5eb"
echo -e "\e[91m***************************************************************************\e[39m"
echo -e "\e[91m Use demo API_ID = $TELEGRAM_API_ID and API_HASH = $TELEGRAM_API_HASH \e[39m"
echo -e "\e[91m***************************************************************************\e[39m"
else
echo -e "\e[32m***************************************************************************\e[39m"
echo -e "\e[32m Use custom API_ID = $TELEGRAM_API_ID and API_HASH = $TELEGRAM_API_HASH \e[39m"
echo -e "\e[32m***************************************************************************\e[39m"
fi
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON \
-DTDESKTOP_API_TEST=OFF \
-DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \
-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \
-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \
-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF \
-DDESKTOP_APP_USE_PACKAGED_GSL=OFF \
-DDESKTOP_APP_USE_PACKAGED_VARIANT=OFF \
-DDESKTOP_APP_USE_PACKAGED_EXPECTED=OFF \
-DDESKTOP_APP_USE_PACKAGED_FONTS=ON \
-DDESKTOP_APP_USE_HUNSPELL_ONLY=ON \
-DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \
-DTDESKTOP_API_ID=$TELEGRAM_API_ID \
-DTDESKTOP_API_HASH=$TELEGRAM_API_HASH
export DISABLE_ASLR=1
# multi-job takes too much memory
make
#build notify gate tool
gcc -o tg-notify-gate $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.cpp -lbe
rc -o tg-notify-gate.rsrc $sourceDir/Telegram/SourceFiles/platform/haiku/notifications_haiku_gate.rdef
xres -o tg-notify-gate tg-notify-gate.rsrc
mimeset --all tg-notify-gate
}
INSTALL()
{
mkdir -p $appsDir $prefix/bin
cp build/tg-notify-gate $prefix/bin
cp build/bin/telegram-desktop $appsDir/Telegram
strip $appsDir/Telegram
local APP_SIGNATURE="application/x-vnd.telegram"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/telegram_desktop.rdef.in > build/telegram_desktop.rdef
addResourcesToBinaries build/telegram_desktop.rdef $appsDir/Telegram
addAppDeskbarSymlink $appsDir/Telegram
}