|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copy the Linux sandbox native binaries into the bin/ subfolder of codex-cli/. |
| 4 | +# |
| 5 | +# Usage: |
| 6 | +# ./scripts/install_native_deps.sh [CODEX_CLI_ROOT] |
| 7 | +# |
| 8 | +# Arguments |
| 9 | +# [CODEX_CLI_ROOT] – Optional. If supplied, it should be the codex-cli |
| 10 | +# folder that contains the package.json for @openai/codex. |
| 11 | +# |
| 12 | +# When no argument is given we assume the script is being run directly from a |
| 13 | +# development checkout. In that case we install the binaries into the |
| 14 | +# repository’s own `bin/` directory so that the CLI can run locally. |
| 15 | + |
| 16 | +set -euo pipefail |
| 17 | + |
| 18 | +# ---------------------------------------------------------------------------- |
| 19 | +# Determine where the binaries should be installed. |
| 20 | +# ---------------------------------------------------------------------------- |
| 21 | + |
| 22 | +if [[ $# -gt 0 ]]; then |
| 23 | + # The caller supplied a release root directory. |
| 24 | + CODEX_CLI_ROOT="$1" |
| 25 | + BIN_DIR="$CODEX_CLI_ROOT/bin" |
| 26 | +else |
| 27 | + # No argument; fall back to the repo’s own bin directory. |
| 28 | + # Resolve the path of this script, then walk up to the repo root. |
| 29 | + SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 30 | + CODEX_CLI_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" |
| 31 | + BIN_DIR="$CODEX_CLI_ROOT/bin" |
| 32 | +fi |
| 33 | + |
| 34 | +# Make sure the destination directory exists. |
| 35 | +mkdir -p "$BIN_DIR" |
| 36 | + |
| 37 | +# ---------------------------------------------------------------------------- |
| 38 | +# Download and decompress the artifacts from the GitHub Actions workflow. |
| 39 | +# ---------------------------------------------------------------------------- |
| 40 | + |
| 41 | +# Until we start publishing stable GitHub releases, we have to grab the binaries |
| 42 | +# from the GitHub Action that created them. Update the URL below to point to the |
| 43 | +# appropriate workflow run: |
| 44 | +WORKFLOW_URL="https://github.com/openai/codex/actions/runs/14763725716" |
| 45 | +WORKFLOW_ID="${WORKFLOW_URL##*/}" |
| 46 | + |
| 47 | +ARTIFACTS_DIR="$(mktemp -d)" |
| 48 | +trap 'rm -rf "$ARTIFACTS_DIR"' EXIT |
| 49 | + |
| 50 | +# NB: The GitHub CLI `gh` must be installed and authenticated. |
| 51 | +gh run download --dir "$ARTIFACTS_DIR" --repo openai/codex "$WORKFLOW_ID" |
| 52 | + |
| 53 | +# Decompress the two target architectures. |
| 54 | +zstd -d "$ARTIFACTS_DIR/x86_64-unknown-linux-musl/codex-linux-sandbox-x86_64-unknown-linux-musl.zst" \ |
| 55 | + -o "$BIN_DIR/codex-linux-sandbox-x64" |
| 56 | + |
| 57 | +zstd -d "$ARTIFACTS_DIR/aarch64-unknown-linux-gnu/codex-linux-sandbox-aarch64-unknown-linux-gnu.zst" \ |
| 58 | + -o "$BIN_DIR/codex-linux-sandbox-arm64" |
| 59 | + |
| 60 | +echo "Installed native dependencies into $BIN_DIR" |
| 61 | + |
0 commit comments