Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 1 | DEPENDS = "virtual/${TARGET_PREFIX}go go-native" |
| 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 | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | GO_LDFLAGS = "" |
| 14 | GO_LDFLAGS_class-nativesdk = "-linkmode external" |
| 15 | export GO_LDFLAGS |
| 16 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 17 | CC_append_class-nativesdk = " ${SECURITY_NOPIE_CFLAGS}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 18 | |
| 19 | do_configure[noexec] = "1" |
| 20 | |
| 21 | do_compile() { |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 22 | export CC_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CC}" |
| 23 | export CXX_FOR_${TARGET_GOOS}_${TARGET_GOARCH}="${CXX}" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 24 | |
| 25 | cd src |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 26 | ./make.bash --target-only --no-banner |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 27 | cd ${B} |
| 28 | } |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 29 | do_compile[dirs] =+ "${GOTMPDIR} ${B}/bin ${B}/pkg" |
| 30 | do_compile[cleandirs] += "${GOTMPDIR} ${B}/bin ${B}/pkg" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 31 | |
| 32 | do_install() { |
| 33 | install -d ${D}${libdir}/go/pkg/tool |
| 34 | cp --preserve=mode,timestamps -R ${B}/pkg/tool/${TARGET_GOTUPLE} ${D}${libdir}/go/pkg/tool/ |
| 35 | install -d ${D}${libdir}/go/src |
| 36 | cp --preserve=mode,timestamps -R ${S}/src/cmd ${D}${libdir}/go/src/ |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame^] | 37 | 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] | 38 | install -d ${D}${libdir}/go/bin |
| 39 | install -d ${D}${bindir} |
| 40 | for f in ${B}/${GO_BUILD_BINDIR}/*; do |
| 41 | name=`basename $f` |
| 42 | install -m 0755 $f ${D}${libdir}/go/bin/ |
| 43 | ln -sf ../${BASELIB}/go/bin/$name ${D}${bindir}/ |
| 44 | done |
| 45 | } |
| 46 | |
| 47 | PACKAGES = "${PN} ${PN}-dev" |
| 48 | FILES_${PN} = "${libdir}/go/bin ${libdir}/go/pkg/tool/${TARGET_GOTUPLE} ${bindir}" |
| 49 | FILES_${PN}-dev = "${libdir}/go" |
| 50 | RDEPENDS_${PN}-dev = "perl bash" |
| 51 | INSANE_SKIP_${PN} = "ldflags" |
| 52 | |
| 53 | BBCLASSEXTEND = "nativesdk" |