go-bootstrap.mk 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. ################################################################################
  2. #
  3. # go-bootstrap
  4. #
  5. ################################################################################
  6. GO_BOOTSTRAP_VERSION = 1.4.3
  7. GO_BOOTSTRAP_SITE = https://storage.googleapis.com/golang
  8. GO_BOOTSTRAP_SOURCE = go$(GO_BOOTSTRAP_VERSION).src.tar.gz
  9. GO_BOOTSTRAP_LICENSE = BSD-3-Clause
  10. GO_BOOTSTRAP_LICENSE_FILES = LICENSE
  11. # To build programs that need cgo support the toolchain needs to be
  12. # available, so the toolchain is not needed to build host-go-bootstrap
  13. # itself, but needed by other packages that depend on
  14. # host-go-bootstrap.
  15. HOST_GO_BOOTSTRAP_DEPENDENCIES = toolchain
  16. HOST_GO_BOOTSTRAP_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_VERSION)
  17. # The go build system is not compatable with ccache, so use HOSTCC_NOCCACHE
  18. # here. See https://github.com/golang/go/issues/11685.
  19. HOST_GO_BOOTSTRAP_MAKE_ENV = \
  20. GOOS=linux \
  21. GOROOT_FINAL="$(HOST_GO_BOOTSTRAP_ROOT)" \
  22. GOROOT="$(@D)" \
  23. GOBIN="$(@D)/bin" \
  24. CC=$(HOSTCC_NOCCACHE) \
  25. CGO_ENABLED=0
  26. define HOST_GO_BOOTSTRAP_BUILD_CMDS
  27. cd $(@D)/src && $(HOST_GO_BOOTSTRAP_MAKE_ENV) ./make.bash
  28. endef
  29. define HOST_GO_BOOTSTRAP_INSTALL_CMDS
  30. $(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_ROOT)/bin/go
  31. $(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_ROOT)/bin/gofmt
  32. cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_ROOT)/
  33. cp -a $(@D)/pkg $(HOST_GO_BOOTSTRAP_ROOT)/
  34. # There is a known issue which requires the go sources to be installed
  35. # https://golang.org/issue/2775
  36. cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_ROOT)/
  37. endef
  38. $(eval $(host-generic-package))