summaryrefslogtreecommitdiff
path: root/dev-util
diff options
context:
space:
mode:
Diffstat (limited to 'dev-util')
-rw-r--r--dev-util/codex/Manifest2
-rw-r--r--dev-util/codex/codex-0.156.1.ebuild172
2 files changed, 174 insertions, 0 deletions
diff --git a/dev-util/codex/Manifest b/dev-util/codex/Manifest
index 77446a102858..37f309bea38d 100644
--- a/dev-util/codex/Manifest
+++ b/dev-util/codex/Manifest
@@ -1,6 +1,8 @@
DIST cloudflare-zlib-sys-0.3.6.crate 147199 BLAKE2B b7089d328048b838fd9003f14cd9bddb720507a3426bd3a99ab70aa32dabee44078d6e9f9cc0171d7674ebf084fdd60776063e6976d5bd9ae61b2943c94c00d1 SHA512 c0064ab7dda47088450b3abd0ac12981e1db44564e7acf03af0836f9a9c54310cac5f93dd0cbc64c32749ea9cfe899ead81533f630dd00f5e29e9c6ef7150e6e
DIST codex-0.156.0.tar.gz 15838789 BLAKE2B 2a5a198d8fd66abf39f5f82ae7d2d810875970f31fb49b2032e7be9b69fef42153f2ffe4663f7d1174eada52f85080e2c22bdd6410d02da1ddeb660ba73ce73e SHA512 e50430d2fab4898feaeeda5c51e790c38f55b2837c087ac7c5b5a552add491276c9cfecc4c72927a2d68b89eafcab2a933a390910f7752dcfc9ac3ddcc84fa5a
+DIST codex-0.156.1.tar.gz 15873682 BLAKE2B 7d4304cabb201a467aeade484b280b277c4cec5da4998b661bbf0d922e3603a2de8a4f79e321d76c952522107268e42155411e60920efe36c42134b26da04398 SHA512 99157bb655d179e323556d165da78963068be8f279c37dc95173afd860828772c555377f41e7093e5ec7c177eef1147109141e7f7b759342532621ac786e7f98
DIST codex-rust-v0.156.0-crates.tar.xz 158178052 BLAKE2B 878048fd7831cab2e226d72370246d86e8eba923aff2b04dda017bc843c3b35d284ace60ea1f75d9c986e3c1c3d405da25430c9236b9bddb08a9aa8578de44f5 SHA512 1f3d8195db2fd4968e125b551ef2ef28cc7c64b46ddcba36c87df5be30767f02f1397f653967757f86606f654a1f21f4579c2d7072db89be524a8e6a9ae98c46
+DIST codex-rust-v0.156.1-crates.tar.xz 158178052 BLAKE2B 878048fd7831cab2e226d72370246d86e8eba923aff2b04dda017bc843c3b35d284ace60ea1f75d9c986e3c1c3d405da25430c9236b9bddb08a9aa8578de44f5 SHA512 1f3d8195db2fd4968e125b551ef2ef28cc7c64b46ddcba36c87df5be30767f02f1397f653967757f86606f654a1f21f4579c2d7072db89be524a8e6a9ae98c46
DIST crossterm-45fecb9508105988f42fe6ff0441783ed3717f92.gh.tar.gz 144786 BLAKE2B 18577acd2586a50723657e77b304d7bd309208d7ce597d315d13d7e36c90ac08f15510053ad1e927798b0edabc75fc8e54f1f2ac4978215084c0cf84573193e8 SHA512 aa5fd475a306000032fa0a68c758d81056920c68fd001ce632e0fbc11d70efd37def5786a677f3f4cd2e17b76672eda6bb53a517ba90a18e8dc312c390987786
DIST libz-ng-sys-1.1.16.crate 478122 BLAKE2B 7c1be97251029732cd3a8c77dad8a492193282b5fddf40df480ef3a35a49f5d25c7dc183d81aa267722276156c8b97243742117686d078f2d3a566546fa83d58 SHA512 c7d1b062a06b283ee2d398ff456f13634ed1d2d436ea2b8a55f19fbbad47bc419e068b0f9e805221321062b8c5ad309dd3e5d466741780549ae3e5299eee06e1
DIST libz-sys-1.1.20.crate 830422 BLAKE2B 26265b1faf04f7d0cfd751ddf003585b1be59fcf8fde3ddfd86f18cc3e2d5c3b62a808f47c01329a57759d14fe6283cd94a72eda46d5c5031249df0f1696ab03 SHA512 9b537e7c01553e782be145223c6d174601ade3a950bfd0eb4ea09658da5b8910cf0d0c5984672f9d198f73d5aa63d21e0c20c4c44ff7d0a017ee11ae4ecf4859
diff --git a/dev-util/codex/codex-0.156.1.ebuild b/dev-util/codex/codex-0.156.1.ebuild
new file mode 100644
index 000000000000..e4cd743774c1
--- /dev/null
+++ b/dev-util/codex/codex-0.156.1.ebuild
@@ -0,0 +1,172 @@
+# Copyright 2025-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# NOTE: This package uses a pre-built crate tarball instead of listing individual
+# crates in CRATES="". This approach is required because:
+# 1. Codex has 800+ crate dependencies, which triggers Portage QA warnings:
+# "QA Notice: This package uses a very large number of CRATES. Please provide
+# a crate tarball instead and fetch it via SRC_URI."
+# 2. Stricter ebuild QA checks (e.g., in CI pipelines) fail with too many crates.
+#
+# The crate tarball is auto-generated by GitHub Actions at:
+# https://github.com/gentoo-zh-drafts/codex/
+# Workflow source code for auditing:
+# https://github.com/gentoo-zh-drafts/codex/blob/crate-dist/.github/workflows/crates.yml
+# This allows anyone to review and verify the crate packaging process.
+
+CRATES="
+ cloudflare-zlib-sys@0.3.6
+ libz-ng-sys@1.1.16
+ libz-sys@1.1.20
+"
+
+declare -A GIT_CRATES=(
+ [appcontainer_common]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/backends/appcontainer/common'
+ [crossterm]='https://github.com/openai-oss-forks/crossterm;45fecb9508105988f42fe6ff0441783ed3717f92;crossterm-%commit%'
+ [learning_mode_core]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/learning_mode_core'
+ [learning_mode_windows]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/backends/learning_mode/windows'
+ [libwebrtc]='https://github.com/juberti-oai/rust-sdks;e2d1d1d230c6fc9df171ccb181423f957bb3c1f0;rust-sdks-%commit%/libwebrtc'
+ [mxc_config_contract]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/mxc_config_contract'
+ [mxc_telemetry]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/mxc_telemetry'
+ [process_security_environment_spec]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/generated/process_security_environment_specification'
+ [livekit-protocol]='https://github.com/juberti-oai/rust-sdks;e2d1d1d230c6fc9df171ccb181423f957bb3c1f0;rust-sdks-%commit%/livekit-protocol'
+ [livekit-runtime]='https://github.com/juberti-oai/rust-sdks;e2d1d1d230c6fc9df171ccb181423f957bb3c1f0;rust-sdks-%commit%/livekit-runtime'
+ [nucleo-matcher]='https://github.com/helix-editor/nucleo;4253de9faabb4e5c6d81d946a5e35a90f87347ee;nucleo-%commit%/matcher'
+ [nucleo]='https://github.com/helix-editor/nucleo;4253de9faabb4e5c6d81d946a5e35a90f87347ee;nucleo-%commit%'
+ [ratatui]='https://github.com/nornagon/ratatui;9b2ad1298408c45918ee9f8241a6f95498cdbed2;ratatui-%commit%'
+ [sandbox_spec]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/generated/base_container_specification'
+ [runfiles]='https://github.com/dzbarsky/rules_rust;b56cbaa8465e74127f1ea216f813cd377295ad81;rules_rust-%commit%/rust/runfiles'
+ [tokio-tungstenite]='https://github.com/openai-oss-forks/tokio-tungstenite;132f5b39c862e3a970f731d709608b3e6276d5f6;tokio-tungstenite-%commit%'
+ [tungstenite]='https://github.com/openai-oss-forks/tungstenite-rs;9200079d3b54a1ff51072e24d81fd354f085156f;tungstenite-rs-%commit%'
+ [wxc_common]='https://github.com/microsoft/mxc;6cd3d58f05d3447e67109cfb75e042803b843ca4;mxc-%commit%/src/core/wxc_common'
+ [webrtc-sys-build]='https://github.com/juberti-oai/rust-sdks;e2d1d1d230c6fc9df171ccb181423f957bb3c1f0;rust-sdks-%commit%/webrtc-sys/build'
+ [webrtc-sys]='https://github.com/juberti-oai/rust-sdks;e2d1d1d230c6fc9df171ccb181423f957bb3c1f0;rust-sdks-%commit%/webrtc-sys'
+)
+
+RUST_MIN_VER="1.95.0"
+
+# python3 .github/scripts/rusty_v8_bazel.py resolved-v8-crate-version
+RUSTY_V8_TAG="147.4.0"
+
+inherit cargo check-reqs toolchain-funcs
+
+CHECKREQS_MEMORY="15G"
+CHECKREQS_DISK_BUILD="20G"
+
+DESCRIPTION="Codex CLI - OpenAI's AI-powered coding agent"
+HOMEPAGE="https://github.com/openai/codex"
+
+# The crate tarball URL uses ${PV} so it auto-updates when bumping versions.
+# 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/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
+ -> rusty_v8_${RUSTY_V8_TAG}_librusty_v8_release_x86_64-unknown-linux-musl.a.gz
+ https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/src_binding_release_x86_64-unknown-linux-musl.rs
+ -> rusty_v8_${RUSTY_V8_TAG}_src_binding_release_x86_64-unknown-linux-musl.rs
+ )
+ arm64? (
+ https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/librusty_v8_release_aarch64-unknown-linux-musl.a.gz
+ -> rusty_v8_${RUSTY_V8_TAG}_librusty_v8_release_aarch64-unknown-linux-musl.a.gz
+ https://github.com/openai/codex/releases/download/rusty-v8-v${RUSTY_V8_TAG}/src_binding_release_aarch64-unknown-linux-musl.rs
+ -> rusty_v8_${RUSTY_V8_TAG}_src_binding_release_aarch64-unknown-linux-musl.rs
+ )
+ ${CARGO_CRATE_URIS}
+"
+
+S="${WORKDIR}/${PN}-rust-v${PV}/codex-rs"
+
+LICENSE="Apache-2.0"
+# Dependent crate licenses
+LICENSE+="
+ Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD-2 BSD Boost-1.0
+ CC0-1.0 CDLA-Permissive-2.0 ISC MIT MPL-2.0 Unicode-3.0 ZLIB
+"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~arm64"
+# Tests fail due to ring crate conflicts with system OpenSSL
+RESTRICT="test"
+
+DEPEND="
+ dev-libs/openssl:=
+ sys-apps/dbus
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+# rust does not use *FLAGS from make.conf, silence portage warning
+QA_FLAGS_IGNORED="usr/bin/${PN} usr/bin/codex-code-mode-host"
+
+pkg_pretend() {
+ check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ check-reqs_pkg_setup
+ rust_pkg_setup
+ if tc-is-lto; then
+ export CARGO_PROFILE_RELEASE_LTO=thin
+ else
+ export CARGO_PROFILE_RELEASE_LTO=false
+ fi
+}
+
+gen_git_crate_dir() {
+ # https://github.com/gentoo/gentoo/blob/b09dd88412fe2d5eee5a8891e08bfa2d67848da3/eclass/cargo.eclass#L442
+ IFS=';' read -r crate_uri commit crate_dir <<<"${GIT_CRATES[$1]}"
+ echo "${WORKDIR}/${crate_dir//%commit%/${commit}}"
+}
+
+src_prepare() {
+ default
+
+ # Cargo resolves target-specific dependencies while building the package
+ # graph, so drop this unvendored Windows-only git dependency on Linux.
+ sed -i '/^appcontainer_common = { workspace = true }$/d' \
+ "${S}/sandboxing/Cargo.toml" || die
+
+ # Fix tokio-tungstenite's git dependency on tungstenite
+ sed -i '/^\[dependencies\.tungstenite\]/,/^$/{
+ s|git = "https://github.com/openai-oss-forks/tungstenite-rs"|path = "'"$(gen_git_crate_dir tungstenite)"'"|
+ /^rev = /d
+ }' "$(gen_git_crate_dir tokio-tungstenite)/Cargo.toml" || die
+
+ # Remove the [patch.crates-io] section and add path-based patches
+ sed -i '/^\[patch\.crates-io\]/,/^$/d' "${S}/Cargo.toml" || die
+ sed -i '/^\[patch\."ssh:\/\/git@github\.com/,/^$/d' "${S}/Cargo.toml" || die
+
+ # Add new patch section with local paths
+ cat >> "${S}/Cargo.toml" <<-EOF || die
+
+ [patch.crates-io]
+ crossterm = { path = "$(gen_git_crate_dir crossterm)" }
+ ratatui = { path = "$(gen_git_crate_dir ratatui)" }
+ tokio-tungstenite = { path = "$(gen_git_crate_dir tokio-tungstenite)" }
+ tungstenite = { path = "$(gen_git_crate_dir tungstenite)" }
+ EOF
+}
+
+src_compile() {
+ local rusty_v8_triple
+ use amd64 && rusty_v8_triple=x86_64-unknown-linux-musl
+ use arm64 && rusty_v8_triple=aarch64-unknown-linux-musl
+
+ # codex-core trait resolution overflows rustc's default 8MiB stack
+ export RUST_MIN_STACK=16777216
+
+ RUSTY_V8_ARCHIVE="${DISTDIR}/rusty_v8_${RUSTY_V8_TAG}_librusty_v8_release_${rusty_v8_triple}.a.gz" \
+ RUSTY_V8_SRC_BINDING_PATH="${DISTDIR}/rusty_v8_${RUSTY_V8_TAG}_src_binding_release_${rusty_v8_triple}.rs" \
+ cargo_src_compile --package codex-cli --package codex-code-mode-host
+}
+
+src_install() {
+ # The CLI starts Code Mode through a sibling executable.
+ dobin "$(cargo_target_dir)/codex" \
+ "$(cargo_target_dir)/codex-code-mode-host"
+ einstalldocs
+}