2018-07-21 02:44:44 +02:00
|
|
|
{ stdenv, fetchFromGitHub, gradle, perl, jre, makeWrapper, makeDesktopItem, mplayer }:
|
2014-11-02 15:10:03 +01:00
|
|
|
|
2018-02-27 05:54:19 +01:00
|
|
|
let
|
2018-05-31 23:33:15 +02:00
|
|
|
version = "6.6.7-build-529";
|
2018-02-27 05:54:19 +01:00
|
|
|
name = "frostwire-desktop-${version}";
|
2014-11-02 15:10:03 +01:00
|
|
|
|
2018-02-27 05:54:19 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "frostwire";
|
|
|
|
repo = "frostwire";
|
|
|
|
rev = name;
|
2018-05-31 23:33:15 +02:00
|
|
|
sha256 = "03wdj2kr8akzx8m1scvg98132zbaxh81qjdsxn2645b3gahjwz0m";
|
2018-02-27 05:54:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "frostwire";
|
|
|
|
desktopName = "FrostWire";
|
|
|
|
genericName = "P2P Bittorrent client";
|
|
|
|
exec = "frostwire";
|
|
|
|
icon = "frostwire";
|
|
|
|
comment = "Search and explore all kinds of files on the Bittorrent network";
|
|
|
|
categories = "Network;FileTransfer;P2P;";
|
|
|
|
};
|
2014-11-02 15:10:03 +01:00
|
|
|
|
2018-02-27 05:54:19 +01:00
|
|
|
# fake build to pre-download deps into fixed-output derivation
|
|
|
|
deps = stdenv.mkDerivation {
|
|
|
|
name = "${name}-deps";
|
|
|
|
inherit src;
|
|
|
|
buildInputs = [ gradle perl ];
|
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
|
|
|
( cd desktop
|
|
|
|
gradle --no-daemon build
|
|
|
|
)
|
|
|
|
'';
|
|
|
|
# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
|
|
|
|
installPhase = ''
|
|
|
|
find $GRADLE_USER_HOME -type f -regex '.*\.\(jar\|pom\)' \
|
2018-02-27 15:43:44 +01:00
|
|
|
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
|
2018-02-27 05:54:19 +01:00
|
|
|
| sh
|
|
|
|
'';
|
|
|
|
outputHashAlgo = "sha256";
|
|
|
|
outputHashMode = "recursive";
|
2018-05-31 23:33:15 +02:00
|
|
|
outputHash = "11zd98g0d0fdgls4lsskkagwfxyh26spfd6c6g9cahl89czvlg3c";
|
2014-11-02 15:10:03 +01:00
|
|
|
};
|
|
|
|
|
2018-02-27 05:54:19 +01:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
inherit name src;
|
|
|
|
|
2017-08-27 09:54:19 +02:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
2018-02-27 05:54:19 +01:00
|
|
|
buildInputs = [ gradle ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export GRADLE_USER_HOME=$(mktemp -d)
|
|
|
|
( cd desktop
|
2018-06-01 00:10:44 +02:00
|
|
|
|
|
|
|
# disable auto-update (anyway it won't update frostwire installed in nix store)
|
|
|
|
substituteInPlace src/com/frostwire/gui/updates/UpdateManager.java \
|
|
|
|
--replace 'um.checkForUpdates' '// um.checkForUpdates'
|
|
|
|
|
|
|
|
# fix path to mplayer
|
2018-02-27 05:54:19 +01:00
|
|
|
substituteInPlace src/com/frostwire/gui/player/MediaPlayerLinux.java \
|
|
|
|
--replace /usr/bin/mplayer ${mplayer}/bin/mplayer
|
2018-06-01 00:10:44 +02:00
|
|
|
|
2018-02-27 05:54:19 +01:00
|
|
|
substituteInPlace build.gradle \
|
|
|
|
--replace 'mavenCentral()' 'mavenLocal(); maven { url uri("${deps}") }'
|
|
|
|
gradle --offline --no-daemon build
|
|
|
|
)
|
|
|
|
'';
|
2014-11-02 15:10:03 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2018-02-27 05:54:19 +01:00
|
|
|
mkdir -p $out/lib $out/share/java
|
|
|
|
|
|
|
|
cp desktop/build/libs/frostwire.jar $out/share/java/frostwire.jar
|
|
|
|
|
|
|
|
cp ${ { x86_64-darwin = "desktop/lib/native/*.dylib";
|
2018-06-01 00:10:44 +02:00
|
|
|
x86_64-linux = "desktop/lib/native/lib{jlibtorrent,SystemUtilities}.so";
|
|
|
|
i686-linux = "desktop/lib/native/lib{jlibtorrent,SystemUtilities}X86.so";
|
2018-08-20 21:11:29 +02:00
|
|
|
}.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}")
|
2018-02-27 05:54:19 +01:00
|
|
|
} $out/lib
|
|
|
|
|
|
|
|
cp -dpR ${desktopItem}/share $out
|
2017-08-27 09:54:19 +02:00
|
|
|
|
2018-02-27 05:54:19 +01:00
|
|
|
makeWrapper ${jre}/bin/java $out/bin/frostwire \
|
|
|
|
--add-flags "-Djava.library.path=$out/lib -jar $out/share/java/frostwire.jar"
|
2014-11-02 15:10:03 +01:00
|
|
|
'';
|
|
|
|
|
2017-03-04 02:59:56 +01:00
|
|
|
meta = with stdenv.lib; {
|
2019-07-10 21:52:51 +02:00
|
|
|
homepage = https://www.frostwire.com/;
|
2014-11-02 15:10:03 +01:00
|
|
|
description = "BitTorrent Client and Cloud File Downloader";
|
2017-03-04 02:59:56 +01:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ gavin ];
|
2018-02-27 05:58:31 +01:00
|
|
|
platforms = [ "x86_64-darwin" "x86_64-linux" "i686-linux" ];
|
2014-11-02 15:10:03 +01:00
|
|
|
};
|
|
|
|
}
|