tdesktop: Clean up the patching
This commit is contained in:
parent
0477af8a09
commit
f60d7e2add
@ -6,10 +6,16 @@ in {
|
||||
stable = true;
|
||||
version = "1.2.6";
|
||||
sha256Hash = "15g0m2wwqfp13wd7j31p8cx1kpylx5m8ljaksnsqdkgyr9l1ar8w";
|
||||
# svn log svn://svn.archlinux.org/community/telegram-desktop/trunk
|
||||
archPatchesRevision = "283641";
|
||||
archPatchesHash = "0v4213vrabfa2dmwnqgb8n6hl54938mw9glaim3amyslxphmdrfb";
|
||||
};
|
||||
preview = mkTelegram {
|
||||
stable = false;
|
||||
version = "1.2.12";
|
||||
sha256Hash = "1b9qc4a14jqjl30z4bjh1zbqsmgl25kdp0hj8p7xbj34zlkzfw5m";
|
||||
# svn ls -v --depth empty svn://svn.archlinux.org/community/telegram-desktop/trunk
|
||||
archPatchesRevision = "308775";
|
||||
archPatchesHash = "0ggx64kdadrbd4bw5z0wi0fdg6hni7n9nxz9dp56p8hlw1wgpsls";
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{ stable, version, sha256Hash }:
|
||||
{ stable, version, sha256Hash, archPatchesRevision, archPatchesHash }:
|
||||
|
||||
{ mkDerivation, lib, fetchgit, fetchpatch
|
||||
{ mkDerivation, lib, fetchgit, fetchsvn
|
||||
, pkgconfig, pythonPackages, cmake, makeWrapper
|
||||
, qtbase, qtimageformats, gtk3, libappindicator-gtk3, libnotify
|
||||
, dee, ffmpeg, openalSoft, minizip, libopus, alsaLib, libpulseaudio, range-v3
|
||||
@ -12,7 +12,7 @@ mkDerivation rec {
|
||||
name = "telegram-desktop-${version}";
|
||||
inherit version;
|
||||
|
||||
# Submodules
|
||||
# Telegram-Desktop with submodules
|
||||
src = fetchgit {
|
||||
url = "git://github.com/telegramdesktop/tdesktop";
|
||||
rev = "v${version}";
|
||||
@ -20,29 +20,21 @@ mkDerivation rec {
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
# TODO: Not active anymore.
|
||||
tgaur = fetchgit {
|
||||
url = "https://aur.archlinux.org/telegram-desktop-systemqt.git";
|
||||
rev = "1ed27ce40913b9e6e87faf7a2310660c2790b98e";
|
||||
sha256 = "1i7ipqgisaw54g1nbg2cvpbx89g9gyjjb3sak1486pxsasp1qhyc";
|
||||
# Arch patches (svn export telegram-desktop/trunk)
|
||||
archPatches = fetchsvn {
|
||||
url = "svn://svn.archlinux.org/community/telegram-desktop/trunk";
|
||||
rev = archPatchesRevision;
|
||||
sha256 = archPatchesHash;
|
||||
};
|
||||
|
||||
patches = [ (if stable
|
||||
then (fetchpatch {
|
||||
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";
|
||||
}))
|
||||
];
|
||||
# TODO: libtgvoip.patch no-gtk2.patch
|
||||
patches = [ "${archPatches}/tdesktop.patch" ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Telegram/SourceFiles/platform/linux/linux_libs.cpp --replace '"appindicator"' '"${libappindicator-gtk3}/lib/libappindicator3.so"'
|
||||
substituteInPlace Telegram/SourceFiles/platform/linux/linux_libnotify.cpp --replace '"notify"' '"${libnotify}/lib/libnotify.so"'
|
||||
substituteInPlace Telegram/SourceFiles/platform/linux/linux_libs.cpp \
|
||||
--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 ];
|
||||
@ -61,8 +53,8 @@ mkDerivation rec {
|
||||
];
|
||||
|
||||
NIX_CFLAGS_COMPILE = [
|
||||
"-DTDESKTOP_DISABLE_AUTOUPDATE"
|
||||
"-DTDESKTOP_DISABLE_CRASH_REPORTS"
|
||||
"-DTDESKTOP_DISABLE_AUTOUPDATE"
|
||||
"-DTDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME"
|
||||
"-I${minizip}/include/minizip"
|
||||
# See Telegram/gyp/qt.gypi
|
||||
@ -74,13 +66,12 @@ mkDerivation rec {
|
||||
"-I${getDev libopus}/include/opus"
|
||||
"-I${getDev alsaLib}/include/alsa"
|
||||
"-I${getDev libpulseaudio}/include/pulse"
|
||||
]) [ "QtCore" "QtGui" "QtDBus" ];
|
||||
]) [ "QtCore" "QtGui" "QtDBus" ];
|
||||
CPPFLAGS = NIX_CFLAGS_COMPILE;
|
||||
|
||||
preConfigure = ''
|
||||
|
||||
pushd "Telegram/ThirdParty/libtgvoip"
|
||||
patch -Np1 -i "${tgaur}/libtgvoip.patch"
|
||||
patch -Np1 -i "${archPatches}/libtgvoip.patch"
|
||||
popd
|
||||
|
||||
sed -i Telegram/gyp/telegram_linux.gypi \
|
||||
@ -102,22 +93,23 @@ mkDerivation rec {
|
||||
--depth=Telegram/gyp \
|
||||
--generator-output=../.. \
|
||||
-Goutput_dir=out \
|
||||
--format=cmake \
|
||||
--format=cmake \
|
||||
Telegram/gyp/Telegram.gyp
|
||||
|
||||
cd out/Release
|
||||
|
||||
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)
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
install -Dm755 Telegram $out/bin/telegram-desktop
|
||||
|
||||
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
|
||||
sed "s,/usr/bin,$out/bin,g" $tgaur/tg.protocol > $out/share/kde4/services/tg.protocol
|
||||
install -m444 "$src/lib/xdg/telegramdesktop.desktop" "$out/share/applications/telegram-desktop.desktop"
|
||||
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
|
||||
install -Dm644 "../../../Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
|
||||
done
|
||||
|
Loading…
Reference in New Issue
Block a user