diff --git a/misc/claude-code/Makefile b/misc/claude-code/Makefile index 3c6e126c73b9..ac2063656036 100644 --- a/misc/claude-code/Makefile +++ b/misc/claude-code/Makefile @@ -1,62 +1,62 @@ PORTNAME= claude-code -DISTVERSION= 2.1.224 +DISTVERSION= 2.1.225 CATEGORIES= misc # machine-learning MASTER_SITES= https://downloads.claude.ai/claude-code-releases/${DISTVERSION}/:amd64 \ https://downloads.claude.ai/claude-code-releases/${DISTVERSION}/:aarch64 DISTFILES= linux-x64/claude:amd64 \ linux-arm64/claude:aarch64 DIST_SUBDIR= ${PORTNAME}-${DISTVERSION} +EXTRACT_ONLY= MAINTAINER= yuri@FreeBSD.org COMMENT= Agentic coding tool from Anthropic that lives in your terminal WWW= https://github.com/anthropics/claude-code +LICENSE= Proprietary +LICENSE_NAME= Anthropic Proprietary License +LICENSE_FILE= ${FILESDIR}/LICENSE +LICENSE_PERMS= dist-mirror pkg-mirror auto-accept + ONLY_FOR_ARCHS= aarch64 amd64 ONLY_FOR_ARCHS_REASON= is a Linux binary with a limited platform support +RUN_DEPENDS= bash:shells/bash + USES= linux:rl9 USE_LINUX= base +STRIP= # elftoolchain strip fails on these Linux binaries NO_BUILD= yes +SUB_FILES= claude + NO_WRKSUBDIR= yes -EXTRACT_ONLY= -STRIP= # elftoolchain strip fails on these Linux binaries PLIST_FILES= bin/claude \ libexec/claude find-new-version: @TAB=$$(printf '\t'); \ new_ver=$$(fetch -q -o - https://downloads.claude.ai/claude-code-releases/latest); \ current_ver=$$(make -V DISTVERSION); \ if [ "$$new_ver" != "$$current_ver" ]; then \ ${SED} -i '' "s/^DISTVERSION=.*/DISTVERSION=$${TAB}$$new_ver/" ${.CURDIR}/Makefile; \ echo "=> New version available: $$current_ver -> $$new_ver"; \ else \ echo "=> No new version available (current: $$current_ver)"; \ fi .include .if ${ARCH} == aarch64 CC_PLATFORM= linux-arm64 .else CC_PLATFORM= linux-x64 .endif do-install: ${INSTALL_PROGRAM} \ ${DISTDIR}/${DIST_SUBDIR}/${CC_PLATFORM}/claude \ ${STAGEDIR}${PREFIX}/libexec/claude - # create a wrapper script in the bin directory to check that /compat/linux/proc is mounted and then call the binary in libexec - ( \ - ${ECHO} "#!/bin/sh"; \ - ${ECHO} "if [ ! -d /compat/linux/proc ]; then"; \ - ${ECHO} " echo 'Error: /compat/linux/proc is not mounted. Please run \"sudo mount -t linprocfs linprocfs /compat/linux/proc\" to mount it.'"; \ - ${ECHO} " exit 1"; \ - ${ECHO} "fi"; \ - ${ECHO} "exec ${PREFIX}/libexec/claude \"\$$@\"" \ - ) > ${STAGEDIR}${PREFIX}/bin/claude - ${CHMOD} +x ${STAGEDIR}${PREFIX}/bin/claude + ${INSTALL_SCRIPT} ${WRKDIR}/claude ${STAGEDIR}${PREFIX}/bin/claude .include diff --git a/misc/claude-code/distinfo b/misc/claude-code/distinfo index 35905d779098..d009ac3ef0db 100644 --- a/misc/claude-code/distinfo +++ b/misc/claude-code/distinfo @@ -1,5 +1,5 @@ -TIMESTAMP = 1786085613 -SHA256 (claude-code-2.1.224/linux-x64/claude) = a2b5add7dc4bcd8eaa029f4e8bdac4df7769b4073698db7989d206baf9419c2d -SIZE (claude-code-2.1.224/linux-x64/claude) = 295676936 -SHA256 (claude-code-2.1.224/linux-arm64/claude) = 3e50836e227868746273653e0f8115cf5fc9cb34a081847c6040c81d80812c33 -SIZE (claude-code-2.1.224/linux-arm64/claude) = 292404152 +TIMESTAMP = 1786162396 +SHA256 (claude-code-2.1.225/linux-x64/claude) = 0a3be8d18cb0f5357d38ce2d588601753a60b44cc9c622579ed8b8405dee231e +SIZE (claude-code-2.1.225/linux-x64/claude) = 297831432 +SHA256 (claude-code-2.1.225/linux-arm64/claude) = 209d4279c0a3dbb48bee6017d99430269ec6aba59cd8735b1fda0f9664139a45 +SIZE (claude-code-2.1.225/linux-arm64/claude) = 294566840 diff --git a/misc/claude-code/files/LICENSE b/misc/claude-code/files/LICENSE new file mode 100644 index 000000000000..645a5d67c6d1 --- /dev/null +++ b/misc/claude-code/files/LICENSE @@ -0,0 +1 @@ +© Anthropic PBC. All rights reserved. Use is subject to Anthropic's [Commercial Terms of Service](https://www.anthropic.com/legal/commercial-terms). diff --git a/misc/claude-code/files/claude.in b/misc/claude-code/files/claude.in new file mode 100644 index 000000000000..43a942e006b5 --- /dev/null +++ b/misc/claude-code/files/claude.in @@ -0,0 +1,41 @@ +#!/bin/sh +# +# FreeBSD ports wrapper for Anthropic Claude Code (Linux ELF via Linuxulator) +# + +export DISABLE_AUTOUPDATER=1 +export DISABLE_UPDATES=1 + +# +# Required Linuxulator mounts. Without linrdlnk on fdescfs, Bun resolves cwd +# via open(path, O_PATH) + readlink("/dev/fd/N"), gets EINVAL, and hangs. +# service linux start mounts these correctly; hand-rolled fstab often does not. +# +if [ ! -e /compat/linux/proc/version ]; then + echo "claude: error: linprocfs is not mounted on /compat/linux/proc" >&2 + echo "claude: enable with: sysrc linux_enable=YES && service linux start" >&2 + exit 1 +fi +if [ ! -d /compat/linux/dev/fd ]; then + echo "claude: error: fdescfs is not mounted on /compat/linux/dev/fd" >&2 + echo "claude: enable with: sysrc linux_enable=YES && service linux start" >&2 + exit 1 +fi +if ! [ -L /compat/linux/dev/fd/2 ]; then + echo "claude: error: fdescfs must be mounted with linrdlnk (claude will hang otherwise)" >&2 + echo "claude: /etc/fstab: fdescfs /compat/linux/dev/fd fdescfs rw,linrdlnk 0 0" >&2 + echo "claude: then: umount /compat/linux/dev/fd && mount /compat/linux/dev/fd" >&2 + echo "claude: (or: sysrc linux_enable=YES && service linux start)" >&2 + exit 1 +fi + +# +# Bake-in of: +# alias claude='SHELL=/usr/local/bin/bash bash --noprofile --norc -c claude' +# +# Claude's shell-detection child inherits stdin; bash startup files that read +# fd 0 make the TUI fall through to --print mode (anthropics/claude-code#12507). +# Launch from a clean bash; keep SHELL=bash for the tool runner. +# +export SHELL=%%LOCALBASE%%/bin/bash +exec %%LOCALBASE%%/bin/bash --noprofile --norc -c 'exec "$@"' bash %%PREFIX%%/libexec/claude "$@" diff --git a/misc/claude-code/pkg-message b/misc/claude-code/pkg-message new file mode 100644 index 000000000000..8be99501b098 --- /dev/null +++ b/misc/claude-code/pkg-message @@ -0,0 +1,18 @@ +[ +{ type: install + message: <