1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 inherit systemd user cmake-utils eapi7-ver toolchain-funcs
7 DESCRIPTION="A C++ daemon for accessing the I2P anonymous network"
8 HOMEPAGE="https://github.com/PurpleI2P/i2pd"
9 SRC_URI="https://github.com/PurpleI2P/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
12 KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86"
13 IUSE="cpu_flags_x86_aes cpu_flags_x86_avx i2p-hardening libressl static +upnp websocket"
15 # if using libressl, require >=boost-1.65, see #597798
18 dev-libs/boost[threads]
19 !libressl? ( dev-libs/openssl:0[-bindist] )
24 upnp? ( net-libs/miniupnpc )
28 dev-libs/boost[static-libs,threads]
29 !libressl? ( dev-libs/openssl:0[static-libs] )
31 dev-libs/libressl:0[static-libs]
34 sys-libs/zlib[static-libs]
35 upnp? ( net-libs/miniupnpc[static-libs] )
37 websocket? ( dev-cpp/websocketpp )"
42 CMAKE_USE_DIR="${S}/build"
44 DOCS=( README.md contrib/i2pd.conf contrib/tunnels.conf )
46 PATCHES=( "${FILESDIR}/${PN}-2.14.0-fix_installed_components.patch" )
49 if tc-is-gcc && ! ver_test "$(gcc-version)" -ge "4.7"; then
50 die "At least gcc 4.7 is required"
52 if use i2p-hardening && ! tc-is-gcc; then
53 die "i2p-hardening requires gcc"
59 -DWITH_AESNI=$(usex cpu_flags_x86_aes ON OFF)
60 -DWITH_AVX=$(usex cpu_flags_x86_avx ON OFF)
61 -DWITH_HARDENING=$(usex i2p-hardening ON OFF)
63 -DWITH_STATIC=$(usex static ON OFF)
64 -DWITH_UPNP=$(usex upnp ON OFF)
65 -DWITH_WEBSOCKETS=$(usex websocket ON OFF)
69 cmake-utils_src_configure
73 cmake-utils_src_install
77 doins contrib/i2pd.conf
78 doins contrib/tunnels.conf
80 # grant i2pd group read and write access to config files
81 fowners "root:${I2PD_GROUP}" \
83 /etc/i2pd/tunnels.conf
86 /etc/i2pd/tunnels.conf
91 doins -r contrib/certificates
92 fowners "${I2PD_USER}:${I2PD_GROUP}" /var/lib/i2pd/
93 fperms 700 /var/lib/i2pd/
95 # add /var/lib/i2pd/certificates to CONFIG_PROTECT
96 doenvd "${FILESDIR}/99i2pd"
98 # openrc and systemd daemon routines
99 newconfd "${FILESDIR}/i2pd-2.6.0-r3.confd" i2pd
100 newinitd "${FILESDIR}/i2pd-2.6.0-r3.initd" i2pd
101 systemd_newunit "${FILESDIR}/i2pd-2.6.0-r3.service" i2pd.service
104 insinto /etc/logrotate.d
105 newins "${FILESDIR}/i2pd-2.6.0-r3.logrotate" i2pd
109 enewgroup "${I2PD_GROUP}"
110 enewuser "${I2PD_USER}" -1 -1 /var/lib/run/i2pd "${I2PD_GROUP}"
114 if [[ -f ${EROOT%/}/etc/i2pd/subscriptions.txt ]]; then
116 ewarn "Configuration of the subscriptions has been moved from"
117 ewarn "subscriptions.txt to i2pd.conf. We recommend updating"
118 ewarn "i2pd.conf accordingly and deleting subscriptions.txt."