Add golang-cross

This package is derived from meta-golang:
https://github.com/digitallumens/meta-golang.git
commit 3fa6c8af6b4762de2f4e6740e327a5a71c29e6e1

In the meta-golang version, golang depends on a gcc-cross that causes
conflicts with our toolchain. So the golang-cross recipe was extracted
and then the following changes were made to work in wrlinux:

- our TARGET_ARCH is x86-64, golang-cross wants amd64

- in the former recipe, compile fails because it can't find header files
  and libraries because --sysroot is dropped. So I redefined the target
  cc and target cxx as cc and cxx at the start of the compile rule since
  cc gets redefined in there somewhere.

Signed-off-by: Amy Fong <amy.fong@windriver.com>
This commit is contained in:
Amy Fong 2015-02-27 15:58:44 -05:00 committed by Bruce Ashfield
parent 055742a99e
commit 898e1ecc1e
3 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,4 @@
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81"
SRC_URI[md5sum] = "4b66d7249554181c314f139ea78920b1"
SRC_URI[sha256sum] = "eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ffc35382"

View File

@ -0,0 +1,56 @@
DESCRIPTION = "Go Programming Language Cross Compiler."
HOMEPAGE = "golang.org"
# DEPENDS = "virtual/${TARGET_PREFIX}gcc libgcc"
DEPENDS = "libgcc"
PROVIDES = "virtual/${TARGET_PREFIX}golang"
SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz"
S="${WORKDIR}/go"
do_compile () {
export CC_FOR_TARGET="${CC}"
export CXX_FOR_TARGET="${CXX}"
# the above should set the right sysroot option, else...:
# export CGO_CFLAGS="--sysroot=${STAGING_DIR_HOST}"
# export CGO_LDFLAGS="--sysroot=${STAGING_DIR_HOST}"
export CC="${BUILD_CC}"
export GOROOT_FINAL="${libdir}/go"
export GOARCH="${TARGET_ARCH}"
# supported amd64, 386, arm
if [ "${TARGET_ARCH}" = "x86_64" ]; then
export GOARCH="amd64"
fi
if [ "${TARGET_ARCH}" = "arm" ]
then
if [ `echo ${TUNE_PKGARCH} | cut -c 1-7` = "cortexa" ]
then
echo GOARM 7
export GOARM="7"
fi
fi
export GOOS="linux"
export GO_GCFLAGS=""
export GO_LDFLAGS=""
export GO_CCFLAGS=""
export CGO_ENABLED="1"
#export CC_FOR_TARGET="${TARGET_SYS}-gcc"
#export CXX_FOR_TARGET="${TARGET_SYS}-g++"
echo GOARCH ${GOARCH}
echo CC_FOR_TARGET ${CC_FOR_TARGET}
cd src
sh -x ./make.bash
}
do_install () {
# Install the executables into build system
mkdir -p ${D}${bindir}
cp -a bin/go ${D}${bindir}/
mkdir -p ${D}${libdir}/go
cp -a pkg ${D}${libdir}/go/
cp -a include ${D}${libdir}/go/
cp -a api ${D}${libdir}/go/
cp -a src ${D}${libdir}/go/
}

View File

@ -0,0 +1,3 @@
inherit cross
require golang-cross.inc
require golang-${PV}.inc