# topdir: package (npm 平台包 opencode-linux-x64 解压顶层目录) # 打包策略:opencode 上游使用 Bun 的 compile 能力将 TypeScript monorepo 编译为 # 单一可执行 ELF 二进制。openEuler 官方源不提供 Bun 工具链,无法在构建阶段 # 从源码编译;上游官方通过 GitHub release 与 npm 平台包发布预编译二进制。 # 本包直接采用上游官方发布的 Linux x86_64 (glibc) 预编译二进制作为 Source0, # 无需 Node.js / Bun 运行时,仅依赖 glibc。 # monorepo 内部 workspace 包(opencode-ai/plugin、script、sdk)在编译时 # 已被打进二进制,运行时不作为独立 RPM 依赖。 # 预编译二进制保护:Bun compile 产物将其版本号等运行时元数据嵌入 ELF 节中, # 任何形式的 strip(含 find-debuginfo 的 --strip-debug / -g)都会移除这些节, # 导致 `opencode --version` 退化为 Bun 运行时编译期默认值(1.4.4), # %check 的版本校验随之失败。本包直接采用上游预编译产物,无源码可重新编译, # 因此必须彻底禁用 debuginfo 提取与 strip,保持二进制原样。 %global debug_package %{nil} %global __strip /bin/true Name: opencode Version: 1.19.5 Release: 2%{?dist} Summary: AI-powered development tool License: MIT URL: https://github.com/anomalyco/opencode # Source0 为 npm 平台包 opencode-linux-x64,内含上游官方预编译的 Linux x86_64 # glibc 二进制(Bun compile 产物)。解压顶层目录为 package/。 Source0: https://registry.npmjs.org/opencode-linux-x64/-/opencode-linux-x64-%{version}.tgz # Source1 为 MIT 许可证文本,取自上游 git 仓库对应版本 tag 根目录。 Source1: https://raw.githubusercontent.com/anomalyco/opencode/v%{version}/LICENSE # 预编译二进制为 x86_64 专属 ELF(glibc 动态链接),仅在该架构提供。 ExclusiveArch: x86_64 %description opencode is an AI-powered development tool that runs coding agents in the terminal. This package ships the officially pre-compiled Linux x86_64 binary produced upstream with Bun's compile. Because the binary is self-contained (only requiring glibc), no Node.js or Bun toolchain is needed at build or runtime. %prep # npm tarball 解压顶层目录固定为 package/ %setup -n package -q cp -p %{SOURCE1} . %build # Pre-compiled binary; nothing to build. %install install -Dpm 0755 bin/opencode %{buildroot}%{_bindir}/opencode %check # Verify the shipped binary reports the expected version. %{buildroot}%{_bindir}/opencode --version | grep -q "^%{version}$" %files %license LICENSE %{_bindir}/opencode %changelog * Thu Oct 29 2026 AI Importer - 1.19.5-2 - Disable debug_package and strip: stripping corrupts the Bun-compiled binary's embedded version metadata, causing --version to report a fallback value. * Thu Oct 29 2026 AI Importer - 1.19.5-1 - Initial package for opencode 1.19.5 - Ship upstream pre-compiled Linux x86_64 binary (Bun compile)