blob: 8e44247031820a50f14c9883eb8aad322d87bdbd [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
Brad Bishopc8f47122019-06-24 09:36:18 -04004export GOCACHE = "${B}/.cache"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005GO_LDFLAGS = ""
6GO_LDFLAGS_class-nativesdk = "-linkmode external"
7export GO_LDFLAGS
8
Brad Bishop316dfdd2018-06-25 12:45:53 -04009CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050010
11do_configure[noexec] = "1"
12
13do_compile() {
Brad Bishop316dfdd2018-06-25 12:45:53 -040014 export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}"
15 export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050016
17 cd src
Brad Bishop316dfdd2018-06-25 12:45:53 -040018 ./make.bash --target-only --no-banner
Brad Bishopd7bf8c12018-02-25 22:55:05 -050019 cd ${B}
20}
Brad Bishop316dfdd2018-06-25 12:45:53 -040021do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg"
22do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050023
24do_install() {
25 install -d ${D}${libdir}/go/pkg/tool
26 cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/
27 install -d ${D}${libdir}/go/src
28 cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/
Brad Bishop316dfdd2018-06-25 12:45:53 -040029 find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \;
Brad Bishopd7bf8c12018-02-25 22:55:05 -050030 install -d ${D}${libdir}/go/bin
31 install -d ${D}${bindir}
32 for f in ${B}/${GO_BUILD_BINDIR}/*; do
33 name=`basename $f`
34 install -m 0755 $f ${D}${libdir}/go/bin/
Brad Bishop19323692019-04-05 15:28:33 -040035 ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/
Brad Bishopd7bf8c12018-02-25 22:55:05 -050036 done
Andrew Geissler82c905d2020-04-13 13:39:40 -050037 rm -rf ${D}${libdir}/go/src
Brad Bishopd7bf8c12018-02-25 22:55:05 -050038}
39
40PACKAGES = "${PN} ${PN}-dev"
41FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
Andrew Geissler82c905d2020-04-13 13:39:40 -050042RDEPENDS_${PN} = "go-runtime"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050043INSANE_SKIP_${PN} = "ldflags"
44
45BBCLASSEXTEND = "nativesdk"