makefile: add lean cross-compile build

Different platforms can now be cross-compiled wihtout packing
all the source and vendor packages.
This commit is contained in:
ziggie
2025-05-24 14:50:47 +02:00
parent c52a6ddeb8
commit c624e4348d

View File

@ -145,6 +145,22 @@ release-install:
env CGO_ENABLED=0 $(GOINSTALL) -v -trimpath -ldflags="$(RELEASE_LDFLAGS)" -tags="$(RELEASE_TAGS)" $(PKG)/cmd/lnd
env CGO_ENABLED=0 $(GOINSTALL) -v -trimpath -ldflags="$(RELEASE_LDFLAGS)" -tags="$(RELEASE_TAGS)" $(PKG)/cmd/lncli
#? cross-release-install: Build lnd and lncli release binaries for single/all supported platforms to /tmp (useful for checking cross compilation or priming release build cache).
cross-release-install:
@$(call print, "Cross compiling release lnd and lncli.")
for sys in $(BUILD_SYSTEM); do \
echo "Building lnd and lncli for $$sys"; \
export CGO_ENABLED=0 GOOS=$$(echo $$sys | cut -d- -f1) GOARCH=$$(echo $$sys | cut -d- -f2); \
if [ "$$GOARCH" = "armv6" ]; then \
export GOARCH=arm; GOARM=6; \
elif [ "$$GOARCH" = "armv7" ]; then \
export GOARCH=arm; GOARM=7; \
fi; \
$(GOBUILD) -trimpath -ldflags="$(RELEASE_LDFLAGS)" -tags="$(RELEASE_TAGS)" -o /tmp/lnd-$$sys $(PKG)/cmd/lnd; \
$(GOBUILD) -trimpath -ldflags="$(RELEASE_LDFLAGS)" -tags="$(RELEASE_TAGS)" -o /tmp/lncli-$$sys $(PKG)/cmd/lncli; \
echo; \
done
#? release: Build the full set of reproducible release binaries for all supported platforms
# Make sure the generated mobile RPC stubs don't influence our vendor package
# by removing them first in the clean-mobile target.