# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DESCRIPTION="AI coding agent CLI from Sourcegraph"
HOMEPAGE="https://ampcode.com/ https://sourcegraph.com/amp"

# Upstream version includes git suffix: 0.0.1770494498-g9adfc0
MY_PV="${PV}-g9adfc0"
SRC_URI="
	amd64? ( https://storage.googleapis.com/amp-public-assets-prod-0/cli/${MY_PV}/amp-linux-x64 -> ${P}-amd64 )
	arm64? ( https://storage.googleapis.com/amp-public-assets-prod-0/cli/${MY_PV}/amp-linux-arm64 -> ${P}-arm64 )
"
S="${WORKDIR}"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
RESTRICT="bindist mirror strip"

QA_PREBUILT="opt/bin/amp"

src_compile() {
	:
}

src_install() {
	exeinto /opt/bin
	if use amd64; then
		newexe "${DISTDIR}/${P}-amd64" amp
	elif use arm64; then
		newexe "${DISTDIR}/${P}-arm64" amp
	fi
}