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