feat: add ARM64 (aarch64) architecture support for builds and packages
Some checks failed
CI/CD / lint (push) Successful in 46s
CI/CD / test (push) Successful in 1m3s
CI/CD / typecheck (push) Has started running
CI/CD / smoke (push) Has been cancelled
CI/CD / build (amd64) (push) Has been cancelled
CI/CD / build (arm64) (push) Has been cancelled
CI/CD / publish-rpm (amd64) (push) Has been cancelled
CI/CD / publish-rpm (arm64) (push) Has been cancelled
CI/CD / publish-deb (amd64) (push) Has been cancelled
CI/CD / publish-deb (arm64) (push) Has been cancelled
Some checks failed
CI/CD / lint (push) Successful in 46s
CI/CD / test (push) Successful in 1m3s
CI/CD / typecheck (push) Has started running
CI/CD / smoke (push) Has been cancelled
CI/CD / build (amd64) (push) Has been cancelled
CI/CD / build (arm64) (push) Has been cancelled
CI/CD / publish-rpm (amd64) (push) Has been cancelled
CI/CD / publish-rpm (arm64) (push) Has been cancelled
CI/CD / publish-deb (amd64) (push) Has been cancelled
CI/CD / publish-deb (arm64) (push) Has been cancelled
Add cross-architecture build support so the project can be developed on ARM64 (Fedora aarch64 laptop) while still producing amd64 packages for production. All build, package, publish, and install scripts are now architecture-aware via shared arch-helper.sh detection. - Add scripts/arch-helper.sh for shared architecture detection - CI builds both amd64 and arm64 in matrix strategy - nfpm.yaml uses NFPM_ARCH env var instead of hardcoded amd64 - Build scripts support MCPCTL_TARGET_ARCH for cross-compilation - installlocal.sh auto-detects RPM/DEB and filters by architecture - release.sh gains --both-arches flag for dual-arch releases - Package cleanup is arch-scoped (won't clobber other arch's packages) - build-mcpd.sh supports --platform and --multi-arch flags - Add pnpm scripts: rpm:build:amd64, deb:build:arm64, release:both - Conditional rpm/dpkg-deb checks for cross-distro compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,14 @@ fi
|
||||
# Ensure tools are on PATH
|
||||
export PATH="$HOME/.npm-global/bin:$HOME/.bun/bin:$HOME/.local/bin:$PATH"
|
||||
|
||||
# Architecture detection / cross-compilation support
|
||||
# MCPCTL_TARGET_ARCH overrides native detection (e.g. "amd64" or "arm64")
|
||||
source "$SCRIPT_DIR/arch-helper.sh"
|
||||
resolve_arch "${MCPCTL_TARGET_ARCH:-}"
|
||||
# Sets: NFPM_ARCH, BUN_TARGET, ARCH_SUFFIX
|
||||
|
||||
# Check if binaries already exist (build-rpm.sh may have been run first)
|
||||
if [ ! -f dist/mcpctl ] || [ ! -f dist/mcpctl-local ]; then
|
||||
if [ ! -f "dist/mcpctl${ARCH_SUFFIX}" ] || [ ! -f "dist/mcpctl-local${ARCH_SUFFIX}" ]; then
|
||||
echo "==> Binaries not found, building from scratch..."
|
||||
echo ""
|
||||
|
||||
@@ -28,7 +34,7 @@ if [ ! -f dist/mcpctl ] || [ ! -f dist/mcpctl-local ]; then
|
||||
echo "==> Generating shell completions..."
|
||||
pnpm completions:generate
|
||||
|
||||
echo "==> Bundling standalone binaries..."
|
||||
echo "==> Bundling standalone binaries (target: ${NFPM_ARCH})..."
|
||||
mkdir -p dist
|
||||
|
||||
# Ink optionally imports react-devtools-core which isn't installed.
|
||||
@@ -37,17 +43,28 @@ if [ ! -f dist/mcpctl ] || [ ! -f dist/mcpctl-local ]; then
|
||||
ln -s ../src/cli/stubs/react-devtools-core node_modules/react-devtools-core
|
||||
fi
|
||||
|
||||
bun build src/cli/src/index.ts --compile --outfile dist/mcpctl
|
||||
bun build src/mcplocal/src/main.ts --compile --outfile dist/mcpctl-local
|
||||
bun build src/cli/src/index.ts --compile ${BUN_TARGET:+--target "$BUN_TARGET"} --outfile "dist/mcpctl${ARCH_SUFFIX}"
|
||||
bun build src/mcplocal/src/main.ts --compile ${BUN_TARGET:+--target "$BUN_TARGET"} --outfile "dist/mcpctl-local${ARCH_SUFFIX}"
|
||||
else
|
||||
echo "==> Using existing binaries in dist/"
|
||||
fi
|
||||
|
||||
echo "==> Packaging DEB..."
|
||||
rm -f dist/mcpctl-*.deb dist/mcpctl_*.deb
|
||||
# If cross-compiling, copy arch-suffixed binaries to the names nfpm expects
|
||||
if [ -n "$ARCH_SUFFIX" ]; then
|
||||
cp "dist/mcpctl${ARCH_SUFFIX}" dist/mcpctl
|
||||
cp "dist/mcpctl-local${ARCH_SUFFIX}" dist/mcpctl-local
|
||||
fi
|
||||
|
||||
echo "==> Packaging DEB (arch: ${NFPM_ARCH})..."
|
||||
# Only remove DEBs for the target arch (preserve cross-compiled packages)
|
||||
ls dist/mcpctl*_${NFPM_ARCH}.deb 2>/dev/null | xargs -r rm -f
|
||||
export NFPM_ARCH
|
||||
nfpm pkg --packager deb --target dist/
|
||||
|
||||
DEB_FILE=$(ls dist/mcpctl*.deb 2>/dev/null | head -1)
|
||||
DEB_FILE=$(ls dist/mcpctl*.deb 2>/dev/null | grep -E "[._]${NFPM_ARCH}[._]" | head -1)
|
||||
echo "==> Built: $DEB_FILE"
|
||||
echo " Size: $(du -h "$DEB_FILE" | cut -f1)"
|
||||
dpkg-deb --info "$DEB_FILE" 2>/dev/null || true
|
||||
# dpkg-deb may not be available on RPM-based systems (Fedora)
|
||||
if command -v dpkg-deb &>/dev/null; then
|
||||
dpkg-deb --info "$DEB_FILE" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user