go-crosssdk.inc 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. inherit crosssdk
  2. DEPENDS = "go-native virtual/nativesdk-cross-cc virtual/nativesdk-compilerlibs virtual/nativesdk-cross-binutils"
  3. PN = "go-crosssdk-${SDK_SYS}"
  4. PROVIDES = "virtual/${TARGET_PREFIX}go"
  5. export GOCACHE = "${B}/.cache"
  6. do_configure[noexec] = "1"
  7. do_compile() {
  8. export CC_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
  9. export CXX_FOR_${TARGET_GOTUPLE}="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}${SDKPATHNATIVE}"
  10. cd src
  11. ./make.bash --host-only --no-banner
  12. cd ${B}
  13. }
  14. do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg"
  15. make_wrapper() {
  16. rm -f ${D}${bindir}/$2
  17. cat <<END >${D}${bindir}/$2
  18. #!/bin/bash
  19. here=\`dirname \$0\`
  20. export GOARCH="${TARGET_GOARCH}"
  21. export GOOS="${TARGET_GOOS}"
  22. \$here/../../lib/${CROSS_TARGET_SYS_DIR}/go/bin/$1 "\$@"
  23. END
  24. chmod +x ${D}${bindir}/$2
  25. }
  26. do_install() {
  27. install -d ${D}${libdir}/go
  28. install -d ${D}${libdir}/go/bin
  29. install -d ${D}${libdir}/go/pkg/tool
  30. install -d ${D}${bindir}
  31. cp --preserve=mode,timestamps -R ${S}/pkg/tool/${BUILD_GOTUPLE} ${D}${libdir}/go/pkg/tool/
  32. for f in ${B}/bin/*
  33. do
  34. base=`basename $f`
  35. install -m755 $f ${D}${libdir}/go/bin
  36. make_wrapper $base ${TARGET_PREFIX}$base
  37. done
  38. }