tdesktop: Clean up the patching

This commit is contained in:
Michael Weiss 2018-03-21 22:08:22 +01:00
parent 0477af8a09
commit f60d7e2add
2 changed files with 28 additions and 30 deletions

View File

@ -6,10 +6,16 @@ in {
stable = true; stable = true;
version = "1.2.6"; version = "1.2.6";
sha256Hash = "15g0m2wwqfp13wd7j31p8cx1kpylx5m8ljaksnsqdkgyr9l1ar8w"; sha256Hash = "15g0m2wwqfp13wd7j31p8cx1kpylx5m8ljaksnsqdkgyr9l1ar8w";
# svn log svn://svn.archlinux.org/community/telegram-desktop/trunk
archPatchesRevision = "283641";
archPatchesHash = "0v4213vrabfa2dmwnqgb8n6hl54938mw9glaim3amyslxphmdrfb";
}; };
preview = mkTelegram { preview = mkTelegram {
stable = false; stable = false;
version = "1.2.12"; version = "1.2.12";
sha256Hash = "1b9qc4a14jqjl30z4bjh1zbqsmgl25kdp0hj8p7xbj34zlkzfw5m"; sha256Hash = "1b9qc4a14jqjl30z4bjh1zbqsmgl25kdp0hj8p7xbj34zlkzfw5m";
# svn ls -v --depth empty svn://svn.archlinux.org/community/telegram-desktop/trunk
archPatchesRevision = "308775";
archPatchesHash = "0ggx64kdadrbd4bw5z0wi0fdg6hni7n9nxz9dp56p8hlw1wgpsls";
}; };
} }

View File

@ -1,6 +1,6 @@
{ stable, version, sha256Hash }: { stable, version, sha256Hash, archPatchesRevision, archPatchesHash }:
{ mkDerivation, lib, fetchgit, fetchpatch { mkDerivation, lib, fetchgit, fetchsvn
, pkgconfig, pythonPackages, cmake, makeWrapper , pkgconfig, pythonPackages, cmake, makeWrapper
, qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify , qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify
, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3 , dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
@ -12,7 +12,7 @@ mkDerivation rec {
name = "telegram-desktop-${version}"; name = "telegram-desktop-${version}";
inherit version; inherit version;
# Submodules # Telegram-Desktop with submodules
src = fetchgit { src = fetchgit {
url = "git://github.com/telegramdesktop/tdesktop"; url = "git://github.com/telegramdesktop/tdesktop";
rev = "v${version}"; rev = "v${version}";
@ -20,29 +20,21 @@ mkDerivation rec {
fetchSubmodules = true; fetchSubmodules = true;
}; };
# TODO: Not active anymore. # Arch patches (svn export telegram-desktop/trunk)
tgaur = fetchgit { archPatches = fetchsvn {
url = "https://aur.archlinux.org/telegram-desktop-systemqt.git"; url = "svn://svn.archlinux.org/community/telegram-desktop/trunk";
rev = "1ed27ce40913b9e6e87faf7a2310660c2790b98e"; rev = archPatchesRevision;
sha256 = "1i7ipqgisaw54g1nbg2cvpbx89g9gyjjb3sak1486pxsasp1qhyc"; sha256 = archPatchesHash;
}; };
patches = [ (if stable # TODO: libtgvoip.patch no-gtk2.patch
then (fetchpatch { patches = [ "${archPatches}/tdesktop.patch" ];
name = "tdesktop.patch";
url = "https://git.archlinux.org/svntogit/community.git/plain/repos/community-x86_64/tdesktop.patch?h=packages/telegram-desktop&id=f0eefac36f529295f8b065a14b6d5f1a51d7614d";
sha256 = "1a4wap5xnp6zn4913r3zdpy6hvkcfxcy4zzimy7fwzp7iwy20iqa";
})
else (fetchpatch {
name = "tdesktop.patch";
url = "https://git.archlinux.org/svntogit/community.git/plain/repos/community-x86_64/tdesktop.patch?h=packages/telegram-desktop&id=59ca8bd4428cf2fb3f02d7f1e1a5558545a4c075";
sha256 = "0jj2kifzx83f9nhk30csy2373avpyx0ci70a8bc7j2dm3wxym50l";
}))
];
postPatch = '' postPatch = ''
substituteInPlace Telegram/SourceFiles/platform/linux/linux_libs.cpp --replace '"appindicator"' '"${libappindicator-gtk3}/lib/libappindicator3.so"' substituteInPlace Telegram/SourceFiles/platform/linux/linux_libs.cpp \
substituteInPlace Telegram/SourceFiles/platform/linux/linux_libnotify.cpp --replace '"notify"' '"${libnotify}/lib/libnotify.so"' --replace '"appindicator"' '"${libappindicator-gtk3}/lib/libappindicator3.so"'
substituteInPlace Telegram/SourceFiles/platform/linux/linux_libnotify.cpp \
--replace '"notify"' '"${libnotify}/lib/libnotify.so"'
''; '';
nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake makeWrapper ]; nativeBuildInputs = [ pkgconfig pythonPackages.gyp cmake makeWrapper ];
@ -61,8 +53,8 @@ mkDerivation rec {
]; ];
NIX_CFLAGS_COMPILE = [ NIX_CFLAGS_COMPILE = [
"-DTDESKTOP_DISABLE_AUTOUPDATE"
"-DTDESKTOP_DISABLE_CRASH_REPORTS" "-DTDESKTOP_DISABLE_CRASH_REPORTS"
"-DTDESKTOP_DISABLE_AUTOUPDATE"
"-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME" "-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
"-I${minizip}/include/minizip" "-I${minizip}/include/minizip"
# See Telegram/gyp/qt.gypi # See Telegram/gyp/qt.gypi
@ -78,9 +70,8 @@ mkDerivation rec {
CPPFLAGS = NIX_CFLAGS_COMPILE; CPPFLAGS = NIX_CFLAGS_COMPILE;
preConfigure = '' preConfigure = ''
pushd "Telegram/ThirdParty/libtgvoip" pushd "Telegram/ThirdParty/libtgvoip"
patch -Np1 -i "${tgaur}/libtgvoip.patch" patch -Np1 -i "${archPatches}/libtgvoip.patch"
popd popd
sed -i Telegram/gyp/telegram_linux.gypi \ sed -i Telegram/gyp/telegram_linux.gypi \
@ -108,16 +99,17 @@ mkDerivation rec {
cd out/Release cd out/Release
NUM=$((`wc -l < CMakeLists.txt` - 2)) NUM=$((`wc -l < CMakeLists.txt` - 2))
sed -i "$NUM r $tgaur/CMakeLists.inj" CMakeLists.txt sed -i "$NUM r $archPatches/CMakeLists.inj" CMakeLists.txt
export ASM=$(type -p gcc) export ASM=$(type -p gcc)
''; '';
installPhase = '' installPhase = ''
install -Dm755 Telegram $out/bin/telegram-desktop 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/telegram-desktop.desktop > $out/share/applications/telegram-desktop.desktop install -m444 "$src/lib/xdg/telegramdesktop.desktop" "$out/share/applications/telegram-desktop.desktop"
sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol sed "s,/usr/bin,$out/bin,g" $archPatches/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