NextReceipt/build-all.sh
cclohmar f0c576c543 feat: transform NextExpense into NextReceipt — receipt saver for warranty & returns
- Replace events+expenses with flat purchases table
- Add warranty_months, return_days, product_name fields
- Remove currency conversion, CSV/PDF reporting, event filing
- Simplify auth (no onboarding/department/profile)
- Update AI extraction prompts for product/warranty info
- Update all branding: templates, install.sh, Makefile, service file
2026-06-21 18:57:29 +00:00

50 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
#
# build-all.sh — Cross-compile NextReceipt for multiple platforms
#
# Prerequisites:
# linux/amd64: gcc (native)
# linux/arm64: gcc-aarch64-linux-gnu (sudo apt install gcc-aarch64-linux-gnu)
# darwin/amd64: o64-clang (via osxcross)
# darwin/arm64: aarch64-apple-darwin-clang (via osxcross)
#
# Usage: ./build-all.sh
# Output: ./dist/app-{platform}
set -euo pipefail
OUTDIR="dist"
mkdir -p "$OUTDIR"
VERSION="${1:-v1.0.0}"
LDFLAGS="-s -w"
echo "==> Building NextReceipt $VERSION"
build() {
local GOOS="$1" GOARCH="$2" CC="$3" SUFFIX="$4"
local OUT="$OUTDIR/app-$SUFFIX"
echo " $SUFFIX ..."
GOOS="$GOOS" GOARCH="$GOARCH" CGO_ENABLED=1 CC="$CC" \
go build -ldflags="$LDFLAGS" -o "$OUT" .
echo " => $(ls -lh "$OUT" | awk '{print $5}')"
}
# linux/amd64 — native
build linux amd64 "gcc" "linux-amd64"
# linux/arm64 — cross
if command -v aarch64-linux-gnu-gcc &>/dev/null; then
build linux arm64 "aarch64-linux-gnu-gcc" "linux-arm64"
fi
# macOS builds — only if osxcross toolchain is available
if command -v o64-clang &>/dev/null; then
build darwin amd64 "o64-clang" "darwin-amd64"
fi
if command -v aarch64-apple-darwin-clang &>/dev/null; then
build darwin arm64 "aarch64-apple-darwin-clang" "darwin-arm64"
fi
echo "==> All builds complete. Output in $OUTDIR/"
ls -lh "$OUTDIR/"