eleven / messenger Public

Clone
git clone https://amadan.net/eleven/messenger

Plain git — no account needed to clone.

Download

Download this file

1#!/usr/bin/env sh
2# Build the linux lchat binary for the router box, stamped with a build id
3# (the git short sha, or $1) so `lchat stage`/`deploy --version` can identify and
4# health-check it. Prints the build id and the output path.
5#
6# ./deploy/build-linux.sh # linux/amd64, id = git short sha
7# ./deploy/build-linux.sh test-scroll # id = test-scroll (e.g. a canary label)
8# ARCH=arm64 ./deploy/build-linux.sh # linux/arm64 (self-hosters on ARM)
9# OS=darwin ARCH=arm64 ./deploy/build-linux.sh # macOS (the `lchat try` download)
10# OUT=/tmp/lchat ./deploy/build-linux.sh
11set -eu
12
13VER="${1:-$(git rev-parse --short HEAD)}"
14if [ -z "$VER" ]; then
15 echo "build-linux: could not determine a build id (pass one as \$1)" >&2
16 exit 1
17fi
18OS="${OS:-linux}"
19ARCH="${ARCH:-amd64}"
20OUT="${OUT:-lchat-$OS-$ARCH}"
21
22GOOS="$OS" GOARCH="$ARCH" CGO_ENABLED=0 \
23 go build -ldflags "-X main.buildVersion=${VER}" -o "$OUT" .
24
25echo "built ${VER} (${OS}/${ARCH}) -> ${OUT}"
26