diff options
| author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-08-07 23:46:58 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-08-07 23:46:58 -0400 |
| commit | 62a39b48a8c48c6eae1ad889c0f7a935221fe010 (patch) | |
| tree | 7782f84ebc19473cd9be9e12c600877c9fee3785 | |
| parent | cbf47a093dc20f0d1a25a3a2d7eec433767b947c (diff) | |
| download | meta-virtualization-62a39b48a8c48c6eae1ad889c0f7a935221fe010.tar.gz | |
go-build: fix build with new go-binary bootstrapped toolchain
We need to be more explicity in our exports and use of 'go' to
build properly with the new binary bootstrapped go toolchain.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
| -rw-r--r-- | recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch | 33 | ||||
| -rw-r--r-- | recipes-devtools/go/go-build_git.bb | 18 |
2 files changed, 49 insertions, 2 deletions
diff --git a/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch b/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch new file mode 100644 index 00000000..36d45b57 --- /dev/null +++ b/recipes-devtools/go/go-build/0001-build-use-instead-of-go.patch | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | From 4db28c98481056c41097f808335c37e8517fe485 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 3 | Date: Fri, 7 Aug 2020 23:39:18 -0400 | ||
| 4 | Subject: [PATCH] build: use instead of 'go' | ||
| 5 | |||
| 6 | While we can get away with 'go' if the host/target arch match, the | ||
| 7 | new go-binary toolchain blows up in a cross compile situation. | ||
| 8 | |||
| 9 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> | ||
| 10 | --- | ||
| 11 | gobuild/Makefile | 4 ++-- | ||
| 12 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/src/import/gobuild/Makefile b/src/import/gobuild/Makefile | ||
| 15 | index 694d9ce..149d573 100644 | ||
| 16 | --- a/src/import/gobuild/Makefile | ||
| 17 | +++ b/src/import/gobuild/Makefile | ||
| 18 | @@ -19,10 +19,10 @@ dep: ${GODEPPATHS} | ||
| 19 | |||
| 20 | ${GODEPPATHS}: | ||
| 21 | mkdir -p ${GOSRC} | ||
| 22 | - GOPATH=${GOPATH} go get $(subst ${GOSRC}/,,$@) | ||
| 23 | + GOPATH=${GOPATH} ${GO} get $(subst ${GOSRC}/,,$@) | ||
| 24 | |||
| 25 | ${BIN}: ${GODEPPATHS} $(filter %/$@.go, ${MAIN}) | ||
| 26 | - GOPATH=${GOPATH} ${ARCH} go build $(filter %/$@.go, ${MAIN}) | ||
| 27 | + GOPATH=${GOPATH} ${ARCH} ${GO} build $(filter %/$@.go, ${MAIN}) | ||
| 28 | |||
| 29 | clean: | ||
| 30 | rm -f ${BIN} | ||
| 31 | -- | ||
| 32 | 2.19.1 | ||
| 33 | |||
diff --git a/recipes-devtools/go/go-build_git.bb b/recipes-devtools/go/go-build_git.bb index e057b6d7..3ac86084 100644 --- a/recipes-devtools/go/go-build_git.bb +++ b/recipes-devtools/go/go-build_git.bb | |||
| @@ -8,6 +8,7 @@ SRCREV_runc = "e4363b038787addfa12e8b0acf5417d4fba01693" | |||
| 8 | SRC_URI = "\ | 8 | SRC_URI = "\ |
| 9 | git://github.com/lf-edge/runx;nobranch=1;name=runx \ | 9 | git://github.com/lf-edge/runx;nobranch=1;name=runx \ |
| 10 | git://github.com/opencontainers/runc.git;nobranch=1;destsuffix=runc;name=runc \ | 10 | git://github.com/opencontainers/runc.git;nobranch=1;destsuffix=runc;name=runc \ |
| 11 | file://0001-build-use-instead-of-go.patch \ | ||
| 11 | " | 12 | " |
| 12 | SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b" | 13 | SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b" |
| 13 | SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769" | 14 | SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769" |
| @@ -34,9 +35,22 @@ do_compile() { | |||
| 34 | export GOARCH="${TARGET_GOARCH}" | 35 | export GOARCH="${TARGET_GOARCH}" |
| 35 | cd ${S}/src/import/gobuild | 36 | cd ${S}/src/import/gobuild |
| 36 | mkdir -p go/src/github.com/opencontainers | 37 | mkdir -p go/src/github.com/opencontainers |
| 37 | ln -s ${WORKDIR}/runc ${S}/src/import/gobuild/go/src/github.com/opencontainers/runc | 38 | ln -sf ${WORKDIR}/runc ${S}/src/import/gobuild/go/src/github.com/opencontainers/runc |
| 38 | export GOPATH="${S}/src/import/gobuild/go/src/github.com/opencontainers/runc" | 39 | export GOPATH="${S}/src/import/gobuild/go/src/github.com/opencontainers/runc" |
| 39 | oe_runmake | 40 | |
| 41 | # Build the target binaries | ||
| 42 | export GOARCH="${TARGET_GOARCH}" | ||
| 43 | # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries | ||
| 44 | export CGO_ENABLED="1" | ||
| 45 | export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 46 | export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}" | ||
| 47 | export CFLAGS="" | ||
| 48 | export LDFLAGS="" | ||
| 49 | export CC="${CC}" | ||
| 50 | export LD="${LD}" | ||
| 51 | export GOBIN="" | ||
| 52 | |||
| 53 | oe_runmake GO=${GO} | ||
| 40 | } | 54 | } |
| 41 | 55 | ||
| 42 | do_install() { | 56 | do_install() { |
