summaryrefslogtreecommitdiff
path: root/app-misc/smith/smith-0.13.0.ebuild
blob: ff042fcb320eb6d62a0d34c07eebc311791608b7 (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
EAPI=8

inherit cmake flag-o-matic

DESCRIPTION="Agent Smith: terminal assistant with tools on this host, sessions on alpha (C++)"
HOMEPAGE="https://trunkmasters.com/smith"
SRC_URI="https://www.hedronfire.com/distfiles/${P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="server"

DEPEND="
	=dev-libs/boost-1.91.0*
	=dev-libs/openssl-3.6.5*
	>=dev-db/sqlite-3.53:3
	=dev-cpp/nlohmann_json-3.12.0*
	=dev-cpp/tomlplusplus-3.4.0*
"
# The client runs sandboxed commands in bubblewrap and logs in over OpenSSH. The
# server runs as an existing `smith` account (on Alpha it predates any acct package).
RDEPEND="
	${DEPEND}
	dev-vcs/git
	net-misc/openssh
	sys-apps/bubblewrap
"
BDEPEND="
	dev-vcs/git
	=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 SMITH_CPP_BUILD_ROOT="${WORKDIR}/build"
	local mycmakeargs=( -DSMITH_SANITIZER=none )
	cmake_src_configure
}

src_test() {
	# The end-to-end tests (sockets, TLS, a pty) run in CI, outside the Portage sandbox.
	cmake_src_test -R '^unit$'
}

src_install() {
	cmake_src_install
	if use server; then
		newinitd "${ED}"/usr/share/smith/openrc/smithd.initd smithd
		newconfd "${ED}"/usr/share/smith/openrc/smithd.confd smithd
	else
		rm "${ED}"/usr/sbin/smithd "${ED}"/usr/libexec/smith/smith-mcp || die
	fi
}

pkg_postinst() {
	use server || return
	elog "Server: needs the system account smith (and AIRouter's account in group of the"
	elog "relay socket). Start from /usr/share/smith/server.toml.example as /etc/smith/server.toml"
	elog "(root:smith 0640). AIRouter needs a smith principal, the smith role and a profile"
	elog "pinned to it whose resource server is /usr/libexec/smith/smith-mcp with"
	elog "SMITH_MCP_SOCKET=/run/smith/relay/relay.sock. Then: rc-service smithd start."
}