Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | DEPENDS = "virtual/${TUNE_PKGARCH}-go go-native" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 2 | DEPENDS_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk go-native" |
| 3 | |
| 4 | export GOHOSTOS = "${BUILD_GOOS}" |
| 5 | export GOHOSTARCH = "${BUILD_GOARCH}" |
| 6 | export GOOS = "${TARGET_GOOS}" |
| 7 | export GOARCH = "${TARGET_GOARCH}" |
| 8 | export GOARM = "${TARGET_GOARM}" |
| 9 | export GO386 = "${TARGET_GO386}" |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 10 | export GOMIPS = "${TARGET_GOMIPS}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" |
| 12 | export GOROOT_FINAL = "${libdir}/go" |
Brad Bishop | c8f4712 | 2019-06-24 09:36:18 -0400 | [diff] [blame] | 13 | export GOCACHE = "${B}/.cache" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 14 | GO_LDFLAGS = "" |
| 15 | GO_LDFLAGS_class-nativesdk = "-linkmode external" |
| 16 | export GO_LDFLAGS |
| 17 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 19 | |
| 20 | do_configure[noexec] = "1" |
| 21 | |
| 22 | do_compile() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" |
| 24 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 25 | |
| 26 | cd src |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 27 | ./make.bash --target-only --no-banner |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 28 | cd ${B} |
| 29 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 30 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" |
| 31 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 32 | |
| 33 | do_install() { |
| 34 | install -d ${D}${libdir}/go/pkg/tool |
| 35 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
| 36 | install -d ${D}${libdir}/go/src |
| 37 | cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 38 | 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] | 39 | install -d ${D}${libdir}/go/bin |
| 40 | install -d ${D}${bindir} |
| 41 | for f in ${B}/${GO_BUILD_BINDIR}/*; do |
| 42 | name=`basename $f` |
| 43 | install -m 0755 $f ${D}${libdir}/go/bin/ |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 44 | ln -sf ../${baselib}/go/bin/$name ${D}${bindir}/ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 45 | done |
| 46 | } |
| 47 | |
| 48 | PACKAGES = "${PN} ${PN}-dev" |
| 49 | FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" |
| 50 | FILES_${PN}-dev = "${libdir}/go" |
| 51 | RDEPENDS_${PN}-dev = "perl bash" |
| 52 | INSANE_SKIP_${PN} = "ldflags" |
| 53 | |
| 54 | BBCLASSEXTEND = "nativesdk" |