From c624e4348d0df7b602319c49c9f601da04f05581 Mon Sep 17 00:00:00 2001 From: ziggie Date: Sat, 24 May 2025 14:50:47 +0200 Subject: [PATCH 1/2] makefile: add lean cross-compile build Different platforms can now be cross-compiled wihtout packing all the source and vendor packages. --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index f068aeae19b..cb4c8506215 100644 --- a/Makefile +++ b/Makefile @@ -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. From c65cf7ffd1a8051ac5eeab5f8e0bd0a05647248c Mon Sep 17 00:00:00 2001 From: ziggie Date: Mon, 26 May 2025 08:38:15 +0200 Subject: [PATCH 2/2] makefile: fix linewrap for make help cmd --- Makefile | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index cb4c8506215..d1aac3279b7 100644 --- a/Makefile +++ b/Makefile @@ -134,9 +134,7 @@ manpages: #? install: Build and install lnd and lncli binaries and place them in $GOPATH/bin. install: install-binaries -#? install-all: Performs all the same tasks as the install command along with generating and -# installing the man pages for the lnd and lncli binaries. This command is useful in an -# environment where a user has root access and so has write access to the man page directory. +#? install-all: Performs all the same tasks as the install command along with generating and installing the man pages for the lnd and lncli binaries. This command is useful in an environment where a user has root access and so has write access to the man page directory. install-all: install manpages #? release-install: Build and install lnd and lncli release binaries, place them in $GOPATH/bin @@ -161,9 +159,7 @@ cross-release-install: 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. +#? 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. release: clean-mobile @$(call print, "Releasing lnd and lncli binaries.") $(VERSION_CHECK)