app-emulation/amazon-ssm-agent: cross-compile and use correct go version

The ebuild was missing a call to go_export() which exports GOARCH, and so was
always built for host architecture. While COREOS_GO_VERSION was specified as
go1.12, src_compile() has to use '${EGO}' to make use of it, so we were
building with go1.16 (latest).  Upstream builds with 1.12 for this version, so
we will do the same.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2021-08-03 12:31:11 +00:00
parent ba7b460518
commit 0875344378

View File

@ -28,23 +28,25 @@ src_prepare() {
}
src_compile() {
go_export
# this is replication of commands from the vendor makefile
# but without network activity during build phase
local GO_LDFLAGS="-s -w -extldflags=-Wl,-z,now,-z,relro,-z,defs"
export GOPATH="${WORKDIR}/${PN}-${PV}"
export GO111MODULE="off"
# set agent release version
BRAZIL_PACKAGE_VERSION=${PV} go run ./agent/version/versiongenerator/version-gen.go
BRAZIL_PACKAGE_VERSION=${PV} ${EGO} run ./agent/version/versiongenerator/version-gen.go
# build all the tools
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/amazon-ssm-agent ./agent || die
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/ssm-cli ./agent/cli-main || die
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/ssm-document-worker ./agent/framework/processor/executer/outofproc/worker || die
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/ssm-session-logger ./agent/session/logging || die
go build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
${EGO} build -v -ldflags "${GO_LDFLAGS}" -buildmode=pie \
-o bin/ssm-session-worker ./agent/framework/processor/executer/outofproc/sessionworker || die
}