soulseekqt: fix icons, change unpack method, update homepage, more generic appimage handling

This commit is contained in:
Bignaux Ronan 2019-12-09 21:28:44 +01:00
parent bf83a7cc66
commit 30430c0b40
1 changed files with 34 additions and 27 deletions

View File

@ -1,11 +1,13 @@
{ stdenv, lib, fetchurl, mkDerivation
{ stdenv, lib, fetchzip, mkDerivation
, autoPatchelfHook
, dbus
, desktop-file-utils
, fontconfig
, imagemagick
, libjson
, pythonPackages
, qtmultimedia
, radare2
, jq
, squashfsTools
, zlib
}:
@ -14,46 +16,51 @@ mkDerivation rec {
pname = "soulseekqt";
version = "2018-1-30";
src = fetchurl {
urls = [
"https://www.dropbox.com/s/0vi87eef3ooh7iy/SoulseekQt-${version}.tgz"
"https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz"
];
sha256 = "0d1cayxr1a4j19bc5a3qp9pg22ggzmd55b6f5av3lc6lvwqqg4w6";
src = fetchzip {
url = "https://www.slsknet.org/SoulseekQt/Linux/SoulseekQt-${version}-64bit-appimage.tgz";
sha256 = "16ncnvv8h33f161mgy7qc0wjvvqahsbwvby65qhgfh9pbbgb4xgg";
};
dontBuild = true;
nativeBuildInputs = [ autoPatchelfHook pythonPackages.binwalk squashfsTools desktop-file-utils ];
nativeBuildInputs = [ imagemagick radare2 jq autoPatchelfHook squashfsTools
desktop-file-utils ];
buildInputs = [ qtmultimedia stdenv.cc.cc ];
# avoid usage of appimage's runner option --appimage-extract
unpackCmd = ''
export HOME=$(pwd) # workaround for binwalk
appimage=$(tar xvf $curSrc) && binwalk --quiet \
$appimage -D 'squashfs:squashfs:unsquashfs %e'
'';
postUnpack = ''
cd $sourceRoot
patchPhase = ''
cd squashfs-root/
binary="$(readlink AppRun)"
# multiarch offset one-liner using same method as AppImage
offset=$(r2 *.AppImage -nn -Nqc "pfj.elf_header @ 0" |\
jq 'map({(.name): .value}) | add | .shoff + (.shnum * .shentsize)')
# fixup desktop file
desktop-file-edit --set-key Exec --set-value $binary default.desktop
desktop-file-edit --set-key Comment --set-value "${meta.description}" default.desktop
desktop-file-edit --set-key Categories --set-value Network default.desktop
unsquashfs -o $offset *.AppImage
sourceRoot=squashfs-root
'';
installPhase = ''
mkdir -p $out/{bin,share/applications,share/icons/}
cp default.desktop $out/share/applications/$binary.desktop
cp soulseek.png $out/share/icons/
cp $binary $out/bin/
'';
binary="$(readlink AppRun)"
mv default.desktop $binary.desktop
install -Dm755 $binary -t $out/bin
# fixup and install desktop file
desktop-file-install --dir $out/share/applications \
--set-key Exec --set-value $binary \
--set-key Comment --set-value "${meta.description}" \
--set-key Categories --set-value Network $binary.desktop
#TODO: write generic code to read icon path from $binary.desktop
for size in 16 32 48 64 72 96 128 192 256 512 1024; do
mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps
convert -resize "$size"x"$size" ./soulseek.png $out/share/icons/hicolor/"$size"x"$size"/apps/soulseek.png
done
'';
meta = with lib; {
description = "Official Qt SoulSeek client";
homepage = http://www.soulseekqt.net;
homepage = https://www.slsknet.org;
license = licenses.unfree;
maintainers = [ maintainers.genesis ];
platforms = [ "x86_64-linux" ];