Merge pull request #14266 from abbradar/tdesktop

Add Telegram Desktop

+304 -8
+164
pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
··· 1 + { stdenv, lib, fetchFromGitHub, fetchgit, qtbase, qtimageformats 2 + , breakpad, ffmpeg, openalSoft, openssl, zlib, libexif, lzma, libopus 3 + , gtk2, glib, cairo, pango, gdk_pixbuf, atk, libappindicator-gtk2 4 + , libunity, dee, libdbusmenu-glib, libva 5 + 6 + , pkgconfig, libxcb, xcbutilwm, xcbutilimage, xcbutilkeysyms 7 + , libxkbcommon, libpng, libjpeg, freetype, harfbuzz, pcre16 8 + , xproto, libX11, inputproto, sqlite, dbus 9 + }: 10 + 11 + let 12 + system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64; 13 + in stdenv.mkDerivation rec { 14 + name = "telegram-desktop-${version}"; 15 + version = "0.9.33"; 16 + qtVersion = lib.replaceStrings ["."] ["_"] qtbase.version; 17 + 18 + src = fetchFromGitHub { 19 + owner = "telegramdesktop"; 20 + repo = "tdesktop"; 21 + rev = "v${version}"; 22 + sha256 = "020vwm7h22951v9zh457d82qy5ifp746vwishkvb16h1vwr1qx4s"; 23 + }; 24 + 25 + tgaur = fetchgit { 26 + url = "https://aur.archlinux.org/telegram-desktop.git"; 27 + rev = "df47a864282959b103a08b65844e9088e012fdb3"; 28 + sha256 = "1v1dbi8yiaf2hgghniykm5qbnda456xj3zfjnbqysn41f5cn40h4"; 29 + }; 30 + 31 + buildInputs = [ 32 + breakpad ffmpeg openalSoft openssl zlib libexif lzma libopus 33 + gtk2 glib libappindicator-gtk2 libunity cairo pango gdk_pixbuf atk 34 + dee libdbusmenu-glib libva 35 + # Qt dependencies 36 + libxcb xcbutilwm xcbutilimage xcbutilkeysyms libxkbcommon 37 + libpng libjpeg freetype harfbuzz pcre16 xproto libX11 38 + inputproto sqlite dbus 39 + ]; 40 + 41 + nativeBuildInputs = [ pkgconfig ]; 42 + 43 + enableParallelBuilding = true; 44 + 45 + qmakeFlags = [ 46 + "CONFIG+=release" 47 + "DEFINES+=TDESKTOP_DISABLE_AUTOUPDATE" 48 + "DEFINES+=TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME" 49 + "INCLUDEPATH+=${gtk2}/include/gtk-2.0" 50 + "INCLUDEPATH+=${glib}/include/glib-2.0" 51 + "INCLUDEPATH+=${glib}/lib/glib-2.0/include" 52 + "INCLUDEPATH+=${cairo}/include/cairo" 53 + "INCLUDEPATH+=${pango}/include/pango-1.0" 54 + "INCLUDEPATH+=${gtk2}/lib/gtk-2.0/include" 55 + "INCLUDEPATH+=${gdk_pixbuf}/include/gdk-pixbuf-2.0" 56 + "INCLUDEPATH+=${atk}/include/atk-1.0" 57 + "INCLUDEPATH+=${libappindicator-gtk2}/include/libappindicator-0.1" 58 + "INCLUDEPATH+=${libunity}/include/unity" 59 + "INCLUDEPATH+=${dee}/include/dee-1.0" 60 + "INCLUDEPATH+=${libdbusmenu-glib}/include/libdbusmenu-glib-0.4" 61 + "INCLUDEPATH+=${breakpad}/include/breakpad" 62 + "LIBS+=-lcrypto" 63 + "LIBS+=-lssl" 64 + "LIBS+=-lz" 65 + "LIBS+=-lgobject-2.0" 66 + "LIBS+=-lxkbcommon" 67 + "LIBS+=-lX11" 68 + "LIBS+=${breakpad}/lib/libbreakpad_client.a" 69 + "LIBS+=./../../../Libraries/QtStatic/qtbase/plugins/platforms/libqxcb.a" 70 + "LIBS+=./../../../Libraries/QtStatic/qtimageformats/plugins/imageformats/libqwebp.a" 71 + ]; 72 + 73 + qtSrcs = qtbase.srcs ++ [ qtimageformats.src ]; 74 + qtPatches = qtbase.patches; 75 + 76 + buildCommand = '' 77 + # We don't use nativeBuildInputs to avoid adding system Qt 5 libraries to various paths. 78 + export PATH="${qtbase}/bin:$PATH" 79 + 80 + unpackPhase 81 + cd "$sourceRoot" 82 + patchPhase 83 + sed -i 'Telegram/Telegram.pro' \ 84 + -e 's/CUSTOM_API_ID//g' \ 85 + -e 's,/usr,/does-not-exist,g' \ 86 + -e '/LIBS += .*libxkbcommon.a/d' \ 87 + -e '/LIBS += .*libz.a/d' \ 88 + -e '/LIBS += .*libbreakpad_client.a/d' \ 89 + -e 's,-flto ,,g' 90 + echo "Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)" >> Telegram/SourceFiles/stdafx.cpp 91 + 92 + ( mkdir -p ../Libraries 93 + cd ../Libraries 94 + for i in $qtSrcs; do 95 + tar -xaf $i 96 + done 97 + mv qt-everywhere-opensource-src-* QtStatic 98 + mv qtbase-opensource-src-* ./QtStatic/qtbase 99 + mv qtimageformats-opensource-src-* ./QtStatic/qtimageformats 100 + cd QtStatic/qtbase 101 + patch -p1 < ../../../$sourceRoot/Telegram/_qtbase_${qtVersion}_patch.diff 102 + cd .. 103 + for i in $qtPatches; do 104 + patch -p1 < $i 105 + done 106 + ${qtbase.postPatch} 107 + 108 + export configureFlags="-prefix "../../qt" -release -opensource -confirm-license -system-zlib \ 109 + -system-libpng -system-libjpeg -system-freetype -system-harfbuzz -system-pcre -system-xcb \ 110 + -system-xkbcommon-x11 -no-opengl -static -nomake examples -nomake tests \ 111 + -openssl-linked -dbus-linked -system-sqlite -verbose \ 112 + ${lib.optionalString (!system-x86_64) "-no-sse2"} -no-sse3 -no-ssse3 \ 113 + -no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-mips_dsp -no-mips_dspr2" 114 + export dontAddPrefix=1 115 + export buildFlags="module-qtbase module-qtimageformats" 116 + export installFlags="module-qtbase-install_subtargets module-qtimageformats-install_subtargets" 117 + 118 + ( export MAKEFLAGS=-j$NIX_BUILD_CORES 119 + configurePhase 120 + ) 121 + buildPhase 122 + installPhase 123 + ) 124 + 125 + ( mkdir -p Linux/DebugIntermediateStyle 126 + cd Linux/DebugIntermediateStyle 127 + qmake CONFIG+=debug ../../Telegram/MetaStyle.pro 128 + buildPhase 129 + ) 130 + ( mkdir -p Linux/DebugIntermediateLang 131 + cd Linux/DebugIntermediateLang 132 + qmake CONFIG+=debug ../../Telegram/MetaLang.pro 133 + buildPhase 134 + ) 135 + 136 + ( mkdir -p Linux/ReleaseIntermediate 137 + cd Linux/ReleaseIntermediate 138 + qmake $qmakeFlags ../../Telegram/Telegram.pro 139 + pattern="^PRE_TARGETDEPS +=" 140 + grep "$pattern" "../../Telegram/Telegram.pro" | sed "s/$pattern//g" | xargs make 141 + 142 + qmake $qmakeFlags ../../Telegram/Telegram.pro 143 + buildPhase 144 + ) 145 + 146 + install -Dm755 Linux/Release/Telegram $out/bin/telegram-desktop 147 + mkdir -p $out/share/applications $out/share/kde4/services 148 + sed "s,/usr/bin,$out/bin,g" $tgaur/telegramdesktop.desktop > $out/share/applications/telegramdesktop.desktop 149 + sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol 150 + for icon_size in 16 32 48 64 128 256 512; do 151 + install -Dm644 "Telegram/SourceFiles/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png" 152 + done 153 + 154 + fixupPhase 155 + ''; 156 + 157 + meta = with stdenv.lib; { 158 + description = "Telegram Desktop messaging app"; 159 + license = licenses.gpl3; 160 + platforms = platforms.linux; 161 + homepage = "https://desktop.telegram.org/"; 162 + maintainers = with maintainers; [ abbradar ]; 163 + }; 164 + }
+24
pkgs/development/libraries/breakpad/default.nix
··· 1 + { stdenv, fetchgit }: 2 + 3 + stdenv.mkDerivation { 4 + name = "breakpad-2016-03-28"; 5 + 6 + src = fetchgit { 7 + url = "https://chromium.googlesource.com/breakpad/breakpad"; 8 + rev = "512cac3a1b69721ab727f3079f4d29e4580467b1"; 9 + sha256 = "0v7k7racdl2f16mbi3r0vkbkagh0gf6ksnpf3ri28b9pjfngkl5s"; 10 + }; 11 + 12 + breakpad_lss = fetchgit { 13 + url = "https://chromium.googlesource.com/linux-syscall-support"; 14 + rev = "08056836f2b4a5747daff75435d10d649bed22f6"; 15 + sha256 = "1ryshs2nyxwa0kn3rlbnd5b3fhna9vqm560yviddcfgdm2jyg0hz"; 16 + }; 17 + 18 + enableParallelBuilding = true; 19 + 20 + prePatch = '' 21 + cp -r $breakpad_lss src/third_party/lss 22 + chmod +w -R src/third_party/lss 23 + ''; 24 + }
+25
pkgs/development/libraries/dee/default.nix
··· 1 + { stdenv, fetchurl, python, pkgconfig 2 + , glib, icu, gobjectIntrospection }: 3 + 4 + stdenv.mkDerivation rec { 5 + name = "dee-${version}"; 6 + version = "1.2.7"; 7 + 8 + src = fetchurl { 9 + url = "https://launchpad.net/dee/1.0/${version}/+download/${name}.tar.gz"; 10 + sha256 = "12mzffk0lyd566y46x57jlvb9af152b4dqpasr40zal4wrn37w0v"; 11 + }; 12 + 13 + buildInputs = [ glib gobjectIntrospection icu ]; 14 + nativeBuildInputs = [ python pkgconfig ]; 15 + 16 + enableParallelBuilding = true; 17 + 18 + meta = with stdenv.lib; { 19 + description = "A library that uses DBus to provide objects allowing you to create Model-View-Controller type programs across DBus"; 20 + homepage = "https://launchpad.net/dee"; 21 + license = licenses.lgpl3; 22 + platforms = platforms.linux; 23 + maintainers = with maintainers; [ abbradar ]; 24 + }; 25 + }
+27
pkgs/development/libraries/libgee/0.6.nix
··· 1 + { stdenv, fetchurl, pkgconfig, glib }: 2 + 3 + let 4 + ver_maj = "0.6"; 5 + ver_min = "8"; 6 + in 7 + stdenv.mkDerivation rec { 8 + name = "libgee-${ver_maj}.${ver_min}"; 9 + 10 + src = fetchurl { 11 + url = "https://download.gnome.org/sources/libgee/${ver_maj}/${name}.tar.xz"; 12 + sha256 = "1lzmxgz1bcs14ghfp8qqzarhn7s64ayx8c508ihizm3kc5wqs7x6"; 13 + }; 14 + 15 + buildInputs = [ glib ]; 16 + nativeBuildInputs = [ pkgconfig ]; 17 + 18 + doCheck = true; 19 + 20 + meta = with stdenv.lib; { 21 + description = "Utility library providing GObject-based interfaces and classes for commonly used data structures"; 22 + license = licenses.lgpl21Plus; 23 + platforms = platforms.linux; 24 + homepage = "http://live.gnome.org/Libgee"; 25 + maintainers = with maintainers; [ abbradar ]; 26 + }; 27 + }
+27
pkgs/development/libraries/libunity/default.nix
··· 1 + { stdenv, fetchurl, vala, python, intltool, pkgconfig 2 + , glib, libgee_0_6, gtk3, dee, libdbusmenu-glib 3 + }: 4 + 5 + stdenv.mkDerivation rec { 6 + name = "libunity-${version}"; 7 + version = "6.12.0"; 8 + 9 + src = fetchurl { 10 + url = "https://launchpad.net/libunity/6.0/${version}/+download/${name}.tar.gz"; 11 + sha256 = "1nadapl3390x98q1wv2yarh60hzi7ck0d1s8zz9xsiq3zz6msbjd"; 12 + }; 13 + 14 + buildInputs = [ glib libgee_0_6 gtk3 ]; 15 + propagatedBuildInputs = [ dee libdbusmenu-glib ]; 16 + nativeBuildInputs = [ vala python intltool pkgconfig ]; 17 + 18 + enableParallelBuilding = true; 19 + 20 + meta = with stdenv.lib; { 21 + description = "A library for instrumenting- and integrating with all aspects of the Unity shell"; 22 + homepage = "https://launchpad.net/libunity"; 23 + license = licenses.lgpl3; 24 + platforms = platforms.linux; 25 + maintainers = with maintainers; [ abbradar ]; 26 + }; 27 + }
+18 -7
pkgs/development/libraries/pcre/default.nix
··· 1 - { stdenv, fetchurl, unicodeSupport ? true, cplusplusSupport ? true 1 + { stdenv, lib, fetchurl, unicodeSupport ? true, cplusplusSupport ? true 2 2 , windows ? null 3 + , withCharSize ? 8 3 4 }: 4 5 5 6 with stdenv.lib; 6 7 7 - stdenv.mkDerivation rec { 8 - name = "pcre-8.38"; 8 + assert withCharSize != 8 -> !cplusplusSupport; 9 + 10 + let 11 + charFlags = if withCharSize == 8 then [ ] 12 + else if withCharSize == 16 then [ "--enable-pcre16" "--disable-pcre8" ] 13 + else if withCharSize == 32 then [ "--enable-pcre32" "--disable-pcre8" ] 14 + else abort "Invalid character size"; 15 + 16 + in stdenv.mkDerivation rec { 17 + name = "pcre${lib.optionalString (withCharSize != 8) (toString withCharSize)}-8.38"; 18 + # FIXME: add "version" attribute and use it in URL 9 19 10 20 src = fetchurl { 11 - url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${name}.tar.bz2"; 21 + url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.bz2"; 12 22 sha256 = "1pvra19ljkr5ky35y2iywjnsckrs9ch2anrf5b0dc91hw8v2vq5r"; 13 23 }; 14 24 ··· 17 27 18 28 outputs = [ "out" "doc" "man" ]; 19 29 30 + # FIXME: Refactor into list! 20 31 configureFlags = '' 21 32 --enable-jit 22 - ${if unicodeSupport then "--enable-unicode-properties" else ""} 23 - ${if !cplusplusSupport then "--disable-cpp" else ""} 24 - ''; 33 + ${lib.optionalString unicodeSupport "--enable-unicode-properties"} 34 + ${lib.optionalString (!cplusplusSupport) "--disable-cpp"} 35 + '' + lib.optionalString (charFlags != []) " ${toString charFlags}"; 25 36 26 37 doCheck = with stdenv; !(isCygwin || isFreeBSD); 27 38 # XXX: test failure on Cygwin
+19 -1
pkgs/top-level/all-packages.nix
··· 6389 6389 box2d = callPackage ../development/libraries/box2d { }; 6390 6390 box2d_2_0_1 = callPackage ../development/libraries/box2d/2.0.1.nix { }; 6391 6391 6392 + breakpad = callPackage ../development/libraries/breakpad { }; 6393 + 6392 6394 buddy = callPackage ../development/libraries/buddy { }; 6393 6395 6394 6396 bwidget = callPackage ../development/libraries/bwidget { }; ··· 6548 6550 dbus_tools = pkgs.dbus.tools; 6549 6551 dbus_libs = pkgs.dbus.libs; 6550 6552 dbus_daemon = pkgs.dbus.daemon; 6553 + 6554 + dee = callPackage ../development/libraries/dee { }; 6551 6555 6552 6556 dhex = callPackage ../applications/editors/dhex { }; 6553 6557 ··· 7424 7428 7425 7429 libgdata = gnome3.libgdata; 7426 7430 7431 + libgee_0_6 = callPackage ../development/libraries/libgee/0.6.nix { }; 7432 + 7427 7433 libgig = callPackage ../development/libraries/libgig { }; 7428 7434 7429 7435 libgnome_keyring = callPackage ../development/libraries/libgnome-keyring { }; ··· 7899 7905 libu2f-host = callPackage ../development/libraries/libu2f-host { }; 7900 7906 7901 7907 libu2f-server = callPackage ../development/libraries/libu2f-server { }; 7908 + 7909 + libunity = callPackage ../development/libraries/libunity { }; 7902 7910 7903 7911 libunistring = callPackage ../development/libraries/libunistring { }; 7904 7912 ··· 8344 8352 8345 8353 pcre = callPackage ../development/libraries/pcre { 8346 8354 unicodeSupport = config.pcre.unicode or true; 8355 + }; 8356 + pcre16 = pcre.override { 8357 + cplusplusSupport = false; 8358 + withCharSize = 16; 8359 + }; 8360 + pcre32 = pcre.override { 8361 + cplusplusSupport = false; 8362 + withCharSize = 32; 8347 8363 }; 8348 8364 8349 8365 pcre2 = callPackage ../development/libraries/pcre2 { }; ··· 13836 13852 13837 13853 taskserver = callPackage ../servers/misc/taskserver { }; 13838 13854 13839 - telegram-cli = callPackage ../applications/networking/instant-messengers/telegram/telegram-cli/default.nix { }; 13855 + tdesktop = qt55.callPackage ../applications/networking/instant-messengers/telegram/tdesktop { }; 13856 + 13857 + telegram-cli = callPackage ../applications/networking/instant-messengers/telegram/telegram-cli { }; 13840 13858 13841 13859 telepathy_gabble = callPackage ../applications/networking/instant-messengers/telepathy/gabble { }; 13842 13860