Compile/Test static binaries, for better portability
This commit is contained in:
11
Makefile
11
Makefile
@@ -15,13 +15,22 @@ FRONTEND_WEB_SRC := $(shell find cmd/frontend/web/src -type f 2>/dev/null) \
|
|||||||
FRONTEND_WEB_DIST := cmd/frontend/web/dist/index.html
|
FRONTEND_WEB_DIST := cmd/frontend/web/dist/index.html
|
||||||
|
|
||||||
NATIVE_ARCH := $(shell go env GOARCH)
|
NATIVE_ARCH := $(shell go env GOARCH)
|
||||||
VERSION := 0.9.1
|
VERSION := 0.9.2
|
||||||
COMMIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
COMMIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||||
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
||||||
LDFLAGS := -X '$(MODULE)/cmd.version=$(VERSION)' \
|
LDFLAGS := -X '$(MODULE)/cmd.version=$(VERSION)' \
|
||||||
-X '$(MODULE)/cmd.commit=$(COMMIT_HASH)' \
|
-X '$(MODULE)/cmd.commit=$(COMMIT_HASH)' \
|
||||||
-X '$(MODULE)/cmd.date=$(DATE)'
|
-X '$(MODULE)/cmd.date=$(DATE)'
|
||||||
|
|
||||||
|
# CGO_ENABLED=0 produces fully static binaries: no libc dependency, so the
|
||||||
|
# debian package runs on any Linux-amd64/arm64 host regardless of glibc
|
||||||
|
# version (or musl). The only behavioural change is that Go's net package
|
||||||
|
# uses the pure-Go resolver instead of libc's getaddrinfo, which skips
|
||||||
|
# /etc/nsswitch.conf and NSS modules — fine for DNS-only lookups, which is
|
||||||
|
# all maglevd does. govpp has no cgo (its binapi is hand-marshalled Go
|
||||||
|
# structs) so this has no effect on multi-VPP-version compatibility.
|
||||||
|
export CGO_ENABLED := 0
|
||||||
|
|
||||||
TEST ?= tests/
|
TEST ?= tests/
|
||||||
|
|
||||||
VPP_API_DIR ?= $(HOME)/src/vpp/build-root/install-vpp_debug-native/vpp/share/vpp/api
|
VPP_API_DIR ?= $(HOME)/src/vpp/build-root/install-vpp_debug-native/vpp/share/vpp/api
|
||||||
|
|||||||
Reference in New Issue
Block a user