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 | |
| 7 | export GOHOSTOS = "${BUILD_GOOS}" |
| 8 | export GOHOSTARCH = "${BUILD_GOARCH}" |
| 9 | export GOOS = "${TARGET_GOOS}" |
| 10 | export GOARCH = "${TARGET_GOARCH}" |
| 11 | export GOROOT_BOOTSTRAP = "${STAGING_LIBDIR_NATIVE}/go" |
| 12 | export GOROOT_FINAL = "${libdir}/go" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | |
| 14 | do_configure[noexec] = "1" |
| 15 | |
| 16 | do_compile() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 17 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" |
| 18 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 19 | cd src |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 20 | ./make.bash --host-only --no-banner |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 21 | cd ${B} |
| 22 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 23 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" |
| 24 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 25 | |
| 26 | make_wrapper() { |
| 27 | rm -f ${D}${bindir}/$2 |
| 28 | cat <<END >${D}${bindir}/$2 |
| 29 | #!/bin/bash |
| 30 | here=\`dirname \$0\` |
| 31 | export GOARCH="${TARGET_GOARCH}" |
| 32 | export GOOS="${TARGET_GOOS}" |
| 33 | \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@" |
| 34 | END |
| 35 | chmod +x ${D}${bindir}/$2 |
| 36 | } |
| 37 | |
| 38 | do_install() { |
| 39 | install -d ${D}${libdir}/go |
| 40 | install -d ${D}${libdir}/go/bin |
| 41 | install -d ${D}${libdir}/go/pkg/tool |
| 42 | install -d ${D}${bindir} |
| 43 | cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
| 44 | for f in ${B}/bin/* |
| 45 | do |
| 46 | base=`basename $f` |
| 47 | install -m755 $f ${D}${libdir}/go/bin |
| 48 | make_wrapper $base ${TARGET_PREFIX}$base |
| 49 | done |
| 50 | } |