Files
haikuports/net-im/telegram-desktop/telegram_desktop-1.9.3.recipe
2020-01-06 23:05:08 +10:00

160 lines
5.5 KiB
Bash

SUMMARY="Telegram Desktop Messenger"
DESCRIPTION="Unofficial build of the original Telegram client for Haiku."
HOMEPAGE="https://www.telegram.org/"
COPYRIGHT="2013-2019 Telegram"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz"
CHECKSUM_SHA256="ca9c67369140952d5ffe404ca082517193e3832b2c21ba1af791f078e4d9a7bb"
SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz"
SOURCE_DIR="tdesktop-$portVersion-full"
srcGitRev_2="8a732ee6736af8af024b5b2032580b85a9be8239"
SOURCE_URI_2="https://github.com/ericniebler/range-v3/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="6cd6a412db92bf3c26a408f5807751f976b4a4cb2801c705cb63001e53b47a11"
SOURCE_FILENAME_2="range-$srcGitRev_2.tar.gz"
srcGitRev_3="0663103551379b958b2e79c51d51d163ec484300"
SOURCE_URI_3="https://salsa.debian.org/debian/telegram-desktop/raw/$srcGitRev_3/debian/rules#noarchive"
CHECKSUM_SHA256_3="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:libenchant_2$secondaryArchSuffix
lib:libglib_2.0$secondaryArchSuffix
lib:libgthread_2.0$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:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libavcodec$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libenchant_2$secondaryArchSuffix
devel:libglib_2.0$secondaryArchSuffix
devel:libgthread_2.0$secondaryArchSuffix
devel:liblz4$secondaryArchSuffix
devel:liblzma$secondaryArchSuffix
devel:libminizip$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libopus$secondaryArchSuffix
devel:libQt5Core$secondaryArchSuffix
devel:libQt5Gui$secondaryArchSuffix
devel:libQt5Network$secondaryArchSuffix
devel:libQt5Widgets$secondaryArchSuffix
devel:librapidjson$secondaryArchSuffix
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:lrelease$secondaryArchSuffix
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()
{
ln -sfn $sourceDir2/range-v3-$srcGitRev_2 Telegram/ThirdParty/range-v3
# get API_ID and API_HASH from Debian
local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir3/rules`
local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir3/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_DESKTOP_FILE_GENERATION=ON \
-DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \
-DTDESKTOP_API_ID=$TELEGRAM_API_ID \
-DTDESKTOP_API_HASH=$TELEGRAM_API_HASH
export DISABLE_ASLR=1
make $jobArgs
#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
}