6b52e83bdc
A two-pane local/remote file browser over SSH, split out of dial so file transfer lives in its own tool. The two share ~/.ssh/config as their base. - internal/sshconf: ~/.ssh/config parsing, for the saved-host list. - internal/sshx: dialling and auth — agent, keys, password, host-key verification, ProxyJump. - internal/vfs: the FS interface both sides are driven through, implemented over the local disk and over SFTP. - internal/xfer: recursive copy engine with progress reporting, cancellation, conflict policy, and resume of partial transfers. - internal/ui: the Fyne GUI — connect window (saved hosts plus quick connect) and the two-pane browser session. Build with `make build`; the Makefile locates the Go toolchain at ~/.local/go, which is deliberately kept off PATH. Cross-compiling needs a per-target C toolchain because Fyne is cgo, so `make dist` builds the native binary only — the alternatives are documented in the Makefile. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
65 lines
2.6 KiB
Makefile
65 lines
2.6 KiB
Makefile
VERSION ?= 0.1.0
|
|
# No -X main.version here: cmd/haul has no version var yet, and a -X against a
|
|
# symbol that doesn't exist is silently a no-op rather than an error.
|
|
LDFLAGS := -s -w
|
|
|
|
# Go is installed at ~/.local/go on this box and deliberately kept off PATH, so
|
|
# prefer that toolchain and fall back to whatever `go` is in PATH elsewhere.
|
|
GO ?= $(shell test -x $(HOME)/.local/go/bin/go && echo $(HOME)/.local/go/bin/go || echo go)
|
|
|
|
.PHONY: build install test vet check run run-xvfb dist clean
|
|
|
|
build: ## Build a native binary into ./bin/haul
|
|
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o bin/haul ./cmd/haul
|
|
|
|
install: ## Install haul into $GOBIN / $GOPATH/bin
|
|
$(GO) install -trimpath -ldflags "$(LDFLAGS)" ./cmd/haul
|
|
|
|
test: ## Run tests
|
|
$(GO) test ./...
|
|
|
|
vet: ## Run go vet
|
|
$(GO) vet ./...
|
|
|
|
# GOOS=js typechecks every package, Fyne API usage included, without needing the
|
|
# cgo/X11 toolchain. It proves nothing about layout or runtime behaviour.
|
|
check: ## Typecheck the whole tree without cgo
|
|
GOOS=js GOARCH=wasm $(GO) build ./...
|
|
|
|
run: build ## Build and run (needs a DISPLAY)
|
|
./bin/haul
|
|
|
|
# This box is headless. Xvfb gives haul a display to render into; software GL
|
|
# because there's no GPU.
|
|
#
|
|
# Cleanup is a trap on a PID held in a shell variable, never a pidfile and never
|
|
# pkill. A pidfile survives Ctrl-C and goes stale, and PIDs get recycled, so a
|
|
# later `kill $(cat .xvfb.pid)` can hit an unrelated process. `pkill -f Xvfb` is
|
|
# worse still: the pattern also matches make's own command line, and this box
|
|
# runs inside tmux, where a stray match can take out the session.
|
|
run-xvfb: build ## Build and run against a virtual X display
|
|
@if [ -e /tmp/.X99-lock ]; then \
|
|
echo "display :99 is already in use — close that first"; exit 1; \
|
|
fi; \
|
|
Xvfb :99 -screen 0 1500x900x24 >/dev/null 2>&1 & \
|
|
xvfb_pid=$$!; \
|
|
trap 'kill $$xvfb_pid 2>/dev/null || true' INT TERM EXIT; \
|
|
sleep 1; \
|
|
DISPLAY=:99 LIBGL_ALWAYS_SOFTWARE=1 ./bin/haul || true
|
|
|
|
# haul is cgo (Fyne needs OpenGL + X11), so `GOOS=windows go build` does NOT
|
|
# work the way it does for dial. Cross-targets need a matching C toolchain:
|
|
# linux/arm64 -> apt install gcc-aarch64-linux-gnu
|
|
# windows/amd64-> apt install gcc-mingw-w64
|
|
# darwin/* -> a Mac, or osxcross
|
|
# Docker is present, so `fyne-cross` is the practical route for the others:
|
|
# go install github.com/fyne-io/fyne-cross@latest
|
|
# fyne-cross windows -arch=amd64
|
|
dist: ## Build the release binary for this host into ./dist
|
|
@mkdir -p dist
|
|
$(GO) build -trimpath -ldflags "$(LDFLAGS)" -o dist/haul-linux-amd64 ./cmd/haul
|
|
@echo "built dist/haul-linux-amd64 (see the Makefile for cross-compiling)"
|
|
|
|
clean: ## Remove build artifacts
|
|
rm -rf bin dist
|