nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix

111 lines
3.3 KiB
Nix
Raw Normal View History

2017-07-30 19:46:00 +01:00
{ mkDerivation, lib, fetchgit, pkgconfig, gyp, cmake
2017-05-17 20:26:11 +01:00
, qtbase, qtimageformats
, gtk3, libappindicator-gtk3, dee
2017-06-17 22:24:30 +01:00
, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio
, gcc
2016-03-28 14:46:44 +01:00
}:
2017-05-17 20:26:11 +01:00
mkDerivation rec {
2016-03-28 14:46:44 +01:00
name = "telegram-desktop-${version}";
2017-09-17 12:08:16 +01:00
version = "1.1.23";
# Submodules
src = fetchgit {
2017-07-30 19:46:00 +01:00
url = "git://github.com/telegramdesktop/tdesktop";
rev = "v${version}";
2017-09-17 12:08:16 +01:00
sha256 = "0pdjrypjg015zvg8iydrja8kzvq0jsi1wz77r2cxvyyb4rkgyv7x";
2017-07-30 19:46:00 +01:00
fetchSubmodules = true;
2016-03-28 14:46:44 +01:00
};
tgaur = fetchgit {
url = "https://aur.archlinux.org/telegram-desktop-systemqt.git";
2017-09-17 12:08:16 +01:00
rev = "885d0594d8dfa0a17c14140579a3d27ef2b9bdd0";
sha256 = "0cdci8d8j3czhznp7gqn16w32j428njmzxr34pdsv40gggh0lbpn";
2016-03-28 14:46:44 +01:00
};
buildInputs = [
gtk3 libappindicator-gtk3 dee qtbase qtimageformats ffmpeg openalSoft minizip
2017-06-17 22:24:30 +01:00
libopus alsaLib libpulseaudio
2016-03-28 14:46:44 +01:00
];
2017-06-17 22:24:30 +01:00
nativeBuildInputs = [ pkgconfig gyp cmake gcc ];
2016-03-28 14:46:44 +01:00
2017-06-17 22:24:30 +01:00
patches = [ "${tgaur}/tdesktop.patch" ];
2016-03-28 14:46:44 +01:00
2016-11-23 14:55:44 +00:00
enableParallelBuilding = true;
2016-03-28 14:46:44 +01:00
GYP_DEFINES = lib.concatStringsSep "," [
"TDESKTOP_DISABLE_CRASH_REPORTS"
"TDESKTOP_DISABLE_AUTOUPDATE"
"TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
];
2016-11-23 14:55:44 +00:00
NIX_CFLAGS_COMPILE = [
"-DTDESKTOP_DISABLE_AUTOUPDATE"
"-DTDESKTOP_DISABLE_CRASH_REPORTS"
"-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
"-I${minizip}/include/minizip"
# See Telegram/gyp/qt.gypi
"-I${qtbase.dev}/mkspecs/linux-g++"
] ++ lib.concatMap (x: [
"-I${qtbase.dev}/include/${x}"
"-I${qtbase.dev}/include/${x}/${qtbase.version}"
"-I${qtbase.dev}/include/${x}/${qtbase.version}/${x}"
2017-06-17 22:24:30 +01:00
"-I${libopus.dev}/include/opus"
"-I${alsaLib.dev}/include/alsa"
"-I${libpulseaudio.dev}/include/pulse"
]) [ "QtCore" "QtGui" ];
CPPFLAGS = NIX_CFLAGS_COMPILE;
preConfigure = ''
2017-06-17 22:24:30 +01:00
pushd "Telegram/ThirdParty/libtgvoip"
patch -Np1 -i "${tgaur}/libtgvoip.patch"
popd
2016-11-23 14:55:44 +00:00
sed -i Telegram/gyp/telegram_linux.gypi \
2016-03-28 14:46:44 +01:00
-e 's,/usr,/does-not-exist,g' \
-e 's,appindicator-0.1,appindicator3-0.1,g' \
2016-11-23 14:55:44 +00:00
-e 's,-flto,,g'
2016-06-27 20:01:44 +01:00
2016-11-23 14:55:44 +00:00
sed -i Telegram/gyp/qt.gypi \
-e "s,/usr/bin/moc,moc,g"
sed -i Telegram/gyp/qt_rcc.gypi \
-e "s,/usr/bin/rcc,rcc,g"
gyp \
2017-06-17 22:24:30 +01:00
-Dbuild_defines=${GYP_DEFINES} \
-Gconfig=Release \
--depth=Telegram/gyp \
--generator-output=../.. \
-Goutput_dir=out \
--format=cmake \
Telegram/gyp/Telegram.gyp
cd out/Release
NUM=$((`wc -l < CMakeLists.txt` - 2))
sed -i "$NUM r $tgaur/CMakeLists.inj" CMakeLists.txt
export ASM=$(type -p gcc)
'';
installPhase = ''
install -Dm755 Telegram $out/bin/telegram-desktop
2016-03-28 14:46:44 +01:00
mkdir -p $out/share/applications $out/share/kde4/services
2017-09-17 12:08:16 +01:00
sed "s,/usr/bin,$out/bin,g" $tgaur/telegram-desktop.desktop > $out/share/applications/telegram-desktop.desktop
2016-03-28 14:46:44 +01:00
sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol
for icon_size in 16 32 48 64 128 256 512; do
install -Dm644 "../../../Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
2016-03-28 14:46:44 +01:00
done
'';
2017-05-17 20:26:11 +01:00
meta = with lib; {
2016-03-28 14:46:44 +01:00
description = "Telegram Desktop messaging app";
license = licenses.gpl3;
platforms = platforms.linux;
homepage = https://desktop.telegram.org/;
2016-05-25 16:43:15 +01:00
maintainers = with maintainers; [ abbradar garbas ];
2016-03-28 14:46:44 +01:00
};
}