blob: c229ab2f8de883b06e0ac89b7f706b21c6afdd20 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05002DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
3
4export GOHOSTOS = "${BUILD_GOOS}"
5export GOHOSTARCH = "${BUILD_GOARCH}"
6export GOOS = "${TARGET_GOOS}"
7export GOARCH = "${TARGET_GOARCH}"
8export GOARM = "${TARGET_GOARM}"
9export GO386 = "${TARGET_GO386}"
Brad Bishop316dfdd2018-06-25 12:45:53 -040010export GOMIPS = "${TARGET_GOMIPS}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050011export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go"
12export GOROOT_FINAL = "${libdir}/go"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050013GO_LDFLAGS = ""
14GO_LDFLAGS_class-nativesdk = "-linkmode external"
15export GO_LDFLAGS
16
Brad Bishop316dfdd2018-06-25 12:45:53 -040017CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050018
19do_configure[noexec] = "1"
20
21do_compile() {
Brad Bishop316dfdd2018-06-25 12:45:53 -040022 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
23 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050024
25 cd src
Brad Bishop316dfdd2018-06-25 12:45:53 -040026 ./make.bash --target-only --no-banner
Brad Bishopd7bf8c12018-02-25 22:55:05 -050027 cd ${B}
28}
Brad Bishop316dfdd2018-06-25 12:45:53 -040029do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
30do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050031
32do_install() {
33 install -d ${D}${libdir}/go/pkg/tool
34 cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
35 install -d ${D}${libdir}/go/src
36 cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
Brad Bishop316dfdd2018-06-25 12:45:53 -040037 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038 install -d ${D}${libdir}/go/bin
39 install -d ${D}${bindir}
40 for f in ${B}/${GO_BUILD_BINDIR}/*; do
41 name=`basename $f`
42 install -m 0755 $f ${D}${libdir}/go/bin/
43 ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/
44 done
45}
46
47PACKAGES = "${PN} ${PN}-dev"
48FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
49FILES_${PN}-dev = "${libdir}/go"
50RDEPENDS_${PN}-dev = "perl bash"
51INSANE_SKIP_${PN} = "ldflags"
52
53BBCLASSEXTEND = "nativesdk"