[meta-virtualization] [PATCH V2 1/2] kubernetes: clean up environment settings in do_compile

Bruce Ashfield bruce.ashfield at gmail.com
Mon Aug 12 08:05:16 PDT 2019


staged in master-next for testing.

Bruce

On Tue, Aug 6, 2019 at 9:14 PM Chen Qi <Qi.Chen at windriver.com> wrote:

> There are unnessary and incorrect settings like GOOS and GOROOT.
> There are also redundant settings like GOPATH, CGO_CFLAGS, etc,
> whose latter setting will cover the previous one.
>
> So clean all these up.
>
> Also, remove the comment which suggests settings GOVERSION to "1.10%",
> as it's no longer valid for current OE.
>
> Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
> ---
>  .../kubernetes/kubernetes_git.bb              | 36 +++++++------------
>  1 file changed, 12 insertions(+), 24 deletions(-)
>
> diff --git a/recipes-containers/kubernetes/kubernetes_git.bb
> b/recipes-containers/kubernetes/kubernetes_git.bb
> index 5b4c3a9..0aa7c00 100644
> --- a/recipes-containers/kubernetes/kubernetes_git.bb
> +++ b/recipes-containers/kubernetes/kubernetes_git.bb
> @@ -5,8 +5,6 @@ applications across multiple hosts, providing basic
> mechanisms for deployment, \
>  maintenance, and scaling of applications. \
>  "
>
> -# Note: 1.11+ requires go 1.10.2+, so the following must be set
> -#       in your configuration: GOVERSION = "1.10%"
>  PV = "v1.16.0-alpha+git${SRCREV_kubernetes}"
>  SRCREV_kubernetes = "7054e3ead7e1a00ca6ac3ec47ea355b76061a35a"
>
> @@ -31,39 +29,29 @@ inherit goarch
>  COMPATIBLE_HOST = '(x86_64.*|arm.*|aarch64.*)-linux'
>
>  do_compile() {
> -       export GOARCH="${TARGET_GOARCH}"
> -       export GOOS="${TARGET_GOOS}"
> -       export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
> -       export GOPATH="${S}/src/import:${S}/src/import/vendor"
> -
> -       # Pass the needed cflags/ldflags so that cgo
> -       # can find the needed headers files and libraries
> -       export CGO_ENABLED="1"
> -       export CFLAGS=""
> -       export LDFLAGS=""
> -       export CGO_CFLAGS="${BUILDSDK_CFLAGS}
> --sysroot=${STAGING_DIR_TARGET}"
> -       export CGO_LDFLAGS="${BUILDSDK_LDFLAGS}
> --sysroot=${STAGING_DIR_TARGET}"
> -
>         # link fixups for compilation
>         rm -f ${S}/src/import/vendor/src
>         ln -sf ./ ${S}/src/import/vendor/src
>
>         export
> GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
> -       export
> GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
> -
> -       # Pass the needed cflags/ldflags so that cgo
> -       # can find the needed headers files and libraries
> -       export CGO_ENABLED="1"
> -       export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> -       export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> -
>         cd ${S}/src/import
> +
>         # Build the host tools first, using the host compiler
>         export GOARCH="${BUILD_GOARCH}"
> +       # Pass the needed cflags/ldflags so that cgo can find the needed
> headers files and libraries
> +       export CGO_ENABLED="1"
> +       export CFLAGS=""
> +       export LDFLAGS=""
> +       export CGO_CFLAGS="${BUILDSDK_CFLAGS}
> --sysroot=${STAGING_DIR_TARGET}"
> +       export CGO_LDFLAGS="${BUILDSDK_LDFLAGS}
> --sysroot=${STAGING_DIR_TARGET}"
>         make generated_files
> KUBE_BUILD_PLATFORMS="${HOST_GOOS}/${BUILD_GOARCH}"
>
> -       # Reset GOARCH to the target one
> +       # Build the target binaries
>         export GOARCH="${TARGET_GOARCH}"
> +       # Pass the needed cflags/ldflags so that cgo can find the needed
> headers files and libraries
> +       export CGO_ENABLED="1"
> +       export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
> +       export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
>         # to limit what is built, use 'WHAT', i.e. make WHAT=cmd/kubelet
>         make cross KUBE_BUILD_PLATFORMS=${GOOS}/${GOARCH}
>  }
> --
> 2.17.1
>
> --
> _______________________________________________
> meta-virtualization mailing list
> meta-virtualization at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-virtualization
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await thee
at its end
- "Use the force Harry" - Gandalf, Star Trek II
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/meta-virtualization/attachments/20190812/f9f05ab4/attachment-0001.html>


More information about the meta-virtualization mailing list