about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/networking/instant-messengers/telegram
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/applications/networking/instant-messengers/telegram
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/applications/networking/instant-messengers/telegram')
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix41
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix32
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix18
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/fix-internal-compiler-error.patch68
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/generic.nix153
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-cli/default.nix36
-rw-r--r--nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix35
7 files changed, 383 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix
new file mode 100644
index 000000000000..77a8d57f8b6f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, fetchgit
+, qtbase, qtmultimedia, qtquick1, qtquickcontrols
+, qtimageformats, qtgraphicaleffects, qtwebkit
+, telegram-qml, libqtelegram-aseman-edition
+, gst_all_1
+, makeWrapper, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "cutegram-${meta.version}";
+
+  src = fetchgit {
+    url = "https://github.com/Aseman-Land/Cutegram.git";
+    rev = "1dbe2792fb5a1760339379907f906e236c09db84";
+    sha256 = "146vd3ri05da2asxjjxibnqmb685lgwl2kaz7mwb7ja7vi4149f0";
+  };
+
+  buildInputs =
+  [ qtbase qtmultimedia qtquick1 qtquickcontrols
+    qtimageformats qtgraphicaleffects qtwebkit
+    telegram-qml libqtelegram-aseman-edition
+  ] ++ (with gst_all_1; [ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly ]);
+
+
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ makeWrapper qmake ];
+
+  fixupPhase = ''
+    wrapProgram $out/bin/cutegram \
+      --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
+  '';
+
+  meta = with stdenv.lib; {
+    version = "2.7.1";
+    description = "Telegram client forked from sigram";
+    homepage = http://aseman.co/en/products/cutegram/;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ AndersonTorres ];
+    platforms = platforms.linux;
+  };
+}
+#TODO: appindicator, for system tray plugin
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix
new file mode 100644
index 000000000000..49368da708e9
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub
+, qtbase, qtmultimedia, qtquick1, qmake }:
+
+stdenv.mkDerivation rec {
+  name = "libqtelegram-aseman-edition-${meta.version}";
+
+  src = fetchFromGitHub {
+    owner = "Aseman-Land";
+    repo = "libqtelegram-aseman-edition";
+    rev = "v${meta.version}-stable";
+    sha256 = "1pfd4pvh51639zk9shv1s4f6pf0ympnhar8a302vhrkga9i4cbx6";
+  };
+
+  buildInputs = [ qtbase qtmultimedia qtquick1 ];
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ qmake ];
+
+  patchPhase = ''
+    substituteInPlace libqtelegram-ae.pro --replace "/libqtelegram-ae" ""
+    substituteInPlace libqtelegram-ae.pro --replace "/\$\$LIB_PATH" ""
+  '';
+
+  meta = with stdenv.lib; {
+    version = "6.1";
+    description = "A fork of libqtelegram by Aseman, using qmake";
+    homepage = src.meta.homepage;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.Profpatsch ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
new file mode 100644
index 000000000000..2aa090742044
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
@@ -0,0 +1,18 @@
+{ qt5 }:
+
+let
+  mkTelegram = args: qt5.callPackage (import ./generic.nix args) { };
+  stableVersion = {
+    stable = true;
+    version = "1.5.4";
+    sha256Hash = "0a52m5qkvk01yl3za3k7pccjrqkr8gbxqnj5lnhh1im1pdxqwh4m";
+    # svn log svn://svn.archlinux.org/community/telegram-desktop/trunk
+    archPatchesRevision = "415526";
+    archPatchesHash = "1lfzws90ab0vajhm5r64gyyqqc1g6a2ay0a1vkp0ah1iw5jh11ik";
+  };
+in {
+  stable = mkTelegram stableVersion;
+  preview = mkTelegram (stableVersion // {
+    stable = false;
+  });
+}
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/fix-internal-compiler-error.patch b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/fix-internal-compiler-error.patch
new file mode 100644
index 000000000000..1c79840d6260
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/fix-internal-compiler-error.patch
@@ -0,0 +1,68 @@
+Date: Tue, 17 Jul 2018 20:29:49 +0200
+
+---
+ Telegram/SourceFiles/export/data/export_data_types.cpp | 9 ++++++---
+ Telegram/SourceFiles/export/export_api_wrap.cpp        | 6 ++++--
+ 2 files changed, 10 insertions(+), 5 deletions(-)
+
+diff --git a/Telegram/SourceFiles/export/data/export_data_types.cpp b/Telegram/SourceFiles/export/data/export_data_types.cpp
+index f835dc2f9..e811c27e8 100644
+--- a/Telegram/SourceFiles/export/data/export_data_types.cpp
++++ b/Telegram/SourceFiles/export/data/export_data_types.cpp
+@@ -221,7 +221,8 @@ Image ParseMaxImage(
+ 				result.width = data.vw.v;
+ 				result.height = data.vh.v;
+ 				result.file.location = ParseLocation(data.vlocation);
+-				if constexpr (MTPDphotoCachedSize::Is<decltype(data)>()) {
++				constexpr bool condition = MTPDphotoCachedSize::Is<decltype(data)>();
++				if constexpr (condition) {
+ 					result.file.content = data.vbytes.v;
+ 					result.file.size = result.file.content.size();
+ 				} else {
+@@ -409,7 +410,8 @@ Document ParseDocument(
+ 			result.width = data.vw.v;
+ 			result.height = data.vh.v;
+ 			result.file.location = ParseLocation(data.vlocation);
+-			if constexpr (MTPDphotoCachedSize::Is<decltype(data)>()) {
++			constexpr bool condition = MTPDphotoCachedSize::Is<decltype(data)>();
++			if constexpr (condition) {
+ 				result.file.content = data.vbytes.v;
+ 				result.file.size = result.file.content.size();
+ 			} else {
+@@ -1017,7 +1019,8 @@ Message ParseMessage(
+ 	auto result = Message();
+ 	data.match([&](const auto &data) {
+ 		result.id = data.vid.v;
+-		if constexpr (!MTPDmessageEmpty::Is<decltype(data)>()) {
++		constexpr bool condition = !MTPDmessageEmpty::Is<decltype(data)>();
++		if constexpr (condition) {
+ 			result.toId = ParsePeerId(data.vto_id);
+ 			const auto peerId = (!data.is_out()
+ 				&& data.has_from_id()
+diff --git a/Telegram/SourceFiles/export/export_api_wrap.cpp b/Telegram/SourceFiles/export/export_api_wrap.cpp
+index b618937f6..bb98647dd 100644
+--- a/Telegram/SourceFiles/export/export_api_wrap.cpp
++++ b/Telegram/SourceFiles/export/export_api_wrap.cpp
+@@ -709,7 +709,8 @@ void ApiWrap::handleUserpicsSlice(const MTPphotos_Photos &result) {
+ 	Expects(_userpicsProcess != nullptr);
+ 
+ 	result.match([&](const auto &data) {
+-		if constexpr (MTPDphotos_photos::Is<decltype(data)>()) {
++		constexpr bool condition = MTPDphotos_photos::Is<decltype(data)>();
++		if constexpr (condition) {
+ 			_userpicsProcess->lastSlice = true;
+ 		}
+ 		loadUserpicsFiles(Data::ParseUserpicsSlice(
+@@ -1141,7 +1142,8 @@ void ApiWrap::requestMessagesSlice() {
+ 		result.match([&](const MTPDmessages_messagesNotModified &data) {
+ 			error("Unexpected messagesNotModified received.");
+ 		}, [&](const auto &data) {
+-			if constexpr (MTPDmessages_messages::Is<decltype(data)>()) {
++			constexpr bool condition = MTPDmessages_messages::Is<decltype(data)>();
++			if constexpr (condition) {
+ 				_chatProcess->lastSlice = true;
+ 			}
+ 			loadMessagesFiles(Data::ParseMessagesSlice(
+-- 
+2.16.3
+
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/generic.nix b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/generic.nix
new file mode 100644
index 000000000000..c20da7eeb665
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/tdesktop/generic.nix
@@ -0,0 +1,153 @@
+{ stable, version, sha256Hash, archPatchesRevision, archPatchesHash }:
+
+{ mkDerivation, lib, fetchFromGitHub, fetchsvn
+, pkgconfig, pythonPackages, cmake, wrapGAppsHook
+, qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify, xdg_utils
+, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
+}:
+
+with lib;
+
+mkDerivation rec {
+  name = "telegram-desktop-${version}";
+  inherit version;
+
+  # Telegram-Desktop with submodules
+  src = fetchFromGitHub {
+    owner = "telegramdesktop";
+    repo = "tdesktop";
+    rev = "v${version}";
+    sha256 = sha256Hash;
+    fetchSubmodules = true;
+  };
+
+  # Arch patches (svn export telegram-desktop/trunk)
+  archPatches = fetchsvn {
+    url = "svn://svn.archlinux.org/community/telegram-desktop/trunk";
+    rev = archPatchesRevision;
+    sha256 = archPatchesHash;
+  };
+
+  # TODO: libtgvoip.patch no-gtk2.patch
+  patches = [
+      "${archPatches}/tdesktop.patch"
+    ]
+    # TODO: Only required to work around a compiler bug.
+    # This should be fixed in GCC 7.3.1 (or later?)
+    ++ [ ./fix-internal-compiler-error.patch ];
+
+  postPatch = ''
+    substituteInPlace Telegram/SourceFiles/platform/linux/linux_libs.cpp \
+      --replace '"appindicator"' '"${libappindicator-gtk3}/lib/libappindicator3.so"'
+    substituteInPlace Telegram/SourceFiles/platform/linux/linux_libnotify.cpp \
+      --replace '"notify"' '"${libnotify}/lib/libnotify.so"'
+  '';
+
+  nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake wrapGAppsHook ];
+
+  # We want to run wrapProgram manually (with additional parameters)
+  dontWrapGApps = true;
+
+  buildInputs = [
+    qtbase qtimageformats gtk3 libappindicator-gtk3
+    dee ffmpeg openalSoft minizip libopus alsaLib libpulseaudio range-v3
+  ];
+
+  enableParallelBuilding = true;
+
+  GYP_DEFINES = concatStringsSep "," [
+    "TDESKTOP_DISABLE_CRASH_REPORTS"
+    "TDESKTOP_DISABLE_AUTOUPDATE"
+    "TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
+  ];
+
+  NIX_CFLAGS_COMPILE = [
+    "-DTDESKTOP_DISABLE_CRASH_REPORTS"
+    "-DTDESKTOP_DISABLE_AUTOUPDATE"
+    "-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
+    "-I${minizip}/include/minizip"
+    # See Telegram/gyp/qt.gypi
+    "-I${getDev qtbase}/mkspecs/linux-g++"
+  ] ++ concatMap (x: [
+    "-I${getDev qtbase}/include/${x}"
+    "-I${getDev qtbase}/include/${x}/${qtbase.version}"
+    "-I${getDev qtbase}/include/${x}/${qtbase.version}/${x}"
+    "-I${getDev libopus}/include/opus"
+    "-I${getDev alsaLib}/include/alsa"
+    "-I${getDev libpulseaudio}/include/pulse"
+    ]) [ "QtCore" "QtGui" "QtDBus" ];
+  CPPFLAGS = NIX_CFLAGS_COMPILE;
+
+  preConfigure = ''
+    pushd "Telegram/ThirdParty/libtgvoip"
+    patch -Np1 -i "${archPatches}/libtgvoip.patch"
+    popd
+
+    sed -i Telegram/gyp/telegram_linux.gypi \
+      -e 's,/usr,/does-not-exist,g' \
+      -e 's,appindicator-0.1,appindicator3-0.1,g' \
+      -e 's,-flto,,g'
+
+    sed -i Telegram/gyp/qt.gypi \
+      -e "s,/usr/include/qt/QtCore/,${qtbase.dev}/include/QtCore/,g" \
+      -e 's,\d+",\d+" | head -n1,g'
+    sed -i Telegram/gyp/qt_moc.gypi \
+      -e "s,/usr/bin/moc,moc,g"
+    sed -i Telegram/gyp/qt_rcc.gypi \
+      -e "s,/usr/bin/rcc,rcc,g"
+
+    # Build system assumes x86, but it works fine on non-x86 if we patch this one flag out
+    sed -i Telegram/ThirdParty/libtgvoip/libtgvoip.gyp \
+      -e "/-msse2/d"
+
+    gyp \
+      -Dapi_id=17349 \
+      -Dapi_hash=344583e45741c457fe1862106095a5eb \
+      -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 $archPatches/CMakeLists.inj" CMakeLists.txt
+
+    export ASM=$(type -p gcc)
+  '';
+
+  installPhase = ''
+    install -Dm755 Telegram $out/bin/telegram-desktop
+
+    mkdir -p $out/share/applications $out/share/kde4/services
+    install -m444 "$src/lib/xdg/telegramdesktop.desktop" "$out/share/applications/telegram-desktop.desktop"
+    sed "s,/usr/bin,$out/bin,g" $archPatches/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.png"
+    done
+  '';
+
+  postFixup = ''
+    # This is necessary to run Telegram in a pure environment.
+    # We also use gappsWrapperArgs from wrapGAppsHook.
+    wrapProgram $out/bin/telegram-desktop \
+      "''${gappsWrapperArgs[@]}" \
+      --prefix QT_PLUGIN_PATH : "${qtbase}/${qtbase.qtPluginPrefix}" \
+      --prefix PATH : ${xdg_utils}/bin \
+      --set XDG_RUNTIME_DIR "XDG-RUNTIME-DIR"
+    sed -i $out/bin/telegram-desktop \
+      -e "s,'XDG-RUNTIME-DIR',\"\''${XDG_RUNTIME_DIR:-/run/user/\$(id --user)}\","
+  '';
+
+  meta = {
+    description = "Telegram Desktop messaging app "
+      + (if stable then "(stable version)" else "(pre-release)");
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    homepage = https://desktop.telegram.org/;
+    maintainers = with maintainers; [ primeos abbradar garbas ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-cli/default.nix b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-cli/default.nix
new file mode 100644
index 000000000000..3e9ebf3fe93f
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-cli/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchgit, bash, libconfig, libevent, openssl,
+  readline, zlib, lua5_2, python, pkgconfig, jansson
+}:
+
+stdenv.mkDerivation rec {
+  name = "telegram-cli-2016-03-23";
+
+  src = fetchgit {
+    url = "https://github.com/vysheng/tg.git";
+    sha256 = "07sss5cnw2ygd7mp8f5532lmj7qm6ywqf4cjaq5g13i8igzqzwzj";
+    rev = "6547c0b21b977b327b3c5e8142963f4bc246187a";
+  };
+
+  buildInputs = [
+    libconfig libevent openssl readline zlib
+    lua5_2 python pkgconfig jansson
+  ];
+  installPhase = ''
+    mkdir -p $out/bin
+    cp ./bin/telegram-cli $out/bin/telegram-wo-key
+    cp ./tg-server.pub $out/
+    cat > $out/bin/telegram-cli <<EOF
+    #!${bash}/bin/sh
+    $out/bin/telegram-wo-key -k $out/tg-server.pub "\$@"
+    EOF
+    chmod +x $out/bin/telegram-cli
+  '';
+
+  meta = {
+    description = "Command-line interface for Telegram messenger";
+    homepage = https://telegram.org/;
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.jagajaga ];
+  };
+}
diff --git a/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix
new file mode 100644
index 000000000000..0efa7bee1d0b
--- /dev/null
+++ b/nixpkgs/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix
@@ -0,0 +1,35 @@
+{ stdenv, fetchFromGitHub
+, qtbase, qtmultimedia, qtquick1, qmake
+, libqtelegram-aseman-edition }:
+
+stdenv.mkDerivation rec {
+  name = "telegram-qml-${meta.version}";
+
+  src = fetchFromGitHub {
+    owner = "Aseman-Land";
+    repo = "TelegramQML";
+    rev = "v${meta.version}";
+    sha256 = "0j8vn845f2virvddk9yjbljy6vkr9ikyn6iy7hpj8nvr2xls3499";
+  };
+
+  propagatedBuildInputs = [ qtbase qtmultimedia qtquick1 libqtelegram-aseman-edition ];
+  enableParallelBuilding = true;
+  nativeBuildInputs = [ qmake ];
+
+  patchPhase = ''
+    substituteInPlace telegramqml.pro --replace "/\$\$LIB_PATH" ""
+    substituteInPlace telegramqml.pro --replace "INSTALL_HEADERS_PREFIX/telegramqml" "INSTALL_HEADERS_PREFIX"
+  '';
+
+  qmakeFlags = [ "BUILD_MODE+=lib" ];
+
+  meta = with stdenv.lib; {
+    version = "0.9.2";
+    description = "Telegram API tools for QtQml and Qml";
+    homepage = src.meta.homepage;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.Profpatsch ];
+    platforms = platforms.linux;
+  };
+
+}