Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion recipes-devtools/go/go.inc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,15 @@ setup_go_arch() {
}

setup_cgo_gcc_wrapper() {
sdkpathnative=${7:-${SDKPATHNATIVE}}
bindir=${5:-${bindir_nativesdk}}

# Is there a bug in the cross-compiler support for CGO? Can't get it
# to work without this wrapper
for t in gcc g++ ; do
cat > ${WORKDIR}/${TARGET_PREFIX}${t} <<EOT
#!/bin/sh
exec ${TARGET_PREFIX}${t} ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET} "\$@"
exec ${STAGING_BINDIR_TOOLCHAIN}/${TARGET_PREFIX}${t} ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET} "\$@"
EOT
chmod +x ${WORKDIR}/${TARGET_PREFIX}${t}
done
Expand Down
9 changes: 7 additions & 2 deletions recipes-devtools/go/go_1.6.3.bb
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
require go_${PV}.inc

PR = "r5"

PN_class-native = "go-native"
PN_class-cross = "go-cross"

Expand All @@ -18,11 +20,13 @@ do_compile() {

setup_cgo_gcc_wrapper

## Add WORKDIR to path.
export PATH="${WORKDIR}/:$PATH"
## TODO: consider setting GO_EXTLINK_ENABLED
export CGO_ENABLED="${GO_CROSS_CGO_ENABLED}"
export CC=${BUILD_CC}
export CC_FOR_TARGET="${WORKDIR}/${TARGET_PREFIX}gcc"
export CXX_FOR_TARGET="${WORKDIR}/${TARGET_PREFIX}g++"
export CC_FOR_TARGET="${TARGET_PREFIX}gcc"
export CXX_FOR_TARGET="${TARGET_PREFIX}g++"
export GO_GCFLAGS="${HOST_CFLAGS}"
export GO_LDFLAGS="${HOST_LDFLAGS}"

Expand All @@ -34,6 +38,7 @@ do_compile() {
}

go_install() {

install -d "${D}${bindir}" "${D}${GOROOT_FINAL}"
tar -C "${WORKDIR}/go-${PV}/go" -cf - bin lib src pkg test |
tar -C "${D}${GOROOT_FINAL}" -xf -
Expand Down