Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | inherit crosssdk |
| 2 | |
| 3 | DEPENDS = "go-native virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/${TARGET_PREFIX}binutils-crosssdk" |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 4 | PN = "go-crosssdk-${SDK_SYS}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 5 | PROVIDES = "virtual/${TARGET_PREFIX}go-crosssdk" |
| 6 | |
Andrew Geissler | 517393d | 2023-01-13 08:55:19 -0600 | [diff] [blame^] | 7 | export GOCACHE = "${B}/.cache" |
| 8 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 9 | do_configure[noexec] = "1" |
| 10 | |
| 11 | do_compile() { |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 12 | export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" |
| 13 | export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 14 | cd src |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 15 | ./make.bash --host-only --no-banner |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 16 | cd ${B} |
| 17 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 18 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 19 | |
| 20 | make_wrapper() { |
| 21 | rm -f ${D}${bindir}/$2 |
| 22 | cat <<END >${D}${bindir}/$2 |
| 23 | #!/bin/bash |
| 24 | here=\`dirname \$0\` |
| 25 | export GOARCH="${TARGET_GOARCH}" |
| 26 | export GOOS="${TARGET_GOOS}" |
| 27 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" |
| 28 | END |
| 29 | chmod +x ${D}${bindir}/$2 |
| 30 | } |
| 31 | |
| 32 | do_install() { |
| 33 | install -d ${D}${libdir}/go |
| 34 | install -d ${D}${libdir}/go/bin |
| 35 | install -d ${D}${libdir}/go/pkg/tool |
| 36 | install -d ${D}${bindir} |
| 37 | cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
| 38 | for f in ${B}/bin/* |
| 39 | do |
| 40 | base=`basename $f` |
| 41 | install -m755 $f ${D}${libdir}/go/bin |
| 42 | make_wrapper $base ${TARGET_PREFIX}$base |
| 43 | done |
| 44 | } |