dev-util/codex: add 0.157.1-r1, drop 0.157.1

The app-server daemon is enabled by default since 0.157 and refuses to start
without the complete package layout next to the executable, which broke every
interactive launch.

Bug: https://github.com/openai/codex/issues/48050
Signed-off-by: Huang Rui <vowstar@gmail.com>
This commit is contained in:
Huang Rui committed 2026-09-27 02:56:59 -07:00
1 parent 2c73fc92cf
commit 8d6d152fd0
1 file changed
+40 -4
@@ -50,7 +50,7 @@ HOMEPAGE="https://github.com/openai/codex"
# This tarball is generated by: https://github.com/gentoo-zh-drafts/codex/
# See .github/workflows/crates.yml for the generation process.
SRC_URI="
https://github.com/openai/${PN}/archive/rust-v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/openai/${PN}/archive/rust-v${PV}.tar.gz -> ${PN}-${PV}.tar.gz
https://github.com/gentoo-zh-drafts/codex/releases/download/rust-v${PV}/codex-rust-v${PV}-crates.tar.xz
amd64? (
https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/librusty_v8_release_x86_64-unknown-linux-musl.a.gz
@@ -88,11 +88,12 @@ DEPEND="
"
RDEPEND="${DEPEND}
>=sys-apps/bubblewrap-0.11.2
sys-apps/ripgrep
"
BDEPEND="virtual/pkgconfig"
# rust does not use *FLAGS from make.conf, silence portage warning
QA_FLAGS_IGNORED="usr/bin/${PN}"
QA_FLAGS_IGNORED="usr/lib/${PN}/bin/*"
pkg_pretend() {
check-reqs_pkg_pretend
@@ -153,7 +154,42 @@ src_compile() {
}
src_install() {
dobin "$(cargo_target_dir)/codex"
dobin "$(cargo_target_dir)/codex-code-mode-host"
local pkgdir="/usr/lib/${PN}"
local pkg_target
case ${ARCH} in
amd64) pkg_target="x86_64-unknown-linux-gnu" ;;
arm64) pkg_target="aarch64-unknown-linux-gnu" ;;
esac
exeinto "${pkgdir}"/bin
doexe "$(cargo_target_dir)/codex" "$(cargo_target_dir)/codex-code-mode-host"
# The app-server daemon installs the CLI from this layout, see
# https://github.com/openai/codex/issues/48050
cat > "${T}"/codex-package.json <<-EOF || die
{
"layoutVersion": 1,
"version": "${PV}",
"target": "${pkg_target}",
"variant": "codex",
"entrypoint": "bin/codex",
"resourcesDir": "codex-resources",
"pathDir": "codex-path"
}
EOF
insinto "${pkgdir}"
doins "${T}"/codex-package.json
# The layout requires both files, they resolve to the system programs
printf '#!/bin/sh\nexec %s/usr/bin/rg "$@"\n' "${EPREFIX}" > "${T}"/rg || die
printf '#!/bin/sh\nexec %s/usr/bin/bwrap "$@"\n' "${EPREFIX}" > "${T}"/bwrap || die
exeinto "${pkgdir}"/codex-path
doexe "${T}"/rg
exeinto "${pkgdir}"/codex-resources
doexe "${T}"/bwrap
dosym ../lib/"${PN}"/bin/codex /usr/bin/"${PN}"
dosym ../lib/"${PN}"/bin/codex-code-mode-host /usr/bin/codex-code-mode-host
einstalldocs
}