diff options
| -rw-r--r-- | claude-code-bin/README | 52 | ||||
| -rw-r--r-- | claude-code-bin/claude-code-bin.SlackBuild | 214 | ||||
| -rw-r--r-- | claude-code-bin/claude-code-bin.info | 10 | ||||
| -rw-r--r-- | claude-code-bin/slack-desc | 20 |
4 files changed, 296 insertions, 0 deletions
diff --git a/claude-code-bin/README b/claude-code-bin/README new file mode 100644 index 0000000..516a1b1 --- /dev/null +++ b/claude-code-bin/README @@ -0,0 +1,52 @@ +Claude Code is an agentic coding assistant CLI from Anthropic. It can read +your codebase, edit files, run shell commands, manage git, and use Claude AI +to help you write and debug code directly from the terminal. + +This package installs /usr/bin/claude. The binary is a self-contained +executable downloaded at build time from Anthropic's distribution CDN. + +ABOUT THIS PACKAGE + +This claude-code-bin package provides a workaround for the upstream +claude-code package in the SBo development category, which fails to build on +version 2.1.114+. Rather than rebuilding from source, this package downloads +the pre-built binary directly from Anthropic's CDN. + +BUILDING WITH A SPECIFIC VERSION + +By default this SlackBuild downloads the latest released version at build +time. To build a specific version, set VERSION before running the script: + + VERSION=2.1.114 bash claude-code-bin.SlackBuild + +DEPENDENCIES + +Required (standard Slackware): + curl (preferred) or wget — used to download the binary at build time + +Optional: + jq — used to parse manifest.json for the SHA-256 checksum + if not present, a built-in bash fallback is used instead + +NETWORK ACCESS + +This SlackBuild requires outbound HTTPS access to: + https://downloads.claude.ai/claude-code-releases/ + +If you are building in an offline or air-gapped environment this package +cannot be built without modifications. + +SHELL INTEGRATION + +After installing the package, each user who wants shell completions and +the claude startup wrapper should run once (as themselves, not root): + + claude install + +This modifies the user's shell configuration files (~/.bashrc, ~/.zshrc, +etc.) and sets up completions. It does not affect system-wide files. + +AUTHENTICATION + +Claude Code requires an Anthropic API key or a Claude Pro/Max subscription. +Run `claude` after installation to start the authentication flow. diff --git a/claude-code-bin/claude-code-bin.SlackBuild b/claude-code-bin/claude-code-bin.SlackBuild new file mode 100644 index 0000000..7d3e1b4 --- /dev/null +++ b/claude-code-bin/claude-code-bin.SlackBuild @@ -0,0 +1,214 @@ +#!/bin/bash + +# Slackware build script for claude-code-bin + +# Copyright 2026 danix <danix@danix.xyz> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=claude-code-bin +SRCNAM=claude +VERSION=${VERSION:-2.1.114} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" + echo "ERROR: claude-code-bin is not supported on 32-bit x86" >&2 + exit 1 +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" + echo "ERROR: claude-code-bin is not supported on 32-bit x86" >&2 + exit 1 +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" + ARCH_LABEL="x86_64" + PLATFORM="linux-x64" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2" + LIBDIRSUFFIX="64" + ARCH_LABEL="aarch64" + PLATFORM="linux-arm64" +else + echo "ERROR: Unsupported architecture: $ARCH" >&2 + exit 1 +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP + +# Check for required downloader +DOWNLOADER="" +if command -v curl >/dev/null 2>&1; then + DOWNLOADER="curl" +elif command -v wget >/dev/null 2>&1; then + DOWNLOADER="wget" +else + echo "ERROR: curl or wget is required but neither is installed" >&2 + exit 1 +fi + +# Check if jq is available (optional) +HAS_JQ=false +if command -v jq >/dev/null 2>&1; then + HAS_JQ=true +fi + +# Download function that works with both curl and wget +download_file() { + local url="$1" + local output="$2" + + if [ "$DOWNLOADER" = "curl" ]; then + if [ -n "$output" ]; then + curl -fsSL -o "$output" "$url" + else + curl -fsSL "$url" + fi + elif [ "$DOWNLOADER" = "wget" ]; then + if [ -n "$output" ]; then + wget -q -O "$output" "$url" + else + wget -q -O - "$url" + fi + else + return 1 + fi +} + +# Simple JSON parser for extracting checksum when jq is not available +get_checksum_from_manifest() { + local json="$1" + local platform="$2" + + # Normalize JSON to single line and extract checksum + json=$(echo "$json" | tr -d '\n\r\t' | sed 's/ \+/ /g') + + # Extract checksum for platform using bash regex + if [[ $json =~ \"$platform\"[^}]*\"checksum\"[[:space:]]*:[[:space:]]*\"([a-f0-9]{64})\" ]]; then + echo "${BASH_REMATCH[1]}" + return 0 + fi + + return 1 +} + +DOWNLOAD_BASE_URL="https://downloads.claude.ai/claude-code-releases" + +# Resolve version if set to 'latest' +if [ "$VERSION" = "latest" ]; then + echo "Fetching latest version tag..." + RESOLVED_VERSION=$(download_file "$DOWNLOAD_BASE_URL/latest") + if [ -z "$RESOLVED_VERSION" ]; then + echo "ERROR: Could not resolve latest version" >&2 + exit 1 + fi +else + RESOLVED_VERSION="$VERSION" +fi + +echo "Building claude-code-bin version: $RESOLVED_VERSION" + +# Download manifest and extract checksum +echo "Fetching manifest..." +MANIFEST_JSON=$(download_file "$DOWNLOAD_BASE_URL/$RESOLVED_VERSION/manifest.json") + +# Use jq if available, otherwise fall back to pure bash parsing +if [ "$HAS_JQ" = "true" ]; then + CHECKSUM=$(echo "$MANIFEST_JSON" | jq -r ".platforms[\"$PLATFORM\"].checksum // empty") +else + CHECKSUM=$(get_checksum_from_manifest "$MANIFEST_JSON" "$PLATFORM") +fi + +if [ -z "$CHECKSUM" ] || [[ ! "$CHECKSUM" =~ ^[a-f0-9]{64}$ ]]; then + echo "ERROR: Could not get checksum for platform $PLATFORM from manifest" >&2 + exit 1 +fi + +echo "SHA-256 checksum for $PLATFORM: $CHECKSUM" + +# Download and verify binary +BINARY_PATH="$TMP/claude-$RESOLVED_VERSION-$PLATFORM" + +echo "Downloading claude binary..." +if ! download_file "$DOWNLOAD_BASE_URL/$RESOLVED_VERSION/$PLATFORM/claude" "$BINARY_PATH"; then + echo "ERROR: Download failed" >&2 + rm -f "$BINARY_PATH" + exit 1 +fi + +echo "Verifying SHA-256 checksum..." +ACTUAL_CHECKSUM=$(sha256sum "$BINARY_PATH" | cut -d' ' -f1) +if [ "$ACTUAL_CHECKSUM" != "$CHECKSUM" ]; then + echo "ERROR: SHA-256 checksum mismatch" >&2 + echo " Expected: $CHECKSUM" >&2 + echo " Got: $ACTUAL_CHECKSUM" >&2 + rm -f "$BINARY_PATH" + exit 1 +fi + +echo "Checksum verified successfully" + +chmod +x "$BINARY_PATH" + +# Install binary to /usr/bin +mkdir -p $PKG/usr/bin +install -D -m 0755 "$BINARY_PATH" $PKG/usr/bin/claude + +# Copy documentation +mkdir -p $PKG/usr/doc/$PRGNAM-$RESOLVED_VERSION +cat $CWD/README > $PKG/usr/doc/$PRGNAM-$RESOLVED_VERSION/README +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$RESOLVED_VERSION/$PRGNAM.SlackBuild + +# Install slack-desc (doinst.sh is not needed for this package) +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +# Remove downloaded binary +rm -f "$BINARY_PATH" + +# Create the package +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH_LABEL-$BUILD$TAG.$PKGTYPE diff --git a/claude-code-bin/claude-code-bin.info b/claude-code-bin/claude-code-bin.info new file mode 100644 index 0000000..22ea5c8 --- /dev/null +++ b/claude-code-bin/claude-code-bin.info @@ -0,0 +1,10 @@ +PRGNAM="claude-code-bin" +VERSION="2.1.114" +HOMEPAGE="https://claude.ai/code" +DOWNLOAD="UNSUPPORTED" +MD5SUM="" +DOWNLOAD_x86_64="UNSUPPORTED" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="danix" +EMAIL="danix@danix.xyz" diff --git a/claude-code-bin/slack-desc b/claude-code-bin/slack-desc new file mode 100644 index 0000000..0d379b0 --- /dev/null +++ b/claude-code-bin/slack-desc @@ -0,0 +1,20 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one blank line after the base package name's header. + + |-----handy-ruler------------------------------------------------------| +claude-code-bin: claude-code-bin (Anthropic's AI-powered CLI coding assistant) +claude-code-bin: +claude-code-bin: Claude Code is an agentic CLI tool from Anthropic that reads your +claude-code-bin: codebase, edits files, runs commands, and uses AI to help you build +claude-code-bin: and debug software directly from your terminal. +claude-code-bin: +claude-code-bin: Authentication requires an Anthropic API key, Claude Pro/Max plan, +claude-code-bin: or AWS Bedrock / Google Vertex AI credentials. +claude-code-bin: +claude-code-bin: Homepage: https://claude.ai/code +claude-code-bin: License: Proprietary (Anthropic) +claude-code-bin: |
