blob: 2a1dd038b9f49d9044624962d2e084ac8b26a166 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# Copyright 2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit shell-completion
# xAI stopped publishing the source at 1.0.45 (2026-09-29); the binaries are
# taken from the npm platform packages that the official installer uses.
DESCRIPTION="SpaceXAI's coding agent harness and TUI (prebuilt binary)"
HOMEPAGE="
https://x.ai/cli
https://github.com/xai-org/grok-build
"
SRC_URI="
amd64? ( https://registry.npmjs.org/@xai-official/grok-linux-x64/-/grok-linux-x64-${PV}.tgz -> ${P}-x64.tgz )
arm64? ( https://registry.npmjs.org/@xai-official/grok-linux-arm64/-/grok-linux-arm64-${PV}.tgz -> ${P}-arm64.tgz )
"
S="${WORKDIR}/package"
LICENSE="Apache-2.0"
# Bundled crates and the bundled rg, ugrep and bfs binaries
LICENSE+="
0BSD Apache-2.0 BSD-2 BSD Boost-1.0 CC0-1.0 CDLA-Permissive-2.0 EPL-2.0
ISC MIT MIT-0 MPL-2.0 Unicode-3.0 Unicode-DFS-2016 Unlicense WTFPL-2
ZLIB
"
SLOT="0"
KEYWORDS="-* ~amd64 ~arm64"
RESTRICT="strip"
RDEPEND="!dev-util/grok-build"
BDEPEND="app-arch/brotli"
QA_PREBUILT="usr/bin/grok"
src_compile() {
# Shipped brotli-compressed to stay under npm's size limit
brotli -d -o grok bin/grok.br || die
chmod 0755 grok || die
# Keep the binary away from the build user's real home
local -x HOME="${T}/home" GROK_HOME="${T}/home/.grok"
./grok completions bash > grok.bash || die
./grok completions fish > grok.fish || die
./grok completions zsh > _grok || die
}
src_install() {
dobin grok
dosym grok /usr/bin/agent
newbashcomp grok.bash grok
dofishcomp grok.fish
dozshcomp _grok
# Portage owns updates. requirements.toml is the highest config tier,
# so this overrides every user's own config.
insinto /etc/grok
doins "${FILESDIR}"/requirements.toml
dodoc README.md THIRD_PARTY_NOTICES.md
}
pkg_postinst() {
elog "Automatic updates are turned off in /etc/grok/requirements.toml;"
elog "update grok through Portage. An explicit \`grok update\` still"
elog "installs a separate copy under ~/.grok/bin."
}
|