summaryrefslogtreecommitdiff
path: root/net-misc/airouter/airouter-1.0.0_pre20261012.ebuild
blob: 3413934d4aa58e11dc0ba1c6c8b6290a8bc17b09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
EAPI=8

inherit cmake flag-o-matic

DESCRIPTION="AIRouter runtime (C++; replaces the Rust 0.1.x airouterd)"
HOMEPAGE="https://trunkmasters.com/airouter"
SRC_URI="https://www.hedronfire.com/distfiles/${P}.tar.gz"

# Mirrors the Rust net-misc/airouter; the license declaration is an owner decision.
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"

# The build pins exact dependency versions (M0 host pins). Compiler pins are
# enforced by CMake itself (GCC 14.4.1 or Clang 23.1.3).
DEPEND="
	=dev-libs/boost-1.91.0*
	=dev-libs/openssl-3.6.5*
	=dev-db/postgresql-18.6*
	=dev-cpp/nlohmann_json-3.12.0*
	=dev-cpp/tomlplusplus-3.4.0*
	=dev-cpp/yaml-cpp-0.9.0*
"
# chronyc reports are parsed in their verified CSV shapes (ADR-05 [time]).
RDEPEND="
	${DEPEND}
	>=acct-group/airouter-1
	>=acct-user/airouter-1
	app-admin/sudo
	=net-misc/chrony-4.9*
	>=dev-lang/python-3.11
"
BDEPEND="
	=dev-cpp/catch-3.15.3*
	>=dev-lang/python-3.11
"

src_configure() {
	# The project refuses in-source builds and requires an absolute build root.
	export AIROUTER_CPP_BUILD_ROOT="${WORKDIR}/build"
	# GCC 14 at -O2 reports -Wmismatched-new-delete (a -Werror error here) inside
	# Boost.Asio's recycling awaitable-frame allocator: operator new and operator delete
	# are a matched pair, but GCC sees the inlined aligned_alloc. The CMake presets
	# (-O0, -O3) do not trigger it. Only this one diagnostic is disabled; -Werror stays.
	append-cxxflags -Wno-mismatched-new-delete
	local mycmakeargs=( -DAIROUTER_SANITIZER=none )
	cmake_src_configure
}

src_test() {
	# Unit and digest-vector tests run here. The PostgreSQL/bwrap end-to-end and the
	# install-layout tests run in CI, outside the Portage sandbox.
	cmake_src_test -R '^m1-(unit|digest-vectors)$'
}

src_install() {
	cmake_src_install
	newinitd "${ED}"/usr/share/airouter/openrc/airouterd.initd airouterd
	newconfd "${ED}"/usr/share/airouter/openrc/airouterd.confd airouterd
	insinto /etc/airouter
	newins packaging/airouterd.toml.example airouterd.toml.example
	# /var/lib/airouter is the acct-user home (owned there); the service's
	# start_pre creates its receipts, run and log directories with checkpath.
}

pkg_postinst() {
	elog "Copy /etc/airouter/airouterd.toml.example to airouterd.toml,"
	elog "apply the schema with airouter-migrate (as the migrator role, from"
	elog "/usr/share/airouter/sql), keep execution.cgroup equal to AIROUTERD_CGROUP"
	elog "in /etc/conf.d/airouterd (the service delegates it at start),"
	elog "create the [history] directory on its own filesystem (for example a ZFS dataset"
	elog "outside the database's snapshots and backups; the daemon refuses a shared one),"
	elog "set [time] to the NTS-authenticated chronyd (its socket, uid, config, the"
	elog "config's sha256sum and the addresses its NTS server name resolves to), install"
	elog "/usr/share/airouter/sudoers.airouter as /etc/sudoers.d/airouterd with"
	elog "those addresses (it lets the service read chronyd's reports as ntp),"
	elog "then: rc-service airouterd start."
}