blob: 47b4411d5461e45f3774f5e6510c656ff6ee6082 [file] [log] [blame]
Brad Bishop1a4b7ee2018-12-16 17:11:34 -08001DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native"
Patrick Williams213cb262021-08-07 19:21:33 -05002DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05003
Brad Bishopc8f47122019-06-24 09:36:18 -04004export GOCACHE = "${B}/.cache"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05005GO_LDFLAGS = ""
Patrick Williams213cb262021-08-07 19:21:33 -05006GO_LDFLAGS:class-nativesdk = "-linkmode external"
Brad Bishopd7bf8c12018-02-25 22:55:05 -05007export GO_LDFLAGS
8
Patrick Williams213cb262021-08-07 19:21:33 -05009CC: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"
Patrick Williams213cb262021-08-07 19:21:33 -050041FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}"
42RDEPENDS:${PN} = "go-runtime"
43INSANE_SKIP:${PN} = "ldflags"
Brad Bishopd7bf8c12018-02-25 22:55:05 -050044
45BBCLASSEXTEND = "nativesdk"