From 709f11808401e378229bb36e65597efada7bc6a1 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 6 Feb 2025 12:08:33 +0100 Subject: [PATCH] overlay coreos/config: Fix cross-compilation of docker and docker-cli --- .../coreos/config/env/app-containers/docker | 12 ++++++++++++ .../coreos/config/env/app-containers/docker-cli | 12 ++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker create mode 100644 sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker-cli diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker b/sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker new file mode 100644 index 0000000000..e7ee65aa01 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker @@ -0,0 +1,12 @@ +# Fix cross-compilation by setting up the environment properly. +# +# This is what go-module_src_unpack does, but docker does not use it. +cros_pre_src_unpack_set_build_env() { + if use amd64 || use arm || use arm64 || + ( use ppc64 && [[ $(tc-endian) == "little" ]] ) || use s390 || use x86; then + GOFLAGS="-buildmode=pie ${GOFLAGS}" + fi + GOFLAGS="${GOFLAGS} -p=$(makeopts_jobs)" + + go-env_set_compile_environment +} diff --git a/sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker-cli b/sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker-cli new file mode 100644 index 0000000000..e7ee65aa01 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos/config/env/app-containers/docker-cli @@ -0,0 +1,12 @@ +# Fix cross-compilation by setting up the environment properly. +# +# This is what go-module_src_unpack does, but docker does not use it. +cros_pre_src_unpack_set_build_env() { + if use amd64 || use arm || use arm64 || + ( use ppc64 && [[ $(tc-endian) == "little" ]] ) || use s390 || use x86; then + GOFLAGS="-buildmode=pie ${GOFLAGS}" + fi + GOFLAGS="${GOFLAGS} -p=$(makeopts_jobs)" + + go-env_set_compile_environment +}