i2p-0.9.26.ebuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="6"
  4. inherit eutils java-pkg-2 java-ant-2 systemd user
  5. DESCRIPTION="A privacy-centric, anonymous network."
  6. HOMEPAGE="https://geti2p.net"
  7. SRC_URI="https://download.i2p2.de/releases/${PV}/i2psource_${PV}.tar.bz2"
  8. LICENSE="Apache-2.0 Artistic BSD CC-BY-2.5 CC-BY-3.0 CC-BY-SA-3.0 EPL-1.0 GPL-2 GPL-3 LGPL-2.1 LGPL-3 MIT public-domain WTFPL-2"
  9. SLOT="0"
  10. # Until the deps reach other arches
  11. KEYWORDS="~amd64 ~x86"
  12. IUSE="+ecdsa nls"
  13. # dev-java/ant-core is automatically added due to java-ant-2.eclass
  14. CDEPEND="dev-java/bcprov:1.50
  15. dev-java/jrobin:0
  16. dev-java/slf4j-api:0
  17. dev-java/tomcat-jstl-impl:0
  18. dev-java/tomcat-jstl-spec:0
  19. dev-java/java-service-wrapper:0"
  20. DEPEND="${CDEPEND}
  21. dev-java/eclipse-ecj:*
  22. dev-libs/gmp:0
  23. nls? ( >=sys-devel/gettext-0.19 )
  24. >=virtual/jdk-1.7"
  25. RDEPEND="${CDEPEND}
  26. ecdsa? (
  27. || (
  28. dev-java/icedtea:7[-sunec]
  29. dev-java/icedtea:8[-sunec]
  30. dev-java/icedtea:7[nss,-sunec]
  31. dev-java/icedtea-bin:7[nss]
  32. dev-java/icedtea-bin:7
  33. dev-java/icedtea-bin:8
  34. dev-java/oracle-jre-bin
  35. dev-java/oracle-jdk-bin
  36. )
  37. )
  38. !ecdsa? ( >=virtual/jre-1.7 )"
  39. EANT_BUILD_TARGET="pkg"
  40. EANT_GENTOO_CLASSPATH="java-service-wrapper,jrobin,slf4j-api,tomcat-jstl-impl,tomcat-jstl-spec,bcprov-1.50"
  41. JAVA_ANT_ENCODING="UTF-8"
  42. I2P_ROOT='/usr/share/i2p'
  43. I2P_CONFIG_HOME='/var/lib/i2p'
  44. I2P_CONFIG_DIR="${I2P_CONFIG_HOME}/.i2p"
  45. RES_DIR='installer/resources'
  46. PATCHES=(
  47. "${FILESDIR}/${P}-add_libs.patch"
  48. )
  49. pkg_setup() {
  50. java-pkg-2_pkg_setup
  51. enewgroup i2p
  52. enewuser i2p -1 -1 "${I2P_CONFIG_HOME}" i2p
  53. }
  54. src_unpack() {
  55. unpack ${A}
  56. cd "${S}" || die
  57. java-ant_rewrite-classpath
  58. }
  59. src_prepare() {
  60. java-pkg-2_src_prepare
  61. # We're on GNU/Linux, we don't need .exe files
  62. echo "noExe=true" > override.properties || die
  63. if ! use nls; then
  64. echo "require.gettext=false" >> override.properties || die
  65. fi
  66. # avoid auto starting browser
  67. sed -i 's|clientApp.4.startOnLoad=true|clientApp.4.startOnLoad=false|' \
  68. "${RES_DIR}/clients.config" || die
  69. # we do it now so we can resolve path after
  70. default
  71. # replace paths as the installer would
  72. sed -i "s|%INSTALL_PATH|${I2P_ROOT}|" \
  73. "${RES_DIR}/"{eepget,i2prouter,runplain.sh} || die
  74. sed -i "s|\$INSTALL_PATH|${I2P_ROOT}|" "${RES_DIR}/wrapper.config" || die
  75. sed -i "s|%SYSTEM_java_io_tmpdir|${I2P_CONFIG_DIR}|" \
  76. "${RES_DIR}/"{i2prouter,runplain.sh} || die
  77. sed -i "s|%USER_HOME|${I2P_CONFIG_HOME}|" "${RES_DIR}/i2prouter" || die
  78. }
  79. src_install() {
  80. # cd into pkg-temp.
  81. cd "${S}/pkg-temp" || die
  82. # This is ugly, but to satisfy all non-system .jar dependencies, jetty
  83. # would need to be packaged. It would be too large a task
  84. # for an unseasoned developer. This seems to be the most pragmatic solution
  85. java-pkg_jarinto "${I2P_ROOT}/lib"
  86. local i
  87. for i in BOB commons-el commons-logging i2p i2psnark i2ptunnel \
  88. jasper-compiler jasper-runtime javax.servlet jbigi jetty* mstreaming org.mortbay.* router* \
  89. sam standard streaming systray; do
  90. java-pkg_dojar lib/${i}.jar
  91. done
  92. # Set up symlinks for binaries
  93. dosym /usr/bin/wrapper "${I2P_ROOT}/i2psvc"
  94. dosym "${I2P_ROOT}/i2prouter" /usr/bin/i2prouter
  95. dosym "${I2P_ROOT}/eepget" /usr/bin/eepget
  96. # Install main files and basic documentation
  97. exeinto "${I2P_ROOT}"
  98. insinto "${I2P_ROOT}"
  99. doins blocklist.txt hosts.txt *.config
  100. doexe eepget i2prouter runplain.sh
  101. dodoc history.txt INSTALL-headless.txt LICENSE.txt
  102. doman man/*
  103. # Install other directories
  104. doins -r certificates docs eepsite geoip scripts
  105. dodoc -r licenses
  106. java-pkg_dowar webapps/*.war
  107. # Install daemon files
  108. newinitd "${FILESDIR}/${P}.initd" i2p
  109. systemd_newunit "${FILESDIR}/${P}.service" i2p.service
  110. # setup user
  111. keepdir "${I2P_CONFIG_DIR}"
  112. fowners -R i2p:i2p "${I2P_CONFIG_DIR}"
  113. }
  114. pkg_postinst() {
  115. elog "Custom configuration belongs in /var/lib/i2p/.i2p/ to avoid being overwritten."
  116. elog "I2P can be configured through the web interface at http://localhost:7657/index.jsp"
  117. ewarn 'Currently, the i2p team does not enforce to use ECDSA keys. But it is more and'
  118. ewarn 'more pushed. To help the network, you are recommended to have either:'
  119. ewarn ' dev-java/icedtea[-sunec,nss]'
  120. ewarn ' dev-java/icedtea-bin[nss]'
  121. ewarn ' dev-java/icedtea[-sunec] and bouncycastle (bcprov)'
  122. ewarn ' dev-java/icedtea-bin and bouncycastle (bcprov)'
  123. ewarn ' dev-java/oracle-jre-bin'
  124. ewarn ' dev-java/oracle-jdk-bin'
  125. ewarn 'Alternatively you can just use Ed25519 keys - which is a stronger algorithm anyways.'
  126. ewarn
  127. ewarn "This is purely a run-time issue. You're free to build i2p with any JDK, as long as"
  128. ewarn 'the JVM you run it with is one of the above listed and from the same or a newer generation'
  129. ewarn 'as the one you built with.'
  130. }