go-bootstrap.mk 1.7 KB

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