# ring-v0.17 does not support this arch
NOT_FOR_ARCHS = sparc64

COMMENT =	OpenAI terminal-based coding agent

V =		0.82.0
GH_ACCOUNT =	openai
GH_PROJECT =	codex
GH_TAGNAME =	rust-v${V}
PKGNAME =	codex-${V}

# only build the Rust workspace (the repo also contains JS tooling).
WRKSRC =	${WRKDIST}/codex-rs

DIST_TUPLE += github nornagon crossterm 87db8bfa6dc99427fd3b071681b07fc31c6ce995 ../crossterm
DIST_TUPLE += github nornagon ratatui 9b2ad1298408c45918ee9f8241a6f95498cdbed2 ../ratatui

CATEGORIES =	devel

HOMEPAGE =	https://github.com/openai/codex

# Apache 2.0
PERMIT_PACKAGE =	Yes

WANTLIB += ${MODCARGO_WANTLIB} crypto dbus-1 m ssl util zstd

LIB_DEPENDS =	archivers/zstd \
		x11/dbus

MODULES =	devel/cargo
CONFIGURE_STYLE = cargo

# install the CLI crate ('codex')
MODCARGO_INSTALL_TARGET_PATHS = cli

# test suite expects network access and a configured OpenAI account
NO_TEST =	Yes

post-install:
	${INSTALL_DATA_DIR} ${PREFIX}/share/doc/codex
	cp -r ${WRKDIST}/docs/* ${PREFIX}/share/doc/codex/

.include "crates.inc"

.include <bsd.port.mk>
