i2pd-2.12.0.ebuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit eutils systemd user cmake-utils
  5. DESCRIPTION="A C++ daemon for accessing the I2P anonymous network"
  6. HOMEPAGE="https://github.com/PurpleI2P/i2pd"
  7. SRC_URI="https://github.com/PurpleI2P/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
  8. LICENSE="BSD"
  9. SLOT="0"
  10. KEYWORDS="~amd64 ~arm ~x86"
  11. IUSE="cpu_flags_x86_aes i2p-hardening libressl pch static +upnp"
  12. RDEPEND="!static? ( >=dev-libs/boost-1.49[threads]
  13. !libressl? ( dev-libs/openssl:0[-bindist] )
  14. libressl? ( dev-libs/libressl )
  15. upnp? ( net-libs/miniupnpc )
  16. )"
  17. DEPEND="${RDEPEND}
  18. static? ( >=dev-libs/boost-1.49[static-libs,threads]
  19. !libressl? ( dev-libs/openssl:0[static-libs] )
  20. libressl? ( dev-libs/libressl[static-libs] )
  21. upnp? ( net-libs/miniupnpc[static-libs] ) )
  22. i2p-hardening? ( >=sys-devel/gcc-4.7 )
  23. || ( >=sys-devel/gcc-4.7 >=sys-devel/clang-3.3 )"
  24. I2PD_USER=i2pd
  25. I2PD_GROUP=i2pd
  26. CMAKE_USE_DIR="${S}/build"
  27. DOCS=( README.md docs/i2pd.conf docs/tunnels.conf )
  28. PATCHES=( "${FILESDIR}/${PN}-2.5.1-fix_installed_components.patch" )
  29. src_configure() {
  30. mycmakeargs=(
  31. -DWITH_AESNI=$(usex cpu_flags_x86_aes ON OFF)
  32. -DWITH_HARDENING=$(usex i2p-hardening ON OFF)
  33. -DWITH_PCH=$(usex pch ON OFF)
  34. -DWITH_STATIC=$(usex static ON OFF)
  35. -DWITH_UPNP=$(usex upnp ON OFF)
  36. -DWITH_LIBRARY=ON
  37. -DWITH_BINARY=ON
  38. )
  39. cmake-utils_src_configure
  40. }
  41. src_install() {
  42. cmake-utils_src_install
  43. # config
  44. insinto /etc/i2pd
  45. doins docs/i2pd.conf
  46. doins docs/tunnels.conf
  47. # grant i2pd group read and write access to config files
  48. fowners "root:${I2PD_GROUP}" \
  49. /etc/i2pd/i2pd.conf \
  50. /etc/i2pd/tunnels.conf
  51. fperms 660 \
  52. /etc/i2pd/i2pd.conf \
  53. /etc/i2pd/tunnels.conf
  54. # working directory
  55. keepdir /var/lib/i2pd
  56. insinto /var/lib/i2pd
  57. doins -r contrib/certificates
  58. fowners "${I2PD_USER}:${I2PD_GROUP}" /var/lib/i2pd/
  59. fperms 700 /var/lib/i2pd/
  60. # add /var/lib/i2pd/certificates to CONFIG_PROTECT
  61. doenvd "${FILESDIR}/99i2pd"
  62. # openrc and systemd daemon routines
  63. newconfd "${FILESDIR}/i2pd-2.6.0-r3.confd" i2pd
  64. newinitd "${FILESDIR}/i2pd-2.6.0-r3.initd" i2pd
  65. systemd_newunit "${FILESDIR}/i2pd-2.6.0-r3.service" i2pd.service
  66. # logrotate
  67. insinto /etc/logrotate.d
  68. newins "${FILESDIR}/i2pd-2.6.0-r3.logrotate" i2pd
  69. }
  70. pkg_setup() {
  71. enewgroup "${I2PD_GROUP}"
  72. enewuser "${I2PD_USER}" -1 -1 /var/lib/run/i2pd "${I2PD_GROUP}"
  73. }
  74. pkg_postinst() {
  75. if [[ -f ${EROOT%/}/etc/i2pd/subscriptions.txt ]]; then
  76. ewarn
  77. ewarn "Configuration of the subscriptions has been moved from"
  78. ewarn "subscriptions.txt to i2pd.conf. We recommend updating"
  79. ewarn "i2pd.conf accordingly and deleting subscriptions.txt."
  80. fi
  81. }