diff options
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/go/go-1.8.inc | 1 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch | 21 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-cross.inc | 61 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-cross_1.8.bb | 5 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-runtime.inc | 58 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go-runtime_1.8.bb | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/go/go.inc | 68 |
7 files changed, 155 insertions, 61 deletions
diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc index bfb26de01d..2920d06f60 100644 --- a/meta/recipes-devtools/go/go-1.8.inc +++ b/meta/recipes-devtools/go/go-1.8.inc | |||
@@ -14,6 +14,7 @@ SRC_URI += "\ | |||
14 | file://fix-cc-handling.patch \ | 14 | file://fix-cc-handling.patch \ |
15 | file://split-host-and-target-build.patch \ | 15 | file://split-host-and-target-build.patch \ |
16 | file://gotooldir.patch \ | 16 | file://gotooldir.patch \ |
17 | file://make-goroot-precious.patch \ | ||
17 | " | 18 | " |
18 | SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e" | 19 | SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e" |
19 | SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6" | 20 | SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6" |
diff --git a/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch b/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch new file mode 100644 index 0000000000..28a7a34773 --- /dev/null +++ b/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch | |||
@@ -0,0 +1,21 @@ | |||
1 | Prevent GOROOT-resident packages from being rebuilt | ||
2 | |||
3 | Signed-off-by: Matt Madison <matt@madison.systems> | ||
4 | Upstream-Status: Pending | ||
5 | |||
6 | --- go.orig/src/cmd/go/pkg.go | ||
7 | +++ go/src/cmd/go/pkg.go | ||
8 | @@ -1496,6 +1496,13 @@ func isStale(p *Package) (bool, string) | ||
9 | return true, "build ID mismatch" | ||
10 | } | ||
11 | |||
12 | + // For OE builds, make anything in GOROOT non-stale, | ||
13 | + // to prevent a package build from overwriting the | ||
14 | + // build root. | ||
15 | + if p.Goroot && os.Getenv("GOROOT_OVERRIDE") != "1" { | ||
16 | + return false, "GOROOT-resident packages do not get rebuilt" | ||
17 | + } | ||
18 | + | ||
19 | // Package is stale if a dependency is. | ||
20 | for _, p1 := range p.deps { | ||
21 | if p1.Stale { | ||
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc index 1c2d9e3a3d..df3e4ea914 100644 --- a/meta/recipes-devtools/go/go-cross.inc +++ b/meta/recipes-devtools/go/go-cross.inc | |||
@@ -1,15 +1,60 @@ | |||
1 | inherit cross | 1 | inherit cross |
2 | 2 | ||
3 | DEPENDS += "gcc-cross-${TARGET_ARCH}" | 3 | PROVIDES = "virtual/${TARGET_PREFIX}go" |
4 | DEPENDS += "go-native" | ||
4 | 5 | ||
5 | PN = "go-cross-${TARGET_ARCH}" | 6 | PN = "go-cross-${TARGET_ARCH}" |
6 | 7 | ||
7 | # Ignore how TARGET_ARCH is computed. | 8 | export GOHOSTOS = "${BUILD_GOOS}" |
8 | TARGET_ARCH[vardepvalue] = "${TARGET_ARCH}" | 9 | export GOHOSTARCH = "${BUILD_GOARCH}" |
9 | # Ignore target os libc for cross compiler | 10 | export GOOS = "${TARGET_GOOS}" |
10 | #TARGET_OS[vardepexclude] = "LIBCEXTENSION" | 11 | export GOARCH = "${TARGET_GOARCH}" |
11 | FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:" | 12 | export GOARM = "${TARGET_GOARM}" |
13 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
14 | export GOROOT_FINAL = "${libdir}/go" | ||
15 | export CGO_ENABLED = "1" | ||
16 | export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
17 | export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" | ||
18 | CC = "${@d.getVar('BUILD_CC', True).strip()}" | ||
12 | 19 | ||
13 | GOROOT_FINAL = "${libdir}/go" | 20 | do_configure[noexec] = "1" |
14 | export GOROOT_FINAL | ||
15 | 21 | ||
22 | do_compile() { | ||
23 | export GOBIN="${B}/bin" | ||
24 | rm -rf ${GOBIN} ${B}/pkg | ||
25 | mkdir ${GOBIN} | ||
26 | cd src | ||
27 | ./make.bash --host-only | ||
28 | cd ${B} | ||
29 | } | ||
30 | |||
31 | |||
32 | make_wrapper() { | ||
33 | rm -f ${D}${bindir}/$2 | ||
34 | cat <<END >${D}${bindir}/$2 | ||
35 | #!/bin/bash | ||
36 | here=\`dirname \$0\` | ||
37 | export GOARCH="${TARGET_GOARCH}" | ||
38 | export GOOS="${TARGET_GOOS}" | ||
39 | export GOARM="${TARGET_GOARM}" | ||
40 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" | ||
41 | END | ||
42 | chmod +x ${D}${bindir}/$2 | ||
43 | } | ||
44 | |||
45 | do_install() { | ||
46 | install -d ${D}${libdir}/go | ||
47 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ | ||
48 | install -d ${D}${libdir}/go/src | ||
49 | (cd ${S}/src; for d in *; do \ | ||
50 | [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ | ||
51 | done) | ||
52 | |||
53 | install -d ${D}${bindir} ${D}${libdir}/go/bin | ||
54 | for f in ${B}/bin/* | ||
55 | do | ||
56 | base=`basename $f` | ||
57 | install -m755 $f ${D}${libdir}/go/bin | ||
58 | make_wrapper $base ${TARGET_PREFIX}$base | ||
59 | done | ||
60 | } | ||
diff --git a/meta/recipes-devtools/go/go-cross_1.8.bb b/meta/recipes-devtools/go/go-cross_1.8.bb index 56ee084b10..80b5a03f6c 100644 --- a/meta/recipes-devtools/go/go-cross_1.8.bb +++ b/meta/recipes-devtools/go/go-cross_1.8.bb | |||
@@ -1,5 +1,2 @@ | |||
1 | require go-cross.inc | 1 | require go-cross.inc |
2 | require go_${PV}.bb | 2 | require go-${PV}.inc |
3 | |||
4 | # Go binaries are not understood by the strip tool. | ||
5 | INHIBIT_SYSROOT_STRIP = "1" | ||
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc new file mode 100644 index 0000000000..e3eddda837 --- /dev/null +++ b/meta/recipes-devtools/go/go-runtime.inc | |||
@@ -0,0 +1,58 @@ | |||
1 | DEPENDS = "virtual/${TARGET_PREFIX}go go-native" | ||
2 | PROVIDES = "virtual/${TARGET_PREFIX}go-runtime" | ||
3 | |||
4 | export GOHOSTOS = "${BUILD_GOOS}" | ||
5 | export GOHOSTARCH = "${BUILD_GOARCH}" | ||
6 | export GOOS = "${TARGET_GOOS}" | ||
7 | export GOARCH = "${TARGET_GOARCH}" | ||
8 | export GOARM = "${TARGET_GOARM}" | ||
9 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" | ||
10 | export GOROOT_FINAL = "${libdir}/go" | ||
11 | export GO_TARGET_INSTALL = "std" | ||
12 | export CGO_ENABLED = "1" | ||
13 | export CC_FOR_TARGET="${CC}" | ||
14 | export CXX_FOR_TARGET="${CXX}" | ||
15 | export GOROOT_OVERRIDE = "1" | ||
16 | |||
17 | do_configure[noexec] = "1" | ||
18 | |||
19 | do_compile() { | ||
20 | export GOBIN="${B}/bin" | ||
21 | export CC="${@d.getVar('BUILD_CC').strip()}" | ||
22 | rm -rf ${GOBIN} ${B}/pkg | ||
23 | mkdir ${GOBIN} | ||
24 | cd src | ||
25 | GO_FLAGS="" ./make.bash | ||
26 | cd ${B} | ||
27 | } | ||
28 | |||
29 | do_install() { | ||
30 | install -d ${D}${libdir}/go/src | ||
31 | cp --preserve=mode,timestamps -R ${B}/pkg ${D}${libdir}/go/ | ||
32 | if [ "${BUILD_GOTUPLE}" != "${TARGET_GOTUPLE}" ]; then | ||
33 | rm -rf ${D}${libdir}/go/pkg/${BUILD_GOTUPLE} | ||
34 | rm -rf ${D}${libdir}/go/pkg/obj/${BUILD_GOTUPLE} | ||
35 | fi | ||
36 | rm -rf ${D}${libdir}/go/pkg/tool | ||
37 | rm -rf ${D}${libdir}/go/pkg/obj | ||
38 | rm -rf ${D}${libdir}/go/pkg/bootstrap | ||
39 | find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do | ||
40 | [ "$srcdir" = "./cmd" ] || cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/ | ||
41 | done | ||
42 | } | ||
43 | |||
44 | # These testdata directories aren't needed for builds and contain binaries | ||
45 | # that can cause errors in sysroot_strip(), so just remove them. | ||
46 | sysroot_stage_all_append() { | ||
47 | find ${SYSROOT_DESTDIR}${libdir}/go/src -depth -type d -name 'testdata' -exec rm -rf {} \; | ||
48 | } | ||
49 | |||
50 | ALLOW_EMPTY_${PN} = "1" | ||
51 | FILES_${PN}-dev = "${libdir}/go/src ${libdir}/go/pkg/include" | ||
52 | FILES_${PN}-staticdev = "${libdir}/go/pkg/${TARGET_GOTUPLE} ${libdir}/go/pkg/${TARGET_GOTUPLE}" | ||
53 | # The testdata directories in the source tree include some binaries for various | ||
54 | # architectures, scripts, and .a files | ||
55 | INSANE_SKIP_${PN}-dev = "staticdev ldflags file-rdeps arch" | ||
56 | |||
57 | INHIBIT_PACKAGE_STRIP = "1" | ||
58 | INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
diff --git a/meta/recipes-devtools/go/go-runtime_1.8.bb b/meta/recipes-devtools/go/go-runtime_1.8.bb new file mode 100644 index 0000000000..43b68b4e46 --- /dev/null +++ b/meta/recipes-devtools/go/go-runtime_1.8.bb | |||
@@ -0,0 +1,2 @@ | |||
1 | require go-${PV}.inc | ||
2 | require go-runtime.inc | ||
diff --git a/meta/recipes-devtools/go/go.inc b/meta/recipes-devtools/go/go.inc index 9efbd275bd..5984a60c28 100644 --- a/meta/recipes-devtools/go/go.inc +++ b/meta/recipes-devtools/go/go.inc | |||
@@ -1,16 +1,5 @@ | |||
1 | inherit goarch | 1 | inherit goarch |
2 | DEPENDS += "go-native" | 2 | DEPENDS = "virtual/${TARGET_PREFIX}go go-native" |
3 | |||
4 | # libgcc is required for the target specific libraries to build | ||
5 | # properly, but apparently not for go-cross and, more importantly, | ||
6 | # also can't be used there because go-cross cannot depend on | ||
7 | # the tune-specific libgcc. Otherwise go-cross also would have | ||
8 | # to be tune-specific. | ||
9 | DEPENDS += "${@ 'libgcc' if not oe.utils.inherits(d, 'cross') else ''}" | ||
10 | |||
11 | # Prevent runstrip from running because you get errors when the host arch != target arch | ||
12 | INHIBIT_PACKAGE_STRIP = "1" | ||
13 | INHIBIT_SYSROOT_STRIP = "1" | ||
14 | 3 | ||
15 | export GOHOSTOS = "${BUILD_GOOS}" | 4 | export GOHOSTOS = "${BUILD_GOOS}" |
16 | export GOHOSTARCH = "${BUILD_GOARCH}" | 5 | export GOHOSTARCH = "${BUILD_GOARCH}" |
@@ -22,13 +11,11 @@ export GOROOT_FINAL = "${libdir}/go" | |||
22 | export CGO_ENABLED = "1" | 11 | export CGO_ENABLED = "1" |
23 | export CC_FOR_TARGET = "${CC}" | 12 | export CC_FOR_TARGET = "${CC}" |
24 | export CXX_FOR_TARGET = "${CXX}" | 13 | export CXX_FOR_TARGET = "${CXX}" |
14 | export GO_TARGET_INSTALL = "cmd" | ||
15 | export GO_FLAGS = "-a" | ||
25 | 16 | ||
26 | do_configure[noexec] = "1" | 17 | do_configure[noexec] = "1" |
27 | 18 | ||
28 | do_compile_prepend_class-cross() { | ||
29 | export CGO_ENABLED=0 | ||
30 | } | ||
31 | |||
32 | do_compile() { | 19 | do_compile() { |
33 | export GOBIN="${B}/bin" | 20 | export GOBIN="${B}/bin" |
34 | export CC="${@d.getVar('BUILD_CC', True).strip()}" | 21 | export CC="${@d.getVar('BUILD_CC', True).strip()}" |
@@ -39,43 +26,26 @@ do_compile() { | |||
39 | mkdir -p ${WORKDIR}/build-tmp | 26 | mkdir -p ${WORKDIR}/build-tmp |
40 | 27 | ||
41 | cd src | 28 | cd src |
42 | ./make.bash --host-only | 29 | ./make.bash |
43 | # Ensure cgo.a is built with the target toolchain | 30 | cd ${B} |
44 | export GOBIN="${B}/target/bin" | ||
45 | rm -rf ${GOBIN} | ||
46 | mkdir -p ${GOBIN} | ||
47 | GO_FLAGS="-a" ./make.bash | ||
48 | } | ||
49 | |||
50 | do_install_class-target() { | ||
51 | install -d ${D}${libdir}/go | ||
52 | cp -a ${B}/pkg ${D}${libdir}/go/ | ||
53 | install -d ${D}${libdir}/go/src | ||
54 | (cd ${S}/src; for d in *; do \ | ||
55 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ | ||
56 | done) | ||
57 | install -d ${D}${bindir} | ||
58 | if [ -d ${B}/bin/${GOOS}_${GOARCH} ] | ||
59 | then | ||
60 | install -m 0755 ${B}/bin/${GOOS}_${GOARCH}/* ${D}${bindir} | ||
61 | else | ||
62 | install -m 0755 ${B}/bin/* ${D}${bindir} | ||
63 | fi | ||
64 | } | 31 | } |
65 | 32 | ||
66 | do_install_class-cross() { | 33 | do_install() { |
67 | install -d ${D}${libdir}/go | 34 | install -d ${D}${libdir}/go/pkg/tool |
68 | cp -a ${B}/pkg ${D}${libdir}/go/ | 35 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
69 | install -d ${D}${libdir}/go/src | 36 | install -d ${D}${libdir}/go/src |
70 | (cd ${S}/src; for d in *; do \ | 37 | cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ |
71 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ | 38 | install -d ${D}${libdir}/go/bin |
72 | done) | ||
73 | install -d ${D}${bindir} | 39 | install -d ${D}${bindir} |
74 | for f in ${B}/bin/go* | 40 | for f in ${B}/${GO_BUILD_BINDIR}/*; do |
75 | do | 41 | name=`basename $f` |
76 | install -m755 $f ${D}${bindir} | 42 | install -m 0755 $f ${D}${libdir}/go/bin/ |
43 | ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/ | ||
77 | done | 44 | done |
78 | } | 45 | } |
79 | do_package_qa[noexec] = "1" | ||
80 | 46 | ||
81 | RDEPENDS_${PN} += "perl" | 47 | PACKAGES = "${PN} ${PN}-dev" |
48 | FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" | ||
49 | FILES_${PN}-dev = "${libdir}/go" | ||
50 | RDEPENDS_${PN}-dev = "perl bash" | ||
51 | INSANE_SKIP_${PN} = "ldflags" | ||