-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-linux.sh
More file actions
33 lines (29 loc) · 1.13 KB
/
Copy pathbuild-linux.sh
File metadata and controls
33 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env bash
#
# Build TetherSSH natively on Linux.
#
# Place this at the repo root (same directory as go.mod and the cli/ folder).
# Run: ./build-linux.sh # build for the host architecture
# STRIP=0 ./build-linux.sh # keep symbols (for debugging / delve)
#
# Build deps (Debian/Ubuntu):
# sudo apt install -y gcc pkg-config libgl1-mesa-dev xorg-dev libxkbcommon-dev
# Fedora: sudo dnf install gcc pkgconf-pkg-config mesa-libGL-devel libXcursor-devel \
# libXrandr-devel libXinerama-devel libXi-devel libxkbcommon-devel
#
# Note: the pty_unix.go / pty_windows.go split is driven by //go:build constraints,
# so GOOS picks the right file automatically. No -tags flag is needed.
set -euo pipefail
cd "$(dirname "$0")"
APP="tetherssh"
OUT="dist/linux"
mkdir -p "$OUT"
LDFLAGS=""
if [ "${STRIP:-1}" = "1" ]; then
LDFLAGS="-s -w" # strip symbol table + DWARF for a smaller release binary
fi
echo ">> building ${APP} for linux/$(go env GOARCH) (CGO on)"
CGO_ENABLED=1 GOOS=linux \
go build -trimpath -ldflags "${LDFLAGS}" -o "${OUT}/${APP}" ./cli
echo ">> done: ${OUT}/${APP}"
ls -lh "${OUT}/${APP}"