- Binary output changed from 'receiptnext' to 'app' - Release assets renamed to app-linux-amd64 / app-linux-arm64 - install.sh, Makefile, README.md updated to reference 'app' - contrib/receiptnext.service uses /opt/receiptnext/app - Systemd service updated to ExecStart=/opt/receiptnext/app
50 lines
1.3 KiB
Bash
Executable file
50 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
#
|
|
# build-all.sh — Cross-compile ExpenseFlow 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 ExpenseFlow $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/"
|