3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #10593 from doublec/freenet

Update freenet to build 1470.
This commit is contained in:
goibhniu 2015-10-25 15:46:18 +01:00
commit 891e13a3ad
2 changed files with 44 additions and 17 deletions

View file

@ -1,56 +1,67 @@
{ stdenv, fetchurl, ant, jdk }:
{ stdenv, fetchurl, fetchgit, ant, jdk, makeWrapper }:
let
# The .gitmodules in freenet-official-20130413-eccc9b3198
# points to freenet-contrib-staging-ce3b7d5
freenet_ext = fetchurl {
url = https://downloads.freenetproject.org/latest/freenet-ext.jar;
sha1 = "507ab3f6ee91f47c187149136fb6d6e98f9a8c7f";
sha256 = "17ypljdvazgx2z6hhswny1lxfrknysz3x6igx8vl3xgdpvbb7wij";
};
bcprov = fetchurl {
url = http://www.bouncycastle.org/download/bcprov-jdk15on-148.jar;
sha256 = "12129q8rmqwlvj6z4j0gc3w0hq5ccrkf2gdlsggp3iws7cp7wjw0";
url = https://downloads.freenetproject.org/latest/bcprov-jdk15on-152.jar;
sha256 = "0wqpdcvcfh939fk8yr033ijzr1vjbp6ydlnv5ly8jiykwj0x3i0d";
};
seednodes = fetchurl {
url = https://downloads.freenetproject.org/alpha/opennet/seednodes.fref;
sha256 = "109zn9w8axdkjwhkkcm2s8dvib0mq0n8imjgs3r8hvi128cjsmg9";
};
version = "build01470";
in
stdenv.mkDerivation {
name = "freenet-20130413-eccc9b3198";
name = "freenet-${version}";
src = fetchurl {
url = https://github.com/freenet/fred-official/tarball/eccc9b3198;
name = "freenet-official-eccc9b3198.tar.gz";
sha256 = "0x0s8gmb95770l7968r99sq0588vf0n1687ivc2hixar19cw620y";
src = fetchgit {
url = https://github.com/freenet/fred;
rev = "refs/tags/${version}";
sha256 = "1b6e6fec2b9a729d4a25605fa142df9ea42e59b379ff665f580e32c6178c9746";
};
patchPhase = ''
cp ${freenet_ext} lib/freenet/freenet-ext.jar
cp ${bcprov} lib/bcprov.jar
cp ${bcprov} lib/bcprov-jdk15on-152.jar
sed '/antcall.*-ext/d' -i build.xml
sed 's/@unknown@/${version}/g' -i build-clean.xml
'';
buildInputs = [ ant jdk ];
buildInputs = [ ant jdk makeWrapper ];
buildPhase = "ant package-only";
freenetWrapper = ./freenetWrapper;
installPhase = ''
mkdir -p $out/share/freenet $out/bin
cp lib/bcprov.jar $out/share/freenet
cp lib/bcprov-jdk15on-152.jar $out/share/freenet
cp lib/freenet/freenet-ext.jar $out/share/freenet
cp dist/freenet.jar $out/share/freenet
cat <<EOF > $out/bin/freenet
cat <<EOF > $out/bin/freenet.wrapped
#!${stdenv.shell}
${jdk.jre}/bin/java -cp $out/share/freenet/bcprov.jar:$out/share/freenet/freenet-ext.jar:$out/share/freenet/freenet.jar \\
${jdk.jre}/bin/java -cp $out/share/freenet/bcprov-jdk15on-152.jar:$out/share/freenet/freenet-ext.jar:$out/share/freenet/freenet.jar \\
-Xmx1024M freenet.node.NodeStarter
EOF
chmod +x $out/bin/freenet
chmod +x $out/bin/freenet.wrapped
makeWrapper $freenetWrapper $out/bin/freenet \
--set FREENET_ROOT "$out" \
--set FREENET_SEEDNODES "${seednodes}"
'';
meta = {
description = "Decentralised and censorship-resistant network";
homepage = https://freenetproject.org/;
license = stdenv.lib.licenses.gpl2Plus;
maintainers = [ stdenv.lib.maintainers.doublec ];
platforms = with stdenv.lib.platforms; linux;
};
}

View file

@ -0,0 +1,16 @@
#! /usr/bin/env bash
export FREENET_HOME="$HOME/.local/share/freenet"
if [ -n "$XDG_DATA_HOME" ]
then export FREENET_HOME="$XDG_DATA_HOME/freenet"
fi
if [ ! -d $FREENET_HOME ]; then
mkdir -p $FREENET_HOME
fi
cp -u $FREENET_SEEDNODES $FREENET_HOME/seednodes.fref
chmod u+rw $FREENET_HOME/seednodes.fref
cd $FREENET_HOME
exec $FREENET_ROOT/bin/freenet.wrapped "$@"