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