tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
tdesktop: 1.0.2 -> 1.0.27
Use system Qt.
Nikolay Amiantov
8 years ago
74f7db07
ef4b73a0
+56
-108
2 changed files
expand all
collapse all
unified
split
pkgs
applications
networking
instant-messengers
telegram
tdesktop
default.nix
top-level
all-packages.nix
+55
-107
pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
···
1
{ stdenv, lib, fetchFromGitHub, fetchgit, pkgconfig, gyp, cmake
2
-
, qtbase, qtimageformats, qtwayland
3
-
, breakpad, ffmpeg, openalSoft, openssl, zlib, libexif, lzma, libopus
4
-
, gtk2, glib, cairo, pango, gdk_pixbuf, atk, libappindicator-gtk2
5
-
, libwebp, libunity, dee, libdbusmenu-glib, libva-full, wayland
6
-
, xcbutilrenderutil, icu, libSM, libICE, libproxy, libvdpau
7
-
8
-
, libxcb, xcbutilwm, xcbutilimage, xcbutilkeysyms, libxkbcommon
9
-
, libpng, libjpeg, freetype, harfbuzz, pcre16, xproto, libX11
10
-
, inputproto, sqlite, dbus
11
}:
12
13
-
let
14
-
system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64;
15
-
packagedQt = "5.6.2";
16
-
# Hacky: split "1.2.3-4" into "1.2.3" and "4"
17
-
systemQt = (builtins.parseDrvName qtbase.version).name;
18
-
qtLibs = [ qtbase qtimageformats qtwayland ];
19
-
20
-
in stdenv.mkDerivation rec {
21
name = "telegram-desktop-${version}";
22
-
version = "1.0.2";
23
-
qtVersion = lib.replaceStrings ["."] ["_"] packagedQt;
24
25
-
src = fetchFromGitHub {
26
-
owner = "telegramdesktop";
27
-
repo = "tdesktop";
28
-
rev = "v${version}";
29
-
sha256 = "1pakxzs28v794x9mm7pb2m0phkfrwq19shz8a6lfyidb6ng85hy2";
30
};
31
32
tgaur = fetchgit {
33
-
url = "https://aur.archlinux.org/telegram-desktop.git";
34
-
rev = "957a76f9fb691486341bcf4781ad0ef3d16f6b69";
35
-
sha256 = "01nrvvq0mrdyvamjgqr4z5aahyd1wrf28jyddpfsnixp2w5kxqj8";
36
};
37
38
buildInputs = [
39
-
breakpad ffmpeg openalSoft openssl zlib libexif lzma libopus
40
-
gtk2 glib libappindicator-gtk2 libunity cairo pango gdk_pixbuf atk
41
-
dee libdbusmenu-glib libva-full xcbutilrenderutil icu libproxy
42
-
libSM libICE
43
-
# Qt dependencies
44
-
libxcb xcbutilwm xcbutilimage xcbutilkeysyms libxkbcommon
45
-
libpng libjpeg freetype harfbuzz pcre16 xproto libX11
46
-
inputproto sqlite dbus libwebp wayland libvdpau
47
];
48
49
-
nativeBuildInputs = [ pkgconfig gyp cmake ];
50
51
-
patches = [ "${tgaur}/aur-fixes.diff" ];
52
53
enableParallelBuilding = true;
54
55
-
qtSrcs = builtins.map (x: x.src) qtLibs;
56
-
qtNames = builtins.map (x: (builtins.parseDrvName x.name).name) (lib.tail qtLibs);
57
-
qtPatches = qtbase.patches;
58
-
59
-
buildCommand = ''
60
-
unpackPhase
61
-
cd "$sourceRoot"
62
-
63
-
patchPhase
64
65
-
sed -i Telegram/gyp/Telegram.gyp \
66
-
-e 's,/usr/include/breakpad,${breakpad}/include/breakpad,g'
0
0
0
0
0
0
0
0
0
0
0
67
0
68
sed -i Telegram/gyp/telegram_linux.gypi \
69
-e 's,/usr,/does-not-exist,g' \
0
70
-e 's,-flto,,g'
71
72
sed -i Telegram/gyp/qt.gypi \
73
-
-e 's,${packagedQt},${systemQt},g'
0
0
74
75
-
gypFlagsArray=(
76
-
"-Dlinux_path_qt=$PWD/../qt"
77
-
"-Dlinux_lib_ssl=-lssl"
78
-
"-Dlinux_lib_crypto=-lcrypto"
79
-
"-Dlinux_lib_icu=-licuuc -licutu -licui18n"
80
-
)
0
81
82
-
export QMAKE=$PWD/../qt/bin/qmake
83
-
( mkdir -p ../Libraries
84
-
cd ../Libraries
85
-
for i in $qtSrcs; do
86
-
tar -xaf $i
87
-
done
88
-
cd qtbase-*
89
-
# This patch is often outdated but the fixes doesn't feel very important
90
-
patch -p1 < ../../$sourceRoot/Telegram/Patches/qtbase_${qtVersion}.diff || true
91
-
for i in $qtPatches; do
92
-
patch -p1 < $i
93
-
done
94
-
${qtbase.postPatch}
95
-
cd ..
96
97
-
export configureFlags="-prefix "$PWD/../qt" -release -opensource -confirm-license -system-zlib \
98
-
-system-libpng -system-libjpeg -system-freetype -system-harfbuzz -system-pcre -system-xcb \
99
-
-system-xkbcommon-x11 -no-eglfs -no-gtkstyle -static -nomake examples -nomake tests \
100
-
-no-directfb -system-proxies -openssl-linked -dbus-linked -system-sqlite -verbose \
101
-
${lib.optionalString (!system-x86_64) "-no-sse2"} -no-sse3 -no-ssse3 \
102
-
-no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-mips_dsp -no-mips_dspr2"
103
-
export dontAddPrefix=1
104
-
export MAKEFLAGS=-j$NIX_BUILD_CORES
105
106
-
( cd qtbase-*
107
-
configurePhase
108
-
buildPhase
109
-
make install
110
-
)
111
-
for i in $qtNames; do
112
-
( cd $i-*
113
-
$QMAKE
114
-
buildPhase
115
-
make install
116
-
)
117
-
done
118
-
)
119
-
120
-
( cd Telegram/gyp
121
-
gyp "''${gypFlagsArray[@]}" --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=cmake
122
-
)
123
-
124
-
( cd out/Release
125
-
export ASM=$(type -p gcc)
126
-
cmake .
127
-
# For some reason, it can't find stdafx.h -- we need to build dependencies till it fails and then retry.
128
-
buildPhase || true
129
-
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -include stdafx.h"
130
-
buildPhase
131
-
)
132
133
-
install -Dm755 out/Release/Telegram $out/bin/telegram-desktop
0
134
mkdir -p $out/share/applications $out/share/kde4/services
135
sed "s,/usr/bin,$out/bin,g" $tgaur/telegramdesktop.desktop > $out/share/applications/telegramdesktop.desktop
136
sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol
137
for icon_size in 16 32 48 64 128 256 512; do
138
-
install -Dm644 "Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
139
done
140
-
141
-
fixupPhase
142
'';
143
144
meta = with stdenv.lib; {
···
1
{ stdenv, lib, fetchFromGitHub, fetchgit, pkgconfig, gyp, cmake
2
+
, qtbase, qtimageformats, makeQtWrapper
3
+
, breakpad, gtk3, libappindicator-gtk3, dee
4
+
, ffmpeg, openalSoft, minizip
0
0
0
0
0
0
5
}:
6
7
+
stdenv.mkDerivation rec {
0
0
0
0
0
0
0
8
name = "telegram-desktop-${version}";
9
+
version = "1.0.27";
0
10
11
+
# Submodules
12
+
src = fetchgit {
13
+
url = "https://github.com/telegramdesktop/tdesktop";
14
+
rev = "refs/tags/v${version}";
15
+
sha256 = "05g88g6h2a7f9biliicg81fqssx0y3akd3y5r2q2b5h8q3igqrfc";
16
};
17
18
tgaur = fetchgit {
19
+
url = "https://aur.archlinux.org/telegram-desktop-systemqt.git";
20
+
rev = "b4d169076ed12ec01941a95499774d5caa6fc00e";
21
+
sha256 = "0pmm6slabg9xazgs0ffnp8v0hx3vnpdfgymvapwqpm3h9mwk22x9";
22
};
23
24
buildInputs = [
25
+
gtk3 libappindicator-gtk3 dee qtbase qtimageformats ffmpeg openalSoft minizip
0
0
0
0
0
0
0
26
];
27
28
+
nativeBuildInputs = [ pkgconfig gyp cmake makeQtWrapper ];
29
30
+
patches = [ "${tgaur}/aur-build-fixes.patch" ];
31
32
enableParallelBuilding = true;
33
34
+
GYP_DEFINES = lib.concatStringsSep "," [
35
+
"TDESKTOP_DISABLE_CRASH_REPORTS"
36
+
"TDESKTOP_DISABLE_AUTOUPDATE"
37
+
"TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
38
+
];
0
0
0
0
39
40
+
NIX_CFLAGS_COMPILE = [
41
+
"-DTDESKTOP_DISABLE_AUTOUPDATE"
42
+
"-DTDESKTOP_DISABLE_CRASH_REPORTS"
43
+
"-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
44
+
"-I${minizip}/include/minizip"
45
+
# See Telegram/gyp/qt.gypi
46
+
"-I${qtbase.dev}/mkspecs/linux-g++"
47
+
] ++ lib.concatMap (x: [
48
+
"-I${qtbase.dev}/include/${x}"
49
+
"-I${qtbase.dev}/include/${x}/${qtbase.version}"
50
+
"-I${qtbase.dev}/include/${x}/${qtbase.version}/${x}"
51
+
]) [ "QtCore" "QtGui" ];
52
+
CPPFLAGS = NIX_CFLAGS_COMPILE;
53
54
+
preConfigure = ''
55
sed -i Telegram/gyp/telegram_linux.gypi \
56
-e 's,/usr,/does-not-exist,g' \
57
+
-e 's,appindicator-0.1,appindicator3-0.1,g' \
58
-e 's,-flto,,g'
59
60
sed -i Telegram/gyp/qt.gypi \
61
+
-e "s,/usr/bin/moc,moc,g"
62
+
sed -i Telegram/gyp/qt_rcc.gypi \
63
+
-e "s,/usr/bin/rcc,rcc,g"
64
65
+
gyp \
66
+
-Gconfig=Release \
67
+
--depth=Telegram/gyp \
68
+
--generator-output=../.. \
69
+
-Goutput_dir=out \
70
+
--format=cmake \
71
+
Telegram/gyp/Telegram.gyp
72
73
+
cd out/Release
0
0
0
0
0
0
0
0
0
0
0
0
0
74
75
+
NUM=$((`wc -l < CMakeLists.txt` - 2))
76
+
sed -i "$NUM r $tgaur/CMakeLists.inj" CMakeLists.txt
0
0
0
0
0
0
77
78
+
export ASM=$(type -p gcc)
79
+
'';
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
80
81
+
installPhase = ''
82
+
install -Dm755 Telegram $out/bin/telegram-desktop
83
mkdir -p $out/share/applications $out/share/kde4/services
84
sed "s,/usr/bin,$out/bin,g" $tgaur/telegramdesktop.desktop > $out/share/applications/telegramdesktop.desktop
85
sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol
86
for icon_size in 16 32 48 64 128 256 512; do
87
+
install -Dm644 "../../../Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
88
done
89
+
wrapQtProgram $out/bin/telegram-desktop
0
90
'';
91
92
meta = with stdenv.lib; {
+1
-1
pkgs/top-level/all-packages.nix
···
15614
15615
taskserver = callPackage ../servers/misc/taskserver { };
15616
15617
-
tdesktop = qt56.callPackage ../applications/networking/instant-messengers/telegram/tdesktop {
15618
inherit (pythonPackages) gyp;
15619
};
15620
···
15614
15615
taskserver = callPackage ../servers/misc/taskserver { };
15616
15617
+
tdesktop = qt5.callPackage ../applications/networking/instant-messengers/telegram/tdesktop {
15618
inherit (pythonPackages) gyp;
15619
};
15620