summaryrefslogtreecommitdiff
path: root/net-p2p/freenet
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-02-02 01:39:05 +0000
committerV3n3RiX <venerix@koprulu.sector>2022-02-02 01:39:05 +0000
commitfcc5224904648a8e6eb528d7603154160a20022f (patch)
tree3bfce096b38a9cea8eed13fc70c1526c456e9abd /net-p2p/freenet
parent2fd57282f0262ca084e05b0f2c63fbada395d02b (diff)
gentoo resync : 02.02.2022
Diffstat (limited to 'net-p2p/freenet')
-rw-r--r--net-p2p/freenet/Manifest4
-rw-r--r--net-p2p/freenet/files/0.7.5_p1491-update-for-jna-5.x.patch31
-rw-r--r--net-p2p/freenet/files/freenet-0.7.5_p1491-wrapper.conf30
-rw-r--r--net-p2p/freenet/freenet-0.7.5_p1488-r2.ebuild169
-rw-r--r--net-p2p/freenet/freenet-0.7.5_p1491-r1.ebuild165
5 files changed, 399 insertions, 0 deletions
diff --git a/net-p2p/freenet/Manifest b/net-p2p/freenet/Manifest
index dc10eb1fe4ec..b7f791f3cfa4 100644
--- a/net-p2p/freenet/Manifest
+++ b/net-p2p/freenet/Manifest
@@ -1,9 +1,11 @@
AUX 0.7.5_p1475-remove-git.patch 926 BLAKE2B 258b60eb73ee7ae78b6722a56a5e059131a51c1a0b402209b0f769e12fc960aed414033c058dca959ed546cf039e692aadcc0aa7fdda7ded9fb767f95e1de485 SHA512 d24cc1ecd7a991927d8e65378b9dabe1e7e75d8902a40cc6ae7bf19104133e9708da8768ee38230f93fc41609324ae3a9f7f7998ba261c4f4f3254d38ffaa792
AUX 0.7.5_p1483-ext.patch 991 BLAKE2B 82397c986c5496c25593df490f116a9c5fa6169c3e6f402c0671a41458052164e56a6bb41f07ea4e131693b643a51047b4c87317bc527fc95aba1f4d04868809 SHA512 8dc5abc99f9f10a29e56956508c6c013ec543133802d628d324ade3aab58f5a31b85d289b65a80a170b9e26a17cf650de4f2ba244bf9d2d443852374fe026af4
+AUX 0.7.5_p1491-update-for-jna-5.x.patch 1437 BLAKE2B bcb3df80313ed83a6b3827a2523efe3a8c87ddbf3d24737bdc6d3e0e714ec2e1bbc0e016d9fc142ebd702f3b963be45d0f094df96fe17ef2c093bd273bcc396f SHA512 f720166e09512fb5bd0a241bc7a1fb532ba67ad2ba8705fa2dd4ccc4eb64f12200af285d85af1a990f407bcdfb898a8f7a8dfd0cf0b4c8d3a7019bce0bb3988f
AUX build-clean.xml 18184 BLAKE2B 5cc7287b1475b830b1fe9708f6cb53316fd611e6a5757ea7ca403ccc7e7a6b3797454345c28a6fd21c7c35d0bf491ac207dc2b3098c48a9ef24bfb342fa72f67 SHA512 74a4a77d900d225264606c7413a14aa9fd526c9324165493e955a6efb5f32ffad1aa735dd13570f4f6fe764baab8f0170945d75bafeb28c82b5fba9826bc0f40
AUX build.properties 2655 BLAKE2B 137de56b6118d7306c036d7ed00fee314446bd9b221d39c04ddf0e45235d03df9b8596127153eb713d2f6f790a99f94f33f095f8b880d5251f2fbfd0c69d61cb SHA512 dd7bf150ced2aa08a7250818f59b931908ea341917bce812d641cf2c77eea60bcf6d264d5caa99bb3669e6e93b8798af3e43629b33983bdeda70f94b17f6cd81
AUX freenet 474 BLAKE2B f50fbfaaaf6a919ac15b078a627eb1b2fbc9e6b6c83e4229ae4032e64436926c40410f1182bdbc6bcd005677d9ef9c5be252fbd008ad6fffb6df5bfce38a2148 SHA512 8bfaf754106cd5476f96554932d3a394efbfbbdd51d6a62b32259e3c65ef562cf92f0f7fb2a2cb768037312780a990cdd05f758e23c4cc57e7543aaaed85f285
AUX freenet-0.7.5_p1474-wrapper.conf 949 BLAKE2B 6832683015aff6db0ad2b4116a6b8aea2ca23c1ac38da72ae71ac3a339a2efe69a7bab37911035d82a15d6ff725fb8d481deae42bd1bbaf0ad62119194674354 SHA512 a6d30afc502176a6e0bab480368553c1df50add8fe18b65cede38be752c989125999cbb8bedfd68641623fd4498e19610c16d02fcf9d951da450a9612301cdeb
+AUX freenet-0.7.5_p1491-wrapper.conf 1126 BLAKE2B 9be1699e36487de28868a1f4a191de4d50fe92d8ea550c73f07dee99466ed5d6455a8c1d31690fa660b18a291702a43349629ace158d9ac97ba6f47bd95069f5 SHA512 26bfd9cc3e2f172b08c9bd5970ad2420d3c9f44023cfa9a3978fa59a92956019b4eff5b64b0fe913587baba242915779a87613bd6daa3318c314e78a56b7ec1e
AUX freenet.service 271 BLAKE2B 7d47ad525f4bb13e07c50a0bdf19f1ef234d5219e82f426254c316abc4517180c22267a245ca022edf68e615a2865fe0dd08f694ee5ee2ced8c5391b3c5e33ad SHA512 2f3d4ec0ba05eff328e8176cbe130176a82a1bb432599de44ab78ca27e9c96e0eafe0871f12b0165247f941a2e929635a6abe6cd61351b1305c0d0e8cff83d2b
AUX run.sh-20090501 16217 BLAKE2B 249254104ca2d0a20131a5d6b36a07b14fe6407d1915d75ecf98a617de6e532def710975ff1b2e0b580f7148099cd7f6915d8adc0b15e1f67af4fc4713e0e5af SHA512 ba97f1e370ffb7c9ea109b7d529430581a588d8d7e121ec09865e9e8932f2901477f7f43e7d0b95c7c95c2c42db05870e5d811528f91f78b48b68a539c804e67
DIST freenet-0.7.5_p1488.zip 7815529 BLAKE2B a63de0b365abe7fd3a7bdde735127c56d0bf220036932db93392893c21e8714cffa27b76357b9e429e5a915975030470035549c8010e3828bb503eaab5911c62 SHA512 5232d4d18bcf8775832aabee7392d0434cecb07114190ed9cd9bbab08fd693a1ac07f3ffad0835e4c5e3696961a234906cbee79c425e50cd29021b8bb77ef733
@@ -11,5 +13,7 @@ DIST freenet-0.7.5_p1491.zip 7827005 BLAKE2B 422f3050dbfdc829d1614b2f65262a06371
DIST freenet-ant-1.7.1.jar 1327167 BLAKE2B 408ec04ef6be58490bc6be200bd2ae1946aa4e22a9e01c9ef00351316f7ec0e23b055ed0907c16eaf5a60d153d3b96e4c447884df752e13d16520b3360581895 SHA512 2c84378d995fed0630169fffab020bde89c3edb7b3bc1e14e2251ed71be684dc2520fdeed8bae382de362984e25a31dcd59326ef8735f8066166c1e8d98ca408
DIST seednodes-0.7.5_p1480.zip 24935 BLAKE2B 2a297cb7e429a3db06882b703241d420fd7225192afd500f2ff5a3521b1a53c4d62fc2d5b4c0a6ed4d62fa3cd4da64a42da04459dea81701d98faf36b4642eb8 SHA512 cde40562156627818e3384cb8ca29ac02cc52eb9e02c3b0627d7786b4b7deace79b3a840f61c551a25f4d771190558fb277b3f63a71994c30c7b28a2c2f85497
EBUILD freenet-0.7.5_p1488-r1.ebuild 4847 BLAKE2B 8b2499a6b19b5dcf064f48558c454fe8239a2c26d9ffd579a4d250bdc6a2c1a3231efa969635aabea62cacc220cfc1224d19863a1c89f71b4605118f49408cec SHA512 8de3b3306225ef90a69066274ee05249dd0b17a7eed49a0de7fdb45746254dda2b10895dc8c1119e8dfff86a36807258bff6f1a660623f50513cabc4b5fb3dc0
+EBUILD freenet-0.7.5_p1488-r2.ebuild 4899 BLAKE2B 7b7e6a8481888ff47976238efd7efabf0d45b50f10f8b11c3cc9384086ab137220c01c0d08755c9067f694861b3c0366e3856c0a3eb89bc059184e8ccf05ce30 SHA512 e7cb967dd4915690aea3a8ab55e12155232f2d2097b3d6e02de7a68eb273b61c3d0e747c882dc3b32001d5d9d664429fbfba85505b167c2308a5eb23e3b3fb11
+EBUILD freenet-0.7.5_p1491-r1.ebuild 4882 BLAKE2B 39e2aa63a53ad6b3d84df1c274e66b5555ceffa4a5aeab2aee3d71cecd22fa634535c713a0b11dc5ba67fba83dc33bda3ad762287e635063d0c06dc516a5f9d0 SHA512 7aaf663ea393d5e8aff85ec612e0823372ca56b309012c7513349aef4e72ce08c3b0aff78dd7705f700dea8a1fb06493bac636bdc6dab06974d812b3d64cb72b
EBUILD freenet-0.7.5_p1491.ebuild 4819 BLAKE2B 33df7b2784ed3a63b1dca0955858f358589d609a185fbb6d21200c6039cf0cb35c230ee05e95d22320bbc8d97ff2525599c7fcb2a6eaddb36e9239c810af6dc2 SHA512 453557ddd46fd6e92b858db79cf8ab46d285d435653f9f123d5ffeb7d554865a569e54adf74bc2fdb6846e2c487ac64507f7736a58e9d8c55983a7893d1f2a2b
MISC metadata.xml 431 BLAKE2B 15ac565ad002dd559780d967574a62641f27fb60d952e73e83a1245dd38b9a27802f871e9588b8d2acaf6631b0a0e82cd4158dbfc44e16f7f187e88e5c57d39d SHA512 1972976d177084ca51c4580d4467a35634d5e9335f7a20a54822f18b560e682c577aabd316cb63eee2ece5ea68cbdd6650b086a2a6b13cc46437924d80f07b53
diff --git a/net-p2p/freenet/files/0.7.5_p1491-update-for-jna-5.x.patch b/net-p2p/freenet/files/0.7.5_p1491-update-for-jna-5.x.patch
new file mode 100644
index 000000000000..788a48040b17
--- /dev/null
+++ b/net-p2p/freenet/files/0.7.5_p1491-update-for-jna-5.x.patch
@@ -0,0 +1,31 @@
+From 830b4bb3948bd69fbd9b10001940f1775051114a Mon Sep 17 00:00:00 2001
+From: Yuan Liao <liaoyuan@gmail.com>
+Date: Sun, 23 Jan 2022 10:09:17 -0800
+Subject: [PATCH] Replace Pointer.SIZE with Native.POINTER_SIZE for JNA 5.x
+
+This patch is backward compatible with JNA 4.x because
+Native.POINTER_SIZE is present in both 4.x and 5.x.
+
+Bug: https://github.com/kaitoy/pcap4j/issues/191
+Bug: https://bugs.gentoo.org/830847
+Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
+---
+ src/freenet/io/comm/UdpSocketHandler.java | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/freenet/io/comm/UdpSocketHandler.java b/src/freenet/io/comm/UdpSocketHandler.java
+index 0cd975f16..c004613a9 100644
+--- a/src/freenet/io/comm/UdpSocketHandler.java
++++ b/src/freenet/io/comm/UdpSocketHandler.java
+@@ -120,7 +120,7 @@ public class UdpSocketHandler implements PrioRunnable, PacketSocketHandler, Port
+ return false;
+ int ret = -1;
+ try {
+- ret = socketOptionsHolder.setsockopt(fd, SOCKET_level.IPPROTO_IPV6.linux, p.option_name.linux, new IntByReference(p.linux).getPointer(), Pointer.SIZE);
++ ret = socketOptionsHolder.setsockopt(fd, SOCKET_level.IPPROTO_IPV6.linux, p.option_name.linux, new IntByReference(p.linux).getPointer(), Native.POINTER_SIZE);
+ } catch(Exception e) { Logger.normal(UdpSocketHandler.class, e.getMessage(),e); } //if it fails that's fine
+ return (ret == 0 ? true : false);
+ }
+--
+2.34.1
+
diff --git a/net-p2p/freenet/files/freenet-0.7.5_p1491-wrapper.conf b/net-p2p/freenet/files/freenet-0.7.5_p1491-wrapper.conf
new file mode 100644
index 000000000000..61bbf6f40bfb
--- /dev/null
+++ b/net-p2p/freenet/files/freenet-0.7.5_p1491-wrapper.conf
@@ -0,0 +1,30 @@
+wrapper.java.command=java
+wrapper.working.dir=/var/freenet/
+wrapper.java.mainclass=freenet.node.NodeStarter
+wrapper.java.library.path.1=/usr/lib
+wrapper.java.initmemory=60
+wrapper.java.maxmemory=1024
+wrapper.java.additional.1=-Dnetworkaddress.cache.ttl=0
+wrapper.java.additional.2=-Dnetworkaddress.cache.negative.ttl=0
+wrapper.java.additional.3=-enableassertions:freenet
+# You might want to set the following line if you have changed java.maxmemory
+wrapper.java.additional.4=-XX:MaxPermSize=1024M
+# Required since JNA 5.0.0, which changed the default JNI library search path
+# https://github.com/java-native-access/jna/issues/384
+wrapper.java.additional.5=-Djna.nosys=false
+
+wrapper.app.parameter.1=freenet.ini
+wrapper.console.format=PM
+wrapper.console.loglevel=INFO
+wrapper.logfile=wrapper.log
+wrapper.logfile.format=LPTM
+wrapper.logfile.loglevel=INFO
+wrapper.logfile.maxsize=2M
+wrapper.logfile.maxfiles=3
+wrapper.syslog.loglevel=NONE
+wrapper.console.title=Freenet 0.7
+wrapper.jvm_exit.timeout=120
+wrapper.restart.reload_configuration=TRUE
+wrapper.filter.trigger.1=java.lang.OutOfMemoryError
+wrapper.filter.action.1=RESTART
+
diff --git a/net-p2p/freenet/freenet-0.7.5_p1488-r2.ebuild b/net-p2p/freenet/freenet-0.7.5_p1488-r2.ebuild
new file mode 100644
index 000000000000..8b2cb5f7eea2
--- /dev/null
+++ b/net-p2p/freenet/freenet-0.7.5_p1488-r2.ebuild
@@ -0,0 +1,169 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+JAVA_PKG_IUSE="doc source"
+
+inherit epatch java-pkg-2 java-ant-2 systemd
+
+DESCRIPTION="An encrypted network without censorship"
+HOMEPAGE="https://freenetproject.org/"
+# https://github.com/${PN}/seedrefs/archive/build0${PV#*p}.zip -> seednodes-${PV}.zip
+SRC_URI="
+ https://github.com/${PN}/fred/archive/build0${PV#*p}.zip -> ${P}.zip
+ https://github.com/${PN}/seedrefs/archive/build01480.zip -> seednodes-0.7.5_p1480.zip
+ mirror://gentoo/freenet-ant-1.7.1.jar"
+
+LICENSE="GPL-2+ GPL-2 MIT BSD-2 Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+nss test"
+
+CDEPEND="dev-java/bcprov:0
+ dev-java/commons-compress:0
+ dev-java/fec:0
+ dev-java/java-service-wrapper:0
+ dev-java/jbitcollider-core:0
+ dev-java/jna:4
+ dev-java/lzma:0
+ dev-java/lzmajio:0
+ dev-java/mersennetwister:0
+ nss? ( dev-libs/nss )"
+
+DEPEND="
+ app-arch/unzip
+ >=virtual/jdk-1.8
+ ${CDEPEND}
+ test? (
+ dev-java/junit:0
+ dev-java/ant-junit:0
+ )
+ dev-java/ant-core:0"
+
+RDEPEND="
+ >=virtual/jre-1.8
+ net-libs/nativebiginteger:0
+ ${CDEPEND}
+ acct-user/freenet
+ acct-group/freenet"
+
+PDEPEND="net-libs/NativeThread:0"
+
+JAVA_PKG_BSFIX_NAME+=" build-clean.xml"
+JAVA_ANT_REWRITE_CLASSPATH="yes"
+JAVA_ANT_CLASSPATH_TAGS+=" javadoc"
+JAVA_ANT_ENCODING="utf8"
+
+EANT_BUILD_TARGET="package"
+EANT_TEST_TARGET="unit"
+EANT_BUILD_XML="build-clean.xml"
+EANT_GENTOO_CLASSPATH="bcprov,commons-compress,fec,java-service-wrapper,jbitcollider-core,jna-4,lzma,lzmajio,mersennetwister"
+EANT_EXTRA_ARGS="-Dsuppress.gjs=true -Dlib.contrib.present=true -Dlib.bouncycastle.present=true -Dlib.junit.present=true -Dtest.skip=true"
+
+S="${WORKDIR}/fred-build0${PV#*p}"
+
+RESTRICT="test" # they're broken in the last release.
+
+MY_PATCHES=(
+ "${FILESDIR}"/0.7.5_p1491-update-for-jna-5.x.patch
+ "${FILESDIR}"/0.7.5_p1483-ext.patch
+ "${FILESDIR}/"0.7.5_p1475-remove-git.patch
+)
+
+pkg_setup() {
+ has_version dev-java/icedtea[cacao] && {
+ ewarn "dev-java/icedtea was built with cacao USE flag."
+ ewarn "freenet may compile with it, but it will refuse to run."
+ ewarn "Please remerge dev-java/icedtea without cacao USE flag,"
+ ewarn "if you plan to use it for running freenet."
+ }
+ java-pkg-2_pkg_setup
+}
+
+src_unpack() {
+# unpack ${P}.zip seednodes-${PV}.zip
+ unpack ${P}.zip seednodes-0.7.5_p1480.zip
+}
+
+src_prepare() {
+# cat "${WORKDIR}"/seedrefs-build0${PV#*p}/* > "${S}"/seednodes.fref
+ cat "${WORKDIR}"/seedrefs-build01480/* > "${S}"/seednodes.fref
+ cp "${FILESDIR}"/freenet-0.7.5_p1491-wrapper.conf freenet-wrapper.conf || die
+ cp "${FILESDIR}"/run.sh-20090501 run.sh || die
+ cp "${FILESDIR}"/build-clean.xml build-clean.xml || die
+ cp "${FILESDIR}"/build.properties build.properties || die
+
+ epatch "${MY_PATCHES[@]}"
+
+ sed -i -e "s:=/usr/lib:=/usr/$(get_libdir):g" \
+ freenet-wrapper.conf || die "sed failed"
+
+ echo "wrapper.java.classpath.1=/usr/share/freenet/lib/freenet.jar" >> freenet-wrapper.conf || die
+ if use nss; then
+ echo "wrapper.java.additional.6=-Dfreenet.jce.use.NSS=true" >> freenet-wrapper.conf || die
+ fi
+ local i=2 pkg jars jar
+ local ifs_original=${IFS}
+ IFS=","
+ for pkg in ${EANT_GENTOO_CLASSPATH} ; do
+ jars="$(java-pkg_getjars ${pkg})"
+ for jar in ${jars} ; do
+ echo "wrapper.java.classpath.$((i++))=${jar}" >> freenet-wrapper.conf || die
+ done
+ done
+ IFS=${ifs_original}
+ echo "wrapper.java.classpath.$((i++))=/usr/share/freenet/lib/ant.jar" >> freenet-wrapper.conf || die
+ echo "wrapper.java.library.path.2=/usr/$(get_libdir)/java-service-wrapper" >> freenet-wrapper.conf || die
+ echo "wrapper.java.library.path.3=/usr/$(get_libdir)/jna-4" >> freenet-wrapper.conf || die
+
+ cp "${DISTDIR}"/freenet-ant-1.7.1.jar lib/ant.jar || die
+ eapply_user
+}
+
+EANT_TEST_EXTRA_ARGS="-Dtest.skip=false"
+
+src_test() {
+ java-pkg-2_src_test
+}
+
+src_install() {
+ java-pkg_dojar dist/freenet.jar
+ java-pkg_newjar "${DISTDIR}"/freenet-ant-1.7.1.jar ant.jar
+
+ if has_version =sys-apps/baselayout-2*; then
+ doinitd "${FILESDIR}"/freenet
+ else
+ newinitd "${FILESDIR}"/freenet.old freenet
+ fi
+
+ systemd_dounit "${FILESDIR}"/freenet.service
+
+ dodoc AUTHORS
+ newdoc README.md README
+ insinto /etc
+ doins freenet-wrapper.conf
+ insinto /var/freenet
+ doins run.sh seednodes.fref
+ fperms +x /var/freenet/run.sh
+ use doc && java-pkg_dojavadoc javadoc
+ use source && java-pkg_dosrc src
+}
+
+pkg_postinst() {
+ elog " "
+ elog "1. Start freenet with /etc/init.d/freenet start."
+ elog "2. Open localhost:8888 in your browser for the web interface."
+ #workaround for previously existing freenet user
+ [[ $(stat --format="%U" /var/freenet) == "freenet" ]] || chown \
+ freenet:freenet /var/freenet
+}
+
+pkg_postrm() {
+ if ! [[ -e /usr/share/freenet/lib/freenet.jar ]] ; then
+ elog " "
+ elog "If you dont want to use freenet any more"
+ elog "and dont want to keep your identity/other stuff"
+ elog "remember to do 'rm -rf /var/freenet' to remove everything"
+ fi
+}
diff --git a/net-p2p/freenet/freenet-0.7.5_p1491-r1.ebuild b/net-p2p/freenet/freenet-0.7.5_p1491-r1.ebuild
new file mode 100644
index 000000000000..a7d25aeca420
--- /dev/null
+++ b/net-p2p/freenet/freenet-0.7.5_p1491-r1.ebuild
@@ -0,0 +1,165 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+JAVA_PKG_IUSE="doc source"
+
+inherit java-pkg-2 java-ant-2 systemd
+
+DESCRIPTION="An encrypted network without censorship"
+HOMEPAGE="https://freenetproject.org/"
+# https://github.com/${PN}/seedrefs/archive/build0${PV#*p}.zip -> seednodes-${PV}.zip
+SRC_URI="
+ https://github.com/${PN}/fred/archive/build0${PV#*p}.zip -> ${P}.zip
+ https://github.com/${PN}/seedrefs/archive/build01480.zip -> seednodes-0.7.5_p1480.zip
+ mirror://gentoo/freenet-ant-1.7.1.jar"
+
+LICENSE="GPL-2+ GPL-2 MIT BSD-2 Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+nss test"
+
+CDEPEND="dev-java/bcprov:0
+ dev-java/commons-compress:0
+ dev-java/fec:0
+ dev-java/java-service-wrapper:0
+ dev-java/jbitcollider-core:0
+ dev-java/jna:4
+ dev-java/lzma:0
+ dev-java/lzmajio:0
+ dev-java/mersennetwister:0
+ nss? ( dev-libs/nss )"
+
+DEPEND="
+ app-arch/unzip
+ >=virtual/jdk-1.8
+ ${CDEPEND}
+ test? (
+ dev-java/junit:0
+ dev-java/ant-junit:0
+ )
+ dev-java/ant-core:0"
+
+RDEPEND="
+ >=virtual/jre-1.8
+ net-libs/nativebiginteger:0
+ ${CDEPEND}
+ acct-user/freenet
+ acct-group/freenet"
+
+PDEPEND="net-libs/NativeThread:0"
+
+JAVA_PKG_BSFIX_NAME+=" build-clean.xml"
+JAVA_ANT_REWRITE_CLASSPATH="yes"
+JAVA_ANT_CLASSPATH_TAGS+=" javadoc"
+JAVA_ANT_ENCODING="utf8"
+
+EANT_BUILD_TARGET="package"
+EANT_TEST_TARGET="unit"
+EANT_BUILD_XML="build-clean.xml"
+EANT_GENTOO_CLASSPATH="bcprov,commons-compress,fec,java-service-wrapper,jbitcollider-core,jna-4,lzma,lzmajio,mersennetwister"
+EANT_EXTRA_ARGS="-Dsuppress.gjs=true -Dlib.contrib.present=true -Dlib.bouncycastle.present=true -Dlib.junit.present=true -Dtest.skip=true"
+
+S="${WORKDIR}/fred-build0${PV#*p}"
+
+RESTRICT="test" # they're broken in the last release.
+
+pkg_setup() {
+ has_version dev-java/icedtea[cacao] && {
+ ewarn "dev-java/icedtea was built with cacao USE flag."
+ ewarn "freenet may compile with it, but it will refuse to run."
+ ewarn "Please remerge dev-java/icedtea without cacao USE flag,"
+ ewarn "if you plan to use it for running freenet."
+ }
+ java-pkg-2_pkg_setup
+}
+
+src_unpack() {
+# unpack ${P}.zip seednodes-${PV}.zip
+ unpack ${P}.zip seednodes-0.7.5_p1480.zip
+}
+
+src_prepare() {
+# cat "${WORKDIR}"/seedrefs-build0${PV#*p}/* > "${S}"/seednodes.fref
+ cat "${WORKDIR}"/seedrefs-build01480/* > "${S}"/seednodes.fref
+ cp "${FILESDIR}"/freenet-0.7.5_p1491-wrapper.conf freenet-wrapper.conf || die
+ cp "${FILESDIR}"/run.sh-20090501 run.sh || die
+ cp "${FILESDIR}"/build-clean.xml build-clean.xml || die
+ cp "${FILESDIR}"/build.properties build.properties || die
+
+ eapply -p1 "${FILESDIR}/"0.7.5_p1491-update-for-jna-5.x.patch
+ eapply -p0 "${FILESDIR}"/0.7.5_p1483-ext.patch
+ eapply -p1 "${FILESDIR}/"0.7.5_p1475-remove-git.patch
+
+ sed -i -e "s:=/usr/lib:=/usr/$(get_libdir):g" \
+ freenet-wrapper.conf || die "sed failed"
+
+ echo "wrapper.java.classpath.1=/usr/share/freenet/lib/freenet.jar" >> freenet-wrapper.conf || die
+ if use nss; then
+ echo "wrapper.java.additional.6=-Dfreenet.jce.use.NSS=true" >> freenet-wrapper.conf || die
+ fi
+ local i=2 pkg jars jar
+ local ifs_original=${IFS}
+ IFS=","
+ for pkg in ${EANT_GENTOO_CLASSPATH} ; do
+ jars="$(java-pkg_getjars ${pkg})"
+ for jar in ${jars} ; do
+ echo "wrapper.java.classpath.$((i++))=${jar}" >> freenet-wrapper.conf || die
+ done
+ done
+ IFS=${ifs_original}
+ echo "wrapper.java.classpath.$((i++))=/usr/share/freenet/lib/ant.jar" >> freenet-wrapper.conf || die
+ echo "wrapper.java.library.path.2=/usr/$(get_libdir)/java-service-wrapper" >> freenet-wrapper.conf || die
+ echo "wrapper.java.library.path.3=/usr/$(get_libdir)/jna-4" >> freenet-wrapper.conf || die
+
+ cp "${DISTDIR}"/freenet-ant-1.7.1.jar lib/ant.jar || die
+ eapply_user
+}
+
+EANT_TEST_EXTRA_ARGS="-Dtest.skip=false"
+
+src_test() {
+ java-pkg-2_src_test
+}
+
+src_install() {
+ java-pkg_dojar dist/freenet.jar
+ java-pkg_newjar "${DISTDIR}"/freenet-ant-1.7.1.jar ant.jar
+
+ if has_version =sys-apps/baselayout-2*; then
+ doinitd "${FILESDIR}"/freenet
+ else
+ newinitd "${FILESDIR}"/freenet.old freenet
+ fi
+
+ systemd_dounit "${FILESDIR}"/freenet.service
+
+ dodoc AUTHORS
+ newdoc README.md README
+ insinto /etc
+ doins freenet-wrapper.conf
+ insinto /var/freenet
+ doins run.sh seednodes.fref
+ fperms +x /var/freenet/run.sh
+ use doc && java-pkg_dojavadoc javadoc
+ use source && java-pkg_dosrc src
+}
+
+pkg_postinst() {
+ elog " "
+ elog "1. Start freenet with /etc/init.d/freenet start."
+ elog "2. Open localhost:8888 in your browser for the web interface."
+ #workaround for previously existing freenet user
+ [[ $(stat --format="%U" /var/freenet) == "freenet" ]] || chown \
+ freenet:freenet /var/freenet
+}
+
+pkg_postrm() {
+ if ! [[ -e /usr/share/freenet/lib/freenet.jar ]] ; then
+ elog " "
+ elog "If you dont want to use freenet any more"
+ elog "and dont want to keep your identity/other stuff"
+ elog "remember to do 'rm -rf /var/freenet' to remove everything"
+ fi
+}