Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | inherit goarch |
| 2 | DEPENDS = "virtual/${TARGET_PREFIX}go go-native" |
| 3 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" |
| 4 | |
| 5 | export GOHOSTOS = "${BUILD_GOOS}" |
| 6 | export GOHOSTARCH = "${BUILD_GOARCH}" |
| 7 | export GOOS = "${TARGET_GOOS}" |
| 8 | export GOARCH = "${TARGET_GOARCH}" |
| 9 | export GOARM = "${TARGET_GOARM}" |
| 10 | export GO386 = "${TARGET_GO386}" |
| 11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" |
| 12 | export GOROOT_FINAL = "${libdir}/go" |
| 13 | export CGO_ENABLED = "1" |
| 14 | export CC_FOR_TARGET = "${CC}" |
| 15 | export CXX_FOR_TARGET = "${CXX}" |
| 16 | export GO_TARGET_INSTALL = "cmd" |
| 17 | export GO_FLAGS = "-a" |
| 18 | GO_LDFLAGS = "" |
| 19 | GO_LDFLAGS_class-nativesdk = "-linkmode external" |
| 20 | export GO_LDFLAGS |
| 21 | |
| 22 | SECURITY_CFLAGS = "${SECURITY_NOPIE_CFLAGS}" |
| 23 | SECURITY_LDFLAGS = "" |
| 24 | |
| 25 | do_configure[noexec] = "1" |
| 26 | |
| 27 | do_compile() { |
| 28 | export GOBIN="${B}/bin" |
| 29 | export CC="${@d.getVar('BUILD_CC').strip()}" |
| 30 | rm -rf ${GOBIN} ${B}/pkg |
| 31 | mkdir ${GOBIN} |
| 32 | |
| 33 | export TMPDIR=${WORKDIR}/build-tmp |
| 34 | mkdir -p ${WORKDIR}/build-tmp |
| 35 | |
| 36 | cd src |
| 37 | ./make.bash |
| 38 | cd ${B} |
| 39 | } |
| 40 | |
| 41 | do_install() { |
| 42 | install -d ${D}${libdir}/go/pkg/tool |
| 43 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
| 44 | install -d ${D}${libdir}/go/src |
| 45 | cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ |
| 46 | install -d ${D}${libdir}/go/bin |
| 47 | install -d ${D}${bindir} |
| 48 | for f in ${B}/${GO_BUILD_BINDIR}/*; do |
| 49 | name=`basename $f` |
| 50 | install -m 0755 $f ${D}${libdir}/go/bin/ |
| 51 | ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/ |
| 52 | done |
| 53 | } |
| 54 | |
| 55 | PACKAGES = "${PN} ${PN}-dev" |
| 56 | FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" |
| 57 | FILES_${PN}-dev = "${libdir}/go" |
| 58 | RDEPENDS_${PN}-dev = "perl bash" |
| 59 | INSANE_SKIP_${PN} = "ldflags" |
| 60 | |
| 61 | BBCLASSEXTEND = "nativesdk" |