diff options
Diffstat (limited to 'recipes-devtools/go-cross/go-cross-1.3_1.3.bb')
| -rw-r--r-- | recipes-devtools/go-cross/go-cross-1.3_1.3.bb | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/recipes-devtools/go-cross/go-cross-1.3_1.3.bb b/recipes-devtools/go-cross/go-cross-1.3_1.3.bb new file mode 100644 index 00000000..775e28f3 --- /dev/null +++ b/recipes-devtools/go-cross/go-cross-1.3_1.3.bb | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | DESCRIPTION = "\ | ||
| 2 | Go is an open source programming language that makes it easy to build simple, \ | ||
| 3 | reliable, and efficient software. \ | ||
| 4 | " | ||
| 5 | HOMEPAGE = "https://golang.org/" | ||
| 6 | LICENSE = "BSD-3-Clause" | ||
| 7 | |||
| 8 | DEPENDS = "virtual/${TARGET_PREFIX}gcc" | ||
| 9 | |||
| 10 | SRC_URI = "http://golang.org/dl/go${PV}.src.tar.gz" | ||
| 11 | |||
| 12 | S = "${WORKDIR}/go/" | ||
| 13 | |||
| 14 | inherit cross | ||
| 15 | |||
| 16 | LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" | ||
| 17 | SRC_URI[md5sum] = "4b66d7249554181c314f139ea78920b1" | ||
| 18 | SRC_URI[sha256sum] = "eb983e6c5b2b9838f482c5442b1ac1856f610f2b21f3c123b3fedb48ffc35382" | ||
| 19 | |||
| 20 | SRC_URI += "\ | ||
| 21 | file://bsd_svid_source.patch \ | ||
| 22 | file://ccache.patch \ | ||
| 23 | file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \ | ||
| 24 | " | ||
| 25 | |||
| 26 | do_compile() { | ||
| 27 | ## Setting `$GOBIN` doesn't do any good, looks like it ends up copying binaries there. | ||
| 28 | export GOROOT_FINAL="${SYSROOT}${libdir}/go-1.3" | ||
| 29 | |||
| 30 | export GOHOSTOS="linux" | ||
| 31 | export GOOS="linux" | ||
| 32 | |||
| 33 | export GOARCH="${TARGET_ARCH}" | ||
| 34 | # golang only support 386, amd64 and arm architecture. | ||
| 35 | if [ "${TARGET_ARCH}" = "x86_64" ]; then | ||
| 36 | export GOARCH="amd64" | ||
| 37 | elif [ "${TARGET_ARCH}" = "i586" ]; then | ||
| 38 | export GOARCH="386" | ||
| 39 | fi | ||
| 40 | if [ "${TARGET_ARCH}" = "arm" ] | ||
| 41 | then | ||
| 42 | if [ `echo ${TUNE_PKGARCH} | cut -c 1-7` = "cortexa" ] | ||
| 43 | then | ||
| 44 | echo GOARM 7 | ||
| 45 | export GOARM="7" | ||
| 46 | fi | ||
| 47 | fi | ||
| 48 | |||
| 49 | export CGO_ENABLED="1" | ||
| 50 | ## TODO: consider setting GO_EXTLINK_ENABLED | ||
| 51 | |||
| 52 | export CC="${BUILD_CC}" | ||
| 53 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
| 54 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
| 55 | export GO_CCFLAGS="${HOST_CFLAGS}" | ||
| 56 | export GO_LDFLAGS="${HOST_LDFLAGS}" | ||
| 57 | |||
| 58 | cd src && ./make.bash | ||
| 59 | } | ||
| 60 | |||
| 61 | do_install() { | ||
| 62 | ## It should be okay to ignore `${WORKDIR}/go/bin/linux_arm`... | ||
| 63 | ## Also `gofmt` is not needed right now. | ||
| 64 | install -d "${D}${bindir}/go-1.3" | ||
| 65 | install -m 0755 "${WORKDIR}/go/bin/go" "${D}${bindir}/go-1.3/" | ||
| 66 | install -d "${D}${libdir}/go-1.3" | ||
| 67 | |||
| 68 | ## TODO: use `install` instead of `cp` | ||
| 69 | for dir in include lib pkg src test | ||
| 70 | do cp -a "${WORKDIR}/go/${dir}" "${D}${libdir}/go-1.3/" | ||
| 71 | done | ||
| 72 | } | ||
