GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — operatorlm/build.sh at main · aralde/operatorlm Expand file tree/ Copy pathbuild.shMore file actions 74 lines (65 loc) · 2.64 KB / Copy pathbuild.shFile metadata and controls74 lines (65 loc) · 2.64 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 #!/usr/bin/env bash # Cross-platform build script for operatorlm. # # Detects the target OS/arch (or honours GOOS/GOARCH from the environment) and # builds with the right linker flags. On Windows it forces -H=windowsgui so no # console window appears at launch (logs go to ~/.operatorlm/operatorlm.log via # setupLogging in main.go). On Linux/macOS it produces a normal binary. # # Usage: # ./build.sh # build for the host # GOOS=linux GOARCH=arm64 ./build.sh # cross-compile # GOOS=windows ./build.sh # produces operatorlm.exe # NOTRAY=1 ./build.sh # headless: no tray, no CGO, no GTK set -euo pipefail cd "$(dirname "$0")" target_os="${GOOS:-$(go env GOOS)}" target_arch="${GOARCH:-$(go env GOARCH)}" # -s -w: strip symbol/debug info (smaller binary, fewer AV false positives on # Windows). Applied on every OS — debug symbols aren't needed for releases. ldflags="-s -w" output="operatorlm" case "$target_os" in windows) ldflags="-H=windowsgui $ldflags" output="OperatorLM.exe" ;; linux|darwin) : # CGO is required by getlantern/systray; rely on the toolchain default. ;; *) echo "warning: untested GOOS=$target_os; proceeding with defaults" >&2 ;; esac # Inject the build-time version so the OTA updater can compare against the # latest GitHub release. Honour $VERSION from the environment, otherwise fall # back to `git describe`. An empty result means "dev build" and the updater # will refuse to self-update. version="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || true)}" if [ -n "$version" ]; then ver_flag="-X github.com/aralde/operatorlm/internal/version.Version=$version" if [ -n "$ldflags" ]; then ldflags="$ldflags $ver_flag" else ldflags="$ver_flag" fi fi # getlantern/systray requires CGO on every platform. Headless builds drop the # tray, so they build without CGO into a static binary. tags="" if [ -n "${NOTRAY:-}" ]; then tags="-tags=notray" export CGO_ENABLED="${CGO_ENABLED:-0}" else export CGO_ENABLED="${CGO_ENABLED:-1}" fi echo "Building $output for $target_os/$target_arch (CGO_ENABLED=$CGO_ENABLED, notray=${NOTRAY:-0}, version=${version:-dev})" # -trimpath / -buildvcs=false: strip local paths and VCS stamps so the binary # is reproducible and doesn't leak $HOME — also reduces SmartScreen/Defender # false positives on fresh Go binaries. if [ -n "$ldflags" ]; then GOOS="$target_os" GOARCH="$target_arch" go build $tags -trimpath -buildvcs=false -ldflags="$ldflags" -o "$output" . else GOOS="$target_os" GOARCH="$target_arch" go build $tags -trimpath -buildvcs=false -o "$output" . fi echo "Built $output" |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |