# Binary package of the upstream Linux release tarball (same approach as # AUR opencode-bin). COPR has network access, so Source URLs are fetched at # build time. Prebuilt Bun binary — do not strip or generate debuginfo. %global debug_package %{nil} %global __strip /bin/true Name: opencode Version: 1.18.29 Release: 1%{?dist} Summary: The open source AI coding agent built for the terminal License: MIT URL: https://github.com/anomalyco/opencode # Always list both arch tarballs so the SRPM works for multi-arch COPR builds. # Each tarball contains a single top-level binary named "opencode". Source0: %{url}/releases/download/v%{version}/opencode-linux-x64.tar.gz#/%{name}-%{version}-linux-x64.tar.gz Source1: %{url}/releases/download/v%{version}/opencode-linux-arm64.tar.gz#/%{name}-%{version}-linux-arm64.tar.gz # Local file in this package directory (must be committed next to the spec). Source2: LICENSE ExclusiveArch: x86_64 aarch64 # Runtime tools the CLI shells out to (matches Arch official package). Requires: ripgrep Requires: curl Requires: tar Recommends: (wl-clipboard if wayland) Recommends: (xclip if xorg-x11-server-Xorg) BuildRequires: bash %description OpenCode is an open source AI coding agent for the terminal. It provides a TUI for interacting with AI models to help with coding tasks, debugging, and more. This package installs the official prebuilt Linux binary from upstream GitHub releases (same approach as AUR opencode-bin). %prep # Tarball has no enclosing directory; -c creates %%{name}-%%{version}/ for us. # -T skips the default Source0 unpack; -a N unpacks SourceN after chdir. %ifarch x86_64 %setup -q -c -n %{name}-%{version} -T -a 0 %endif %ifarch aarch64 %setup -q -c -n %{name}-%{version} -T -a 1 %endif cp -a %{SOURCE2} . %build # Prebuilt binary — nothing to compile. %install install -Dpm0755 opencode %{buildroot}%{_bindir}/opencode # Shell completions (generated by the binary, same as Arch packaging). install -ddm0755 %{buildroot}%{_datadir}/bash-completion/completions install -ddm0755 %{buildroot}%{_datadir}/zsh/site-functions SHELL=/bin/bash %{buildroot}%{_bindir}/opencode completion \ > %{buildroot}%{_datadir}/bash-completion/completions/opencode SHELL=/bin/zsh %{buildroot}%{_bindir}/opencode completion \ > %{buildroot}%{_datadir}/zsh/site-functions/_opencode chmod 0644 \ %{buildroot}%{_datadir}/bash-completion/completions/opencode \ %{buildroot}%{_datadir}/zsh/site-functions/_opencode %check %{buildroot}%{_bindir}/opencode --version | grep -Fqe "%{version}" %files %license LICENSE %{_bindir}/opencode %{_datadir}/bash-completion/completions/opencode %{_datadir}/zsh/site-functions/_opencode %changelog * Sun Sep 07 2026 vitrasti - 1.18.29-1 - Update to 1.18.29 * Sun Aug 16 2026 vitrasti - 1.18.18-1 - Initial package for personal COPR - Based on AUR opencode-bin / Arch Linux opencode packaging - Install official prebuilt Linux release binary - Ship bash/zsh completions generated by the binary