Replace the Python bootstrap script with a Go implementation that cross-compiles to native binaries for Linux and macOS on x86_64 and aarch64. The Go port preserves all sections of the original (system packages, optional Flatpak GUI apps, custom downloads, and the macOS firecracker VM bridge) and adds first-class pacman support so the tool works on Arch-family distros alongside Debian, RHEL, and macOS. A Makefile produces a host binary via `make build` and the full four-target matrix under dist/ via `make build-all`.
45 lines
795 B
Makefile
45 lines
795 B
Makefile
BINARY := bootstrap_environment
|
|
DIST := dist
|
|
PKG := .
|
|
|
|
# Statically-linked, stripped binaries for distribution.
|
|
GOFLAGS := -trimpath -ldflags="-s -w"
|
|
|
|
TARGETS := \
|
|
linux/amd64 \
|
|
linux/arm64 \
|
|
darwin/amd64 \
|
|
darwin/arm64
|
|
|
|
.PHONY: all build build-all test vet fmt clean
|
|
|
|
all: build
|
|
|
|
build:
|
|
go build $(GOFLAGS) -o $(BINARY) $(PKG)
|
|
|
|
# Cross-compile native binaries for each supported (OS, arch) pair into dist/.
|
|
build-all: $(DIST)
|
|
@for t in $(TARGETS); do \
|
|
os=$${t%/*}; arch=$${t#*/}; \
|
|
out=$(DIST)/$(BINARY)-$$os-$$arch; \
|
|
echo "==> $$os/$$arch -> $$out"; \
|
|
CGO_ENABLED=0 GOOS=$$os GOARCH=$$arch \
|
|
go build $(GOFLAGS) -o $$out $(PKG) || exit 1; \
|
|
done
|
|
|
|
$(DIST):
|
|
mkdir -p $(DIST)
|
|
|
|
test:
|
|
go test ./...
|
|
|
|
vet:
|
|
go vet ./...
|
|
|
|
fmt:
|
|
gofmt -w .
|
|
|
|
clean:
|
|
rm -rf $(DIST) $(BINARY)
|