Files
macports-ports/security/i2pd/Portfile
T
aeiouaeiouaeiouaeiouaeiouaeiou b769dbba08 i2pd: fix build on macOS <12
2026-04-27 19:02:42 -04:00

169 lines
6.0 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup boost 1.0
PortGroup cmake 1.1
PortGroup github 1.0
PortGroup legacysupport 1.1
PortGroup openssl 1.0
# on <10.15 built-in libc++ has no support for std::filesystem
# uses number 19 due to a bug in macOS Catalina SDK
legacysupport.use_mp_libcxx \
yes
legacysupport.newest_darwin_requires_legacy \
19
github.setup PurpleI2P i2pd 2.60.0
revision 0
categories security net
maintainers nomaintainer
license BSD
description End-to-End encrypted and anonymous Internet
long_description {*}${description}
homepage https://i2pd.website \
https://i2pd.readthedocs.io
github.tarball_from archive
checksums rmd160 543497e3005f023a78f430f50aad5395733d948c \
sha256 ef32100c5ffdf4d23dfe78a2f6c08f65574fd79f992eb2ac8cfea0b6440deabd \
size 763177
boost.version 1.81
depends_lib-append port:zlib
patchfiles-append 0001-i2pd.conf-adjust-for-MacPorts.patch
# util.cpp:319:30: error: no viable conversion from
# 'std::string_view' (aka 'basic_string_view<char>')
# to 'const key_type' (aka 'const std::basic_string<char>')
# Clang <18 on macOS <12 supports C++20, but gets stuck at this section of code
if {${os.platform} eq "darwin" && ${os.major} < 21} {
patchfiles-append 0002-patch-util-cpp.patch
}
set i2pddir ${prefix}/var/db/${name}
post-patch {
reinplace "s|@PREFIX@|${prefix}|g" \
${worksrcpath}/contrib/i2pd.conf \
${worksrcpath}/contrib/i2pd.logrotate
reinplace "s|@I2PDDIR@|${i2pddir}|g" ${worksrcpath}/contrib/i2pd.conf
}
set i2pduser _i2pd
add_users ${i2pduser} group=${i2pduser} realname=I2PD\ user
cmake.source_dir ${worksrcpath}/build
# requires a C++17 compiler
compiler.cxx_standard 2017
# error: 'auto' return without trailing return type on
# macOS <10.15 with Xcode Clang
compiler.blacklist-append \
{clang < 1200}
platform darwin {
# https://github.com/PurpleI2P/i2pd/issues/1846
if {${os.major} == 17 || ${os.major} == 18} {
cmake.set_cxx_standard yes
}
}
# These are defaults, but better have them explicit:
configure.args-append -DWITH_LIBRARY=ON \
-DWITH_BINARY=ON \
-DWITH_STATIC=OFF
if {${build_arch} in [list ppc ppc64]} {
configure.args-append \
-Dppc_support=TRUE \
-DWITH_AESNI=OFF
# Temporary fix: use std::atomic in place of GCC builtins.
# See: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107590
# https://github.com/PurpleI2P/i2pd/issues/1726
# https://github.com/boostorg/smart_ptr/issues/105
configure.cxxflags-append \
-DBOOST_SP_USE_STD_ATOMIC
}
post-destroot {
xinstall -d ${destroot}${prefix}/etc/${name}
foreach item {i2pd.conf subscriptions.txt tunnels.conf tunnels.d} {
move ${worksrcpath}/contrib/${item} ${destroot}${prefix}/etc/${name}/${item}.default
}
xinstall -d ${destroot}${prefix}/share/${name}
foreach item {i2pd.logrotate certificates} {
move ${worksrcpath}/contrib/${item} ${destroot}${prefix}/share/${name}
}
xinstall -d ${destroot}${prefix}/share/doc/${name}
xinstall -W ${worksrcpath} -m 0644 ChangeLog LICENSE README.md ${destroot}${prefix}/share/doc/${name}
xinstall -d ${destroot}${prefix}/var/log/${name}
xinstall -d ${destroot}${prefix}/var/run/${name}
xinstall -d ${destroot}${i2pddir}
ln -sf ${prefix}/share/${name}/certificates ${destroot}${i2pddir}/certificates
ln -sf ${prefix}/etc/${name}/tunnels.d ${destroot}${i2pddir}/tunnels.d
ln -sf ${prefix}/etc/${name}/i2pd.conf ${destroot}${i2pddir}/i2pd.conf
ln -sf ${prefix}/etc/${name}/subscriptions.txt ${destroot}${i2pddir}/subscriptions.txt
ln -sf ${prefix}/etc/${name}/tunnels.conf ${destroot}${i2pddir}/tunnels.conf
}
notes "
i2pd status can be checked at: http://127.0.0.1:7070
You may edit i2pd settings in ${prefix}/etc/i2pd
See also: https://i2pd.readthedocs.io/en/latest/user-guide/configuration
Re using i2pd with web-browser: https://github.com/PurpleI2P/i2pdbrowser
"
post-activate {
if {![file exists ${prefix}/etc/logrotate.d/i2pd] && [variant_isset logrotate]} {
xinstall -d ${destroot}${prefix}/etc/logrotate.d
copy ${prefix}/share/${name}/i2pd.logrotate ${prefix}/etc/logrotate.d/i2pd
}
foreach item {i2pd.conf subscriptions.txt tunnels.conf tunnels.d} {
if {![file exists ${prefix}/etc/${name}/${item}]} {
copy ${prefix}/etc/${name}/${item}.default ${prefix}/etc/${name}/${item}
}
}
fs-traverse item "${i2pddir} ${prefix}/var/log/${name} ${prefix}/var/run/${name}" {
file attributes ${item} -owner ${i2pduser} -group ${i2pduser}
}
}
startupitem.create yes
startupitem.user ${i2pduser}
startupitem.group ${i2pduser}
startupitem.executable ${prefix}/bin/${name} --datadir=${i2pddir}
startupitem.pidfile clean ${prefix}/var/run/${name}/${name}.pid
startupitem.logfile ${prefix}/var/log/${name}/${name}.log
destroot.keepdirs ${destroot}${i2pddir} \
${destroot}${prefix}/var/run/${name} \
${destroot}${prefix}/var/log/${name}
variant upnp description "Support for UPNP" {
depends_lib-append port:miniupnpc
configure.args-append \
-DWITH_UPNP=ON
}
variant logrotate description "Logrotate configuration" {
depends_run-append port:logrotate
}
variant tests description "Build and run tests" {
depends_test port:check
configure.args-append \
-DBUILD_TESTING=1
test.run yes
test.cmd ctest
}
default_variants +upnp +logrotate