tdesktop: 0.9.49 -> 0.9.56

This commit is contained in:
Nikolay Amiantov 2016-06-27 22:01:44 +03:00
parent 323eb06499
commit f990abb801

View File

@ -9,18 +9,40 @@
}:
let
/* Find the index of the first element in the list matching the specified
predicate or returns null if no such element exists.
Example:
findFirstIndex (x: x > 3) [ 1 6 4 ]
=> 1
*/
findFirstIndex = pred: list:
# Poor man's Either via a list.
let searchFun = old: curr:
if lib.isList old then old
else if pred curr then [old]
else old + 1;
res = lib.foldl searchFun 0 list;
in if lib.isList res then lib.elemAt res 0 else null;
extractVersion = ver:
let suffix = findFirstIndex (x: x == "-") (lib.stringToCharacters ver);
in if suffix == null then ver else lib.substring 0 suffix ver;
system-x86_64 = lib.elem stdenv.system lib.platforms.x86_64;
packagedQt = "5.6.0";
systemQt = extractVersion qtbase.version;
in stdenv.mkDerivation rec {
name = "telegram-desktop-${version}";
version = "0.9.49";
version = "0.9.56";
qtVersion = lib.replaceStrings ["."] ["_"] packagedQt;
src = fetchFromGitHub {
owner = "telegramdesktop";
repo = "tdesktop";
rev = "v${version}";
sha256 = "1smz0d07xcpv7kv5v739b5a8wrgv5fx0wy15d3zzm3s69418a6nc";
sha256 = "000ngg6arfb6mif0hvin099f83q3sn7mw4vfvrikskczblw3a5lc";
};
tgaur = fetchgit {
@ -60,6 +82,7 @@ in stdenv.mkDerivation rec {
"INCLUDEPATH+=${dee}/include/dee-1.0"
"INCLUDEPATH+=${libdbusmenu-glib}/include/libdbusmenu-glib-0.4"
"INCLUDEPATH+=${breakpad}/include/breakpad"
"QT_TDESKTOP_VERSION=${systemQt}"
"LIBS+=-lcrypto"
"LIBS+=-lssl"
];
@ -74,14 +97,14 @@ in stdenv.mkDerivation rec {
patchPhase
sed -i 'Telegram/Telegram.pro' \
-e 's,CUSTOM_API_ID,,g' \
-e "s,/usr/local/tdesktop/Qt-[^/]*,$PWD/../qt,g" \
-e 's,/usr,/does-not-exist,g' \
-e '/LIBS += .*libxkbcommon.a/d' \
-e 's,LIBS += .*libz.a,LIBS += -lz,' \
-e 's,LIBS += .*libbreakpad_client.a,LIBS += ${breakpad}/lib/libbreakpad_client.a,' \
-e 's, -flto,,g' \
-e 's, -static-libstdc++,,g' \
-e 's,${packagedQt},${qtbase.version},g'
-e 's, -static-libstdc++,,g'
export qmakeFlags="$qmakeFlags QT_TDESKTOP_PATH=$PWD/../qt"
export QMAKE=$PWD/../qt/bin/qmake
( mkdir -p ../Libraries
@ -90,7 +113,8 @@ in stdenv.mkDerivation rec {
tar -xaf $i
done
cd qtbase-*
patch -p1 < ../../$sourceRoot/Telegram/Patches/qtbase_${qtVersion}.diff
# This patch is 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
@ -121,17 +145,17 @@ in stdenv.mkDerivation rec {
( mkdir -p Linux/obj/codegen_style/Debug
cd Linux/obj/codegen_style/Debug
$QMAKE CONFIG+=debug ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro
$QMAKE $qmakeFlags ../../../../Telegram/build/qmake/codegen_style/codegen_style.pro
buildPhase
)
( mkdir -p Linux/obj/codegen_numbers/Debug
cd Linux/obj/codegen_numbers/Debug
$QMAKE CONFIG+=debug ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro
$QMAKE $qmakeFlags ../../../../Telegram/build/qmake/codegen_numbers/codegen_numbers.pro
buildPhase
)
( mkdir -p Linux/DebugIntermediateLang
cd Linux/DebugIntermediateLang
$QMAKE CONFIG+=debug ../../Telegram/MetaLang.pro
$QMAKE $qmakeFlags ../../Telegram/MetaLang.pro
buildPhase
)