dev-util/claude-code: add 2.1.20; move to native

Previously, claude-code was installed via npm. Now, they are installing
via a "native" method which basically boils down to a curl|bash
downloading a single claude binary.

This implements the logic needed to get the right binary for arch/elibc
-- in fact, we're adding support for musl and arm with this change.

A major downside of this method: currently, via
/etc/claude-code/managed-settings.json, we're disabling all sorts of
update automagic -- even prior to the move to a "native" install method
-- but if a user somehow doesn't have DISABLE_AUTOUPDATER or
DISABLE_INSTALLATION_CHECKS in their managed-settings.json, claude will
helpfully "fix" their install by installing itself to ~/.local/ without
user consent. This is not-ideal, dangerous behavior that we warn about
on install.

Signed-off-by: Jay Faulkner <jayf@gentoo.org>
This commit is contained in:
Jay Faulkner
2026-01-27 10:12:10 -08:00
parent 39e02c65ae
commit 83c0001fdd
3 changed files with 72 additions and 0 deletions

View File

@@ -1 +1,5 @@
DIST claude-amd64-glibc-2.1.20 223852550 BLAKE2B 09c1e351474d1eba77da2a71d21ba2f27c53d9167932772ea502c805cd8ab09473ba9804238c4f1964714b4cf4bc153753c7605c884316bc22d58a030dca65d1 SHA512 d7d399708d73c10c8d4cc5cec4a5dbda1b0e75769a12a857095e43c69d78283f9a56d78117b4f3d51db9882646cd0ba8f0a20e247485708a26557bdd61b06d77
DIST claude-amd64-musl-2.1.20 216541126 BLAKE2B f4c6d9aad267c4147d816a8e97ac8f17a46c347969f8b86b0cd6364ce58c772e842152135b8fa27b7f5014511be6345e6621d9d583fc25e1bc320c6589ae457f SHA512 842b3d5f8fba9ca4b44c24f3f101f2ca85331b74a0ce92f12ff1d07e5d430962b657eddf464b0bcc0af3961f79cb9b4b685e819e25f65388c15f7d7418f1cc42
DIST claude-arm64-glibc-2.1.20 216047898 BLAKE2B a3ffae9326518a079997de012a8bce09be8cea99f36dc360372710c34f5a403a14b77631da5beaa06fcba0ee8f57e24623ecf350602597a04267e98ca9b99395 SHA512 f8339c4297408e478551ec949e5574b7043772980579defaca994dd8b78fc93b8a7142c00a4438e7bf593639df83c77923c528e802c546ebaf432c41a0e5ccf8
DIST claude-arm64-musl-2.1.20 211311930 BLAKE2B 39436953a8d1f6d118915c0ea7b629e71103ad9dc83ee43bca5f5790ebde9d50bd681a31769c3413b8a4d3e9fabed271a5bb194f7f69259a37003ac46f8285b0 SHA512 80a6bdec5daf7dd17e48297df0cb1090d9caee05a028072e24024d210a06a8bc93d78e6efd3b2b40313ced2772b479109433b825f5a1ddc33bf27423c0304fea
DIST claude-code-2.1.14.tgz 26380819 BLAKE2B c17b811cd9c98ee2aa4616a9811e9015e1988157d35cb1b16cc605d60962e9708b3b4c3f9f01eee2ddcbcb15938fb135b2817ba4588767befb4c98d9c1f55073 SHA512 18ba9b54ef7b37fa85b827f732d58d42f68e35fc12b18263f221135c023f8505742d283a7b1c23574bf5d9889a1dce77b541bb9b835e0dbc48157264f203106a

View File

@@ -0,0 +1,61 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
DESCRIPTION="Claude Code - an agentic coding tool by Anthropic"
HOMEPAGE="https://claude.com/product/claude-code"
# NOTE(JayF): Claude code's official install method is now curl|bash
# the script is simple: it fetches the latest version,
# downloads a manifest of files for that version, and
# downloads a single binary claude executable matching.
# All this from an unbranded GCS bucket (yikes).
# https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/bootstrap.sh
GCS_BUCKET="https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases"
SRC_URI="
amd64? (
elibc_glibc? ( ${GCS_BUCKET}/${PV}/linux-x64/claude -> claude-amd64-glibc-${PV} )
elibc_musl? ( ${GCS_BUCKET}/${PV}/linux-x64-musl/claude -> claude-amd64-musl-${PV} )
)
arm64? (
elibc_glibc? ( ${GCS_BUCKET}/${PV}/linux-arm64/claude -> claude-arm64-glibc-${PV} )
elibc_musl? ( ${GCS_BUCKET}/${PV}/linux-arm64-musl/claude -> claude-arm64-musl-${PV} )
)"
S="${WORKDIR}"
# NOTE(JayF): claude-code is only usable via paid subscription and has a
# clickthrough EULA-type license. Please see $HOMEPAGE for
# full details.
LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
RESTRICT="bindist mirror"
QA_PREBUILT="opt/bin/claude"
RDEPEND="
>=net-libs/nodejs-18
sys-apps/ripgrep
"
src_compile() {
# Skip, nothing to compile here.
:
}
src_install() {
# NOTE(JayF) Literally the file we download is all there is to
# install. It's just a binary. No docs. Nothing else.
exeinto /opt/bin
newexe "${DISTDIR}/${A[0]}" claude
insinto /etc/${PN}
newins "${FILESDIR}/managed-settings-native.json" managed-settings.json
}
pkg_postinst() {
if ! grep -q DISABLE_INSTALLATION_CHECKS /etc/claude-code/managed-settings.json; then
ewarn "Ensure you run etc-update or dispatch-conf before executing claude."
ewarn "Failure to properly integrate changes to /etc/claude-code/managed-settings.json"
ewarn "may lead to claude installing itself to your homedir without asking."
fi
}

View File

@@ -0,0 +1,7 @@
{
"env": {
"DISABLE_AUTOUPDATER": "1",
"DISABLE_INSTALLATION_CHECKS": "1"
},
"installMethod": "native"
}