tdesktop: 1.0.2 -> 1.0.27
Use system Qt.
This commit is contained in:
parent
ef4b73a038
commit
74f7db075a
@ -1,144 +1,92 @@
|
|||||||
{ stdenv, lib, fetchFromGitHub, fetchgit, pkgconfig, gyp, cmake
|
{ stdenv, lib, fetchFromGitHub, fetchgit, pkgconfig, gyp, cmake
|
||||||
, qtbase, qtimageformats, qtwayland
|
, qtbase, qtimageformats, makeQtWrapper
|
||||||
, breakpad, ffmpeg, openalSoft, openssl, zlib, libexif, lzma, libopus
|
, breakpad, gtk3, libappindicator-gtk3, dee
|
||||||
, gtk2, glib, cairo, pango, gdk_pixbuf, atk, libappindicator-gtk2
|
, ffmpeg, openalSoft, minizip
|
||||||
, libwebp, libunity, dee, libdbusmenu-glib, libva-full, wayland
|
|
||||||
, xcbutilrenderutil, icu, libSM, libICE, libproxy, libvdpau
|
|
||||||
|
|
||||||
, libxcb, xcbutilwm, xcbutilimage, xcbutilkeysyms, libxkbcommon
|
|
||||||
, libpng, libjpeg, freetype, harfbuzz, pcre16, xproto, libX11
|
|
||||||
, inputproto, sqlite, dbus
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
stdenv.mkDerivation rec {
|
||||||
system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64;
|
|
||||||
packagedQt = "5.6.2";
|
|
||||||
# Hacky: split "1.2.3-4" into "1.2.3" and "4"
|
|
||||||
systemQt = (builtins.parseDrvName qtbase.version).name;
|
|
||||||
qtLibs = [ qtbase qtimageformats qtwayland ];
|
|
||||||
|
|
||||||
in stdenv.mkDerivation rec {
|
|
||||||
name = "telegram-desktop-${version}";
|
name = "telegram-desktop-${version}";
|
||||||
version = "1.0.2";
|
version = "1.0.27";
|
||||||
qtVersion = lib.replaceStrings ["."] ["_"] packagedQt;
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
# Submodules
|
||||||
owner = "telegramdesktop";
|
src = fetchgit {
|
||||||
repo = "tdesktop";
|
url = "https://github.com/telegramdesktop/tdesktop";
|
||||||
rev = "v${version}";
|
rev = "refs/tags/v${version}";
|
||||||
sha256 = "1pakxzs28v794x9mm7pb2m0phkfrwq19shz8a6lfyidb6ng85hy2";
|
sha256 = "05g88g6h2a7f9biliicg81fqssx0y3akd3y5r2q2b5h8q3igqrfc";
|
||||||
};
|
};
|
||||||
|
|
||||||
tgaur = fetchgit {
|
tgaur = fetchgit {
|
||||||
url = "https://aur.archlinux.org/telegram-desktop.git";
|
url = "https://aur.archlinux.org/telegram-desktop-systemqt.git";
|
||||||
rev = "957a76f9fb691486341bcf4781ad0ef3d16f6b69";
|
rev = "b4d169076ed12ec01941a95499774d5caa6fc00e";
|
||||||
sha256 = "01nrvvq0mrdyvamjgqr4z5aahyd1wrf28jyddpfsnixp2w5kxqj8";
|
sha256 = "0pmm6slabg9xazgs0ffnp8v0hx3vnpdfgymvapwqpm3h9mwk22x9";
|
||||||
};
|
};
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
breakpad ffmpeg openalSoft openssl zlib libexif lzma libopus
|
gtk3 libappindicator-gtk3 dee qtbase qtimageformats ffmpeg openalSoft minizip
|
||||||
gtk2 glib libappindicator-gtk2 libunity cairo pango gdk_pixbuf atk
|
|
||||||
dee libdbusmenu-glib libva-full xcbutilrenderutil icu libproxy
|
|
||||||
libSM libICE
|
|
||||||
# Qt dependencies
|
|
||||||
libxcb xcbutilwm xcbutilimage xcbutilkeysyms libxkbcommon
|
|
||||||
libpng libjpeg freetype harfbuzz pcre16 xproto libX11
|
|
||||||
inputproto sqlite dbus libwebp wayland libvdpau
|
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [ pkgconfig gyp cmake ];
|
nativeBuildInputs = [ pkgconfig gyp cmake makeQtWrapper ];
|
||||||
|
|
||||||
patches = [ "${tgaur}/aur-fixes.diff" ];
|
patches = [ "${tgaur}/aur-build-fixes.patch" ];
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
||||||
qtSrcs = builtins.map (x: x.src) qtLibs;
|
GYP_DEFINES = lib.concatStringsSep "," [
|
||||||
qtNames = builtins.map (x: (builtins.parseDrvName x.name).name) (lib.tail qtLibs);
|
"TDESKTOP_DISABLE_CRASH_REPORTS"
|
||||||
qtPatches = qtbase.patches;
|
"TDESKTOP_DISABLE_AUTOUPDATE"
|
||||||
|
"TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
|
||||||
|
];
|
||||||
|
|
||||||
buildCommand = ''
|
NIX_CFLAGS_COMPILE = [
|
||||||
unpackPhase
|
"-DTDESKTOP_DISABLE_AUTOUPDATE"
|
||||||
cd "$sourceRoot"
|
"-DTDESKTOP_DISABLE_CRASH_REPORTS"
|
||||||
|
"-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
|
||||||
patchPhase
|
"-I${minizip}/include/minizip"
|
||||||
|
# See Telegram/gyp/qt.gypi
|
||||||
sed -i Telegram/gyp/Telegram.gyp \
|
"-I${qtbase.dev}/mkspecs/linux-g++"
|
||||||
-e 's,/usr/include/breakpad,${breakpad}/include/breakpad,g'
|
] ++ lib.concatMap (x: [
|
||||||
|
"-I${qtbase.dev}/include/${x}"
|
||||||
|
"-I${qtbase.dev}/include/${x}/${qtbase.version}"
|
||||||
|
"-I${qtbase.dev}/include/${x}/${qtbase.version}/${x}"
|
||||||
|
]) [ "QtCore" "QtGui" ];
|
||||||
|
CPPFLAGS = NIX_CFLAGS_COMPILE;
|
||||||
|
|
||||||
|
preConfigure = ''
|
||||||
sed -i Telegram/gyp/telegram_linux.gypi \
|
sed -i Telegram/gyp/telegram_linux.gypi \
|
||||||
-e 's,/usr,/does-not-exist,g' \
|
-e 's,/usr,/does-not-exist,g' \
|
||||||
|
-e 's,appindicator-0.1,appindicator3-0.1,g' \
|
||||||
-e 's,-flto,,g'
|
-e 's,-flto,,g'
|
||||||
|
|
||||||
sed -i Telegram/gyp/qt.gypi \
|
sed -i Telegram/gyp/qt.gypi \
|
||||||
-e 's,${packagedQt},${systemQt},g'
|
-e "s,/usr/bin/moc,moc,g"
|
||||||
|
sed -i Telegram/gyp/qt_rcc.gypi \
|
||||||
|
-e "s,/usr/bin/rcc,rcc,g"
|
||||||
|
|
||||||
gypFlagsArray=(
|
gyp \
|
||||||
"-Dlinux_path_qt=$PWD/../qt"
|
-Gconfig=Release \
|
||||||
"-Dlinux_lib_ssl=-lssl"
|
--depth=Telegram/gyp \
|
||||||
"-Dlinux_lib_crypto=-lcrypto"
|
--generator-output=../.. \
|
||||||
"-Dlinux_lib_icu=-licuuc -licutu -licui18n"
|
-Goutput_dir=out \
|
||||||
)
|
--format=cmake \
|
||||||
|
Telegram/gyp/Telegram.gyp
|
||||||
|
|
||||||
export QMAKE=$PWD/../qt/bin/qmake
|
cd out/Release
|
||||||
( mkdir -p ../Libraries
|
|
||||||
cd ../Libraries
|
|
||||||
for i in $qtSrcs; do
|
|
||||||
tar -xaf $i
|
|
||||||
done
|
|
||||||
cd qtbase-*
|
|
||||||
# This patch is often outdated but the fixes doesn't feel very important
|
|
||||||
patch -p1 < ../../$sourceRoot/Telegram/Patches/qtbase_${qtVersion}.diff || true
|
|
||||||
for i in $qtPatches; do
|
|
||||||
patch -p1 < $i
|
|
||||||
done
|
|
||||||
${qtbase.postPatch}
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
export configureFlags="-prefix "$PWD/../qt" -release -opensource -confirm-license -system-zlib \
|
NUM=$((`wc -l < CMakeLists.txt` - 2))
|
||||||
-system-libpng -system-libjpeg -system-freetype -system-harfbuzz -system-pcre -system-xcb \
|
sed -i "$NUM r $tgaur/CMakeLists.inj" CMakeLists.txt
|
||||||
-system-xkbcommon-x11 -no-eglfs -no-gtkstyle -static -nomake examples -nomake tests \
|
|
||||||
-no-directfb -system-proxies -openssl-linked -dbus-linked -system-sqlite -verbose \
|
|
||||||
${lib.optionalString (!system-x86_64) "-no-sse2"} -no-sse3 -no-ssse3 \
|
|
||||||
-no-sse4.1 -no-sse4.2 -no-avx -no-avx2 -no-mips_dsp -no-mips_dspr2"
|
|
||||||
export dontAddPrefix=1
|
|
||||||
export MAKEFLAGS=-j$NIX_BUILD_CORES
|
|
||||||
|
|
||||||
( cd qtbase-*
|
|
||||||
configurePhase
|
|
||||||
buildPhase
|
|
||||||
make install
|
|
||||||
)
|
|
||||||
for i in $qtNames; do
|
|
||||||
( cd $i-*
|
|
||||||
$QMAKE
|
|
||||||
buildPhase
|
|
||||||
make install
|
|
||||||
)
|
|
||||||
done
|
|
||||||
)
|
|
||||||
|
|
||||||
( cd Telegram/gyp
|
|
||||||
gyp "''${gypFlagsArray[@]}" --depth=. --generator-output=../.. -Goutput_dir=out Telegram.gyp --format=cmake
|
|
||||||
)
|
|
||||||
|
|
||||||
( cd out/Release
|
|
||||||
export ASM=$(type -p gcc)
|
export ASM=$(type -p gcc)
|
||||||
cmake .
|
'';
|
||||||
# For some reason, it can't find stdafx.h -- we need to build dependencies till it fails and then retry.
|
|
||||||
buildPhase || true
|
|
||||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -include stdafx.h"
|
|
||||||
buildPhase
|
|
||||||
)
|
|
||||||
|
|
||||||
install -Dm755 out/Release/Telegram $out/bin/telegram-desktop
|
installPhase = ''
|
||||||
|
install -Dm755 Telegram $out/bin/telegram-desktop
|
||||||
mkdir -p $out/share/applications $out/share/kde4/services
|
mkdir -p $out/share/applications $out/share/kde4/services
|
||||||
sed "s,/usr/bin,$out/bin,g" $tgaur/telegramdesktop.desktop > $out/share/applications/telegramdesktop.desktop
|
sed "s,/usr/bin,$out/bin,g" $tgaur/telegramdesktop.desktop > $out/share/applications/telegramdesktop.desktop
|
||||||
sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol
|
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
|
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"
|
install -Dm644 "../../../Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
|
||||||
done
|
done
|
||||||
|
wrapQtProgram $out/bin/telegram-desktop
|
||||||
fixupPhase
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
@ -15614,7 +15614,7 @@ with pkgs;
|
|||||||
|
|
||||||
taskserver = callPackage ../servers/misc/taskserver { };
|
taskserver = callPackage ../servers/misc/taskserver { };
|
||||||
|
|
||||||
tdesktop = qt56.callPackage ../applications/networking/instant-messengers/telegram/tdesktop {
|
tdesktop = qt5.callPackage ../applications/networking/instant-messengers/telegram/tdesktop {
|
||||||
inherit (pythonPackages) gyp;
|
inherit (pythonPackages) gyp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user