Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 1 | inherit goarch |
| 2 | DEPENDS += "go-bootstrap-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 | |
| 15 | # x32 ABI is not supported on go compiler so far |
| 16 | COMPATIBLE_HOST_linux-gnux32 = "null" |
| 17 | # ppc32 is not supported in go compilers |
| 18 | COMPATIBLE_HOST_powerpc = "null" |
| 19 | |
| 20 | export GOHOSTOS = "${BUILD_GOOS}" |
| 21 | export GOHOSTARCH = "${BUILD_GOARCH}" |
| 22 | export GOOS = "${TARGET_GOOS}" |
| 23 | export GOARCH = "${TARGET_GOARCH}" |
| 24 | export GOARM = "${TARGET_GOARM}" |
| 25 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go1.4" |
| 26 | export GOROOT_FINAL = "${libdir}/go" |
| 27 | export CGO_ENABLED = "1" |
| 28 | export CC_FOR_TARGET = "${CC}" |
| 29 | export CXX_FOR_TARGET = "${CXX}" |
| 30 | |
| 31 | do_configure[noexec] = "1" |
| 32 | |
| 33 | do_compile_prepend_class-cross() { |
| 34 | export CGO_ENABLED=0 |
| 35 | } |
| 36 | |
| 37 | do_compile() { |
| 38 | export GOBIN="${B}/bin" |
| 39 | export CC="${@d.getVar('BUILD_CC', True).strip()}" |
| 40 | rm -rf ${GOBIN} ${B}/pkg |
| 41 | mkdir ${GOBIN} |
| 42 | |
| 43 | export TMPDIR=${WORKDIR}/build-tmp |
| 44 | mkdir -p ${WORKDIR}/build-tmp |
| 45 | |
| 46 | cd src |
| 47 | ./make.bash --host-only |
| 48 | # Ensure cgo.a is built with the target toolchain |
| 49 | export GOBIN="${B}/target/bin" |
| 50 | rm -rf ${GOBIN} |
| 51 | mkdir -p ${GOBIN} |
| 52 | GO_FLAGS="-a" ./make.bash |
| 53 | } |
| 54 | |
| 55 | do_install_class-target() { |
| 56 | install -d ${D}${libdir}/go |
| 57 | cp -a ${B}/pkg ${D}${libdir}/go/ |
| 58 | install -d ${D}${libdir}/go/src |
| 59 | (cd ${S}/src; for d in *; do \ |
| 60 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ |
| 61 | done) |
| 62 | install -d ${D}${bindir} |
| 63 | if [ -d ${B}/bin/${GOOS}_${GOARCH} ] |
| 64 | then |
| 65 | install -m 0755 ${B}/bin/${GOOS}_${GOARCH}/* ${D}${bindir} |
| 66 | else |
| 67 | install -m 0755 ${B}/bin/* ${D}${bindir} |
| 68 | fi |
| 69 | } |
| 70 | |
| 71 | do_install_class-cross() { |
| 72 | install -d ${D}${libdir}/go |
| 73 | cp -a ${B}/pkg ${D}${libdir}/go/ |
| 74 | install -d ${D}${libdir}/go/src |
| 75 | (cd ${S}/src; for d in *; do \ |
| 76 | [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ |
| 77 | done) |
| 78 | install -d ${D}${bindir} |
| 79 | for f in ${B}/bin/go* |
| 80 | do |
| 81 | install -m755 $f ${D}${bindir} |
| 82 | done |
| 83 | } |
| 84 | do_package_qa[noexec] = "1" |
| 85 | |
| 86 | RDEPENDS_${PN} += "perl" |