Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 2 | DEPENDS:class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 3 | |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 4 | export GOCACHE = "${B}/.cache" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 5 | GO_LDFLAGS = "" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 6 | GO_LDFLAGS:class-nativesdk = "-linkmode external" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 7 | export GO_LDFLAGS |
| 8 | |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 9 | CC:append:class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 10 | |
| 11 | do_configure[noexec] = "1" |
| 12 | |
| 13 | do_compile() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 14 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" |
| 15 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | |
| 17 | cd src |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | ./make.bash --target-only --no-banner |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 19 | cd ${B} |
| 20 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 21 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" |
| 22 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 23 | |
| 24 | do_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 Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 29 | find ${D}${libdir}/go/src -depth -type d -name testdata -exec rm -rf {} \; |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 30 | 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 Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 35 | ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 36 | done |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 37 | rm -rf ${D}${libdir}/go/src |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | PACKAGES = "${PN} ${PN}-dev" |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 41 | FILES:${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" |
| 42 | RDEPENDS:${PN} = "go-runtime" |
| 43 | INSANE_SKIP:${PN} = "ldflags" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 44 | |
| 45 | BBCLASSEXTEND = "nativesdk" |