Browse Source

Merge pull request #7640 from jefferyto/fix-golang-package-clean

golang: fix package clean / autoremove, add output whitespace
lilik-openwrt-22.03
Ted Hess 6 years ago
committed by GitHub
parent
commit
af6e846ef9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      lang/golang/golang-package.mk

+ 13
- 0
lang/golang/golang-package.mk View File

@ -171,6 +171,7 @@ define GoPackage/Build/Configure
mkdir -p $$$$(dirname $$$$dest) ; \ mkdir -p $$$$(dirname $$$$dest) ; \
$(CP) $$$$file $$$$dest ; \ $(CP) $$$$file $$$$dest ; \
done ; \ done ; \
echo ; \
\ \
link_contents() { \ link_contents() { \
local src=$$$$1 ; \ local src=$$$$1 ; \
@ -209,6 +210,7 @@ define GoPackage/Build/Configure
else \ else \
echo "Not building binaries, skipping symlinks" ; \ echo "Not building binaries, skipping symlinks" ; \
fi ; \ fi ; \
echo ; \
) )
endef endef
@ -224,16 +226,21 @@ define GoPackage/Build/Compile
CXX=$(TARGET_CXX) \ CXX=$(TARGET_CXX) \
$(call GoPackage/Environment) ; \ $(call GoPackage/Environment) ; \
\ \
echo "Finding targets" ; \
targets=$$$$(go list $(GO_PKG_BUILD_PKG)) ; \ targets=$$$$(go list $(GO_PKG_BUILD_PKG)) ; \
for pattern in $(GO_PKG_EXCLUDES); do \ for pattern in $(GO_PKG_EXCLUDES); do \
targets=$$$$(echo "$$$$targets" | grep -v "$$$$pattern") ; \ targets=$$$$(echo "$$$$targets" | grep -v "$$$$pattern") ; \
done ; \ done ; \
echo ; \
\ \
if [ "$(GO_PKG_GO_GENERATE)" = 1 ]; then \ if [ "$(GO_PKG_GO_GENERATE)" = 1 ]; then \
echo "Calling go generate" ; \
go generate -v $(1) $$$$targets ; \ go generate -v $(1) $$$$targets ; \
echo ; \
fi ; \ fi ; \
\ \
if [ "$(GO_PKG_SOURCE_ONLY)" != 1 ]; then \ if [ "$(GO_PKG_SOURCE_ONLY)" != 1 ]; then \
echo "Building targets" ; \
case $(GO_ARCH) in \ case $(GO_ARCH) in \
arm) installsuffix="-installsuffix v$(GO_ARM)" ;; \ arm) installsuffix="-installsuffix v$(GO_ARM)" ;; \
mips|mipsle) installsuffix="-installsuffix $(GO_MIPS)" ;; \ mips|mipsle) installsuffix="-installsuffix $(GO_MIPS)" ;; \
@ -250,10 +257,16 @@ define GoPackage/Build/Compile
$(1) \ $(1) \
$$$$targets ; \ $$$$targets ; \
retval=$$$$? ; \ retval=$$$$? ; \
echo ; \
\ \
if [ "$$$$retval" -eq 0 ] && [ -z "$(call GoPackage/has_binaries)" ]; then \ if [ "$$$$retval" -eq 0 ] && [ -z "$(call GoPackage/has_binaries)" ]; then \
echo "No binaries were generated, consider adding GO_PKG_SOURCE_ONLY:=1 to Makefile" ; \ echo "No binaries were generated, consider adding GO_PKG_SOURCE_ONLY:=1 to Makefile" ; \
echo ; \
fi ; \ fi ; \
\
echo "Cleaning module download cache (golang/go#27455)" ; \
go clean -modcache ; \
echo ; \
fi ; \ fi ; \
exit $$$$retval ; \ exit $$$$retval ; \
) )


Loading…
Cancel
Save