go-bootstrap-stage3.mk 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ################################################################################
  2. #
  3. # go-bootstrap-stage3
  4. #
  5. ################################################################################
  6. # Use last Go version that go-bootstrap-stage2 can build: v1.21.x
  7. # See https://go.dev/doc/go1.22#bootstrap
  8. GO_BOOTSTRAP_STAGE3_VERSION = 1.21.8
  9. GO_BOOTSTRAP_STAGE3_SITE = https://storage.googleapis.com/golang
  10. GO_BOOTSTRAP_STAGE3_SOURCE = go$(GO_BOOTSTRAP_STAGE3_VERSION).src.tar.gz
  11. GO_BOOTSTRAP_STAGE3_LICENSE = BSD-3-Clause
  12. GO_BOOTSTRAP_STAGE3_LICENSE_FILES = LICENSE
  13. # Use go-bootstrap-stage2 to bootstrap.
  14. HOST_GO_BOOTSTRAP_STAGE3_DEPENDENCIES = host-go-bootstrap-stage2
  15. HOST_GO_BOOTSTRAP_STAGE3_ROOT = $(HOST_DIR)/lib/go-$(GO_BOOTSTRAP_STAGE3_VERSION)
  16. # The go build system is not compatible with ccache, so use
  17. # HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685.
  18. HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV = \
  19. GO111MODULE=off \
  20. GOCACHE=$(HOST_GO_HOST_CACHE) \
  21. GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_STAGE2_ROOT) \
  22. GOROOT_FINAL=$(HOST_GO_BOOTSTRAP_STAGE3_ROOT) \
  23. GOROOT="$(@D)" \
  24. GOBIN="$(@D)/bin" \
  25. GOOS=linux \
  26. CC=$(HOSTCC_NOCCACHE) \
  27. CXX=$(HOSTCXX_NOCCACHE) \
  28. CGO_ENABLED=0
  29. define HOST_GO_BOOTSTRAP_STAGE3_BUILD_CMDS
  30. cd $(@D)/src && \
  31. $(HOST_GO_BOOTSTRAP_STAGE3_MAKE_ENV) ./make.bash $(if $(VERBOSE),-v)
  32. endef
  33. define HOST_GO_BOOTSTRAP_STAGE3_INSTALL_CMDS
  34. $(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/go
  35. $(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/bin/gofmt
  36. cp -a $(@D)/lib $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/
  37. mkdir -p $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg
  38. cp -a $(@D)/pkg/include $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/
  39. cp -a $(@D)/pkg/tool $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/pkg/
  40. # The Go sources must be installed to the host/ tree for the Go stdlib.
  41. cp -a $(@D)/src $(HOST_GO_BOOTSTRAP_STAGE3_ROOT)/
  42. endef
  43. $(eval $(host-generic-package))