diff --git a/classes/go.bbclass b/classes/go.bbclass index cc53301..a4c42e4 100644 --- a/classes/go.bbclass +++ b/classes/go.bbclass @@ -8,44 +8,74 @@ def map_go_arch(a, d): else: bb.error("cannot map '%s' to a Go architecture" % a) -GOROOT_class-native = "${STAGING_LIBDIR_NATIVE}/go" -GOROOT = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go" -GOBIN_FINAL_class-native = "${GOROOT_FINAL}/bin" -GOBIN_FINAL = "${GOROOT_FINAL}/bin/${GOOS}_${GOARCH}" +def map_go_arm(f, d): + values = set(f.split()) + if 'armv7' in values: return '7' + elif 'armv6' in values: return '6' + elif 'armv5' in values: return '5' + else: return '' + +def map_go_386(f, d): + values = set(f.split()) + if 'pentium4' in values: return 'sse2' + elif 'i586' in values: return '387' + else: return '' export GOOS = "linux" export GOARCH = "${@map_go_arch(d.getVar('TARGET_ARCH', True), d)}" -export GOROOT -export GOROOT_FINAL = "${libdir}/${TARGET_SYS}/go" -export GOBIN_FINAL -export GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${GOOS}_${GOARCH}" -export GOSRC_FINAL = "${GOROOT_FINAL}/src" -export GO_GCFLAGS = "${TARGET_CFLAGS}" -export GO_LDFLAGS = "${TARGET_LDFLAGS}" -export CGO_CFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CFLAGS}" -export CGO_CPPFLAGS = "${TARGET_CPPFLAGS}" -export CGO_CXXFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_CXXFLAGS}" -export CGO_LDFLAGS = "${TARGET_CC_ARCH}${TOOLCHAIN_OPTIONS} ${TARGET_LDFLAGS}" - -DEPENDS += "go-cross-${TARGET_ARCH}" -DEPENDS_class-native += "go-native" - -FILES_${PN}-staticdev += "${GOSRC_FINAL}/${GO_IMPORT}" +export GOARM = "${@map_go_arm(d.getVar('TUNE_FEATURES', True), d)}" +export GO386 = "${@map_go_386(d.getVar('TUNE_FEATURES', True), d)}" + +GO_FLAGS ?= "" +GO_GCFLAGS ?= "" +GO_ASMFLAGS ?= "" +GO_LDFLAGS ?= "" +export CGO_ENABLED = "1" +export CGO_CFLAGS = "${CFLAGS}" +export CGO_CPPFLAGS = "${CPPFLAGS}" +export CGO_CXXFLAGS = "${CXXFLAGS}" +export CGO_LDFLAGS = "${LDFLAGS}" + +DEPENDS += "go-native" + +# go binaries don't use GNU_HASH. Known, disable "QA Issue: No GNU_HASH in the elf binary: ..." warnings. +INSANE_SKIP_${PN} += "ldflags" + +PACKAGE_ARCH_${PN}-dev = "all" +FILES_${PN}-dev += "${GOSRC_FINAL}/${GO_IMPORT}" FILES_${PN}-staticdev += "${GOPKG_FINAL}/${GO_IMPORT}*" +GO ?= "go" + GO_INSTALL ?= "${GO_IMPORT}/..." +B = "${WORKDIR}/gopath" +export GOPATH = "${B}:${STAGING_LIBDIR}/go" +export GOROOT = "${STAGING_LIBDIR_NATIVE}/go" + +# The "real" GOROOT is embedded in the built go binary +GOROOT_FINAL = "${libdir}/go" +GOROOT_FINAL_class-native = "${STAGING_LIBDIR_NATIVE}/go" + +GOPKG_FINAL = "${GOROOT_FINAL}/pkg/${GOOS}_${GOARCH}" +GOSRC_FINAL = "${GOROOT_FINAL}/src" + do_go_compile() { - GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go env - if test -n "${GO_INSTALL}" ; then - GOPATH=${S}:${STAGING_LIBDIR}/${TARGET_SYS}/go go install -v ${GO_INSTALL} + go env + + install -d ${B}/src/${GO_IMPORT} + tar -C ${S} -cf - . | tar -C ${B}/src/${GO_IMPORT} -xpf - + + if [ -n "${GO_INSTALL}" ]; then + # `godep` needs to be run from dir with ./vendor; `go` doesn't care + ( cd ${B}/src/${GO_IMPORT} && ${GO} install -x -asmflags "${GO_ASMFLAGS}" -gcflags "${GO_GCFLAGS}" -ldflags "${GO_LDFLAGS}" ${GO_FLAGS} ${GO_INSTALL} ) fi } do_go_install() { rm -rf ${WORKDIR}/staging install -d ${WORKDIR}/staging${GOROOT_FINAL} ${D}${GOROOT_FINAL} - tar -C ${S} -cf - . | tar -C ${WORKDIR}/staging${GOROOT_FINAL} -xpvf - + tar -C ${B} -cf - src pkg | tar -C ${WORKDIR}/staging${GOROOT_FINAL} -xpf - find ${WORKDIR}/staging${GOROOT_FINAL} \( \ -name \*.indirectionsymlink -o \ @@ -62,10 +92,9 @@ do_go_install() { chown -R root:root "${D}${GOROOT_FINAL}" - if test -e "${D}${GOBIN_FINAL}" ; then + if test -e "${B}/bin" ; then install -d -m 0755 "${D}${bindir}" - find "${D}${GOBIN_FINAL}" ! -type d -print0 | xargs -r0 mv --target-directory="${D}${bindir}" - rmdir -p "${D}${GOBIN_FINAL}" || true + find "${B}/bin" ! -type d -print0 | xargs -r0 install -m 0755 --target-directory="${D}${bindir}" fi } diff --git a/recipes-caddy/caddy/github.com-burntsushi-toml.bb b/recipes-caddy/caddy/github.com-burntsushi-toml.bb index 138b993..901102d 100644 --- a/recipes-caddy/caddy/github.com-burntsushi-toml.bb +++ b/recipes-caddy/caddy/github.com-burntsushi-toml.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/BurntSushi/toml" inherit go -SRC_URI = "git://github.com/BurntSushi/toml;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/BurntSushi/toml;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "DWTFYW" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/COPYING;md5=389a9e29629d1f05e115f8f05c283df5" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://COPYING;md5=389a9e29629d1f05e115f8f05c283df5" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-codegangsta-cli.bb b/recipes-caddy/caddy/github.com-codegangsta-cli.bb index bc1f6f6..334b21e 100644 --- a/recipes-caddy/caddy/github.com-codegangsta-cli.bb +++ b/recipes-caddy/caddy/github.com-codegangsta-cli.bb @@ -4,9 +4,12 @@ GO_IMPORT = "github.com/codegangsta/cli" inherit go -SRC_URI = "git://github.com/codegangsta/cli;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/codegangsta/cli;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=ed9b539ed65d73926f30ff1f1587dc44" +LIC_FILES_CHKSUM = "file://LICENSE;md5=c542707ca9fc0b7802407ba62310bd8f" +S = "${WORKDIR}/git" -FILES_${PN} += "${GOBIN_FINAL}/*" +DEPENDS += "github.com-burntsushi-toml" + +GO_INSTALL = "${GO_IMPORT}" diff --git a/recipes-caddy/caddy/github.com-dustin-go-humanize.bb b/recipes-caddy/caddy/github.com-dustin-go-humanize.bb index 05168ee..53677ba 100644 --- a/recipes-caddy/caddy/github.com-dustin-go-humanize.bb +++ b/recipes-caddy/caddy/github.com-dustin-go-humanize.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/dustin/go-humanize" inherit go -SRC_URI = "git://github.com/dustin/go-humanize;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/dustin/go-humanize;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=8c6127b79304a5e0a5756d03c7a58766" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=8c6127b79304a5e0a5756d03c7a58766" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-flynn-go-shlex.bb b/recipes-caddy/caddy/github.com-flynn-go-shlex.bb index 80cda29..938a233 100644 --- a/recipes-caddy/caddy/github.com-flynn-go-shlex.bb +++ b/recipes-caddy/caddy/github.com-flynn-go-shlex.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/flynn/go-shlex" inherit go -SRC_URI = "git://github.com/flynn/go-shlex;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/flynn/go-shlex;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://COPYING;md5=3b83ef96387f14655fc854ddc3c6bd57" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-gorilla-websocket.bb b/recipes-caddy/caddy/github.com-gorilla-websocket.bb index 39da4bd..ad401e2 100644 --- a/recipes-caddy/caddy/github.com-gorilla-websocket.bb +++ b/recipes-caddy/caddy/github.com-gorilla-websocket.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/gorilla/websocket" inherit go -SRC_URI = "git://github.com/gorilla/websocket;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/gorilla/websocket;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=c007b54a1743d596f46b2748d9f8c044" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=c007b54a1743d596f46b2748d9f8c044" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-hashicorp-go-syslog.bb b/recipes-caddy/caddy/github.com-hashicorp-go-syslog.bb index ef60e4a..0e849a5 100644 --- a/recipes-caddy/caddy/github.com-hashicorp-go-syslog.bb +++ b/recipes-caddy/caddy/github.com-hashicorp-go-syslog.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/hashicorp/go-syslog" inherit go -SRC_URI = "git://github.com/hashicorp/go-syslog;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/hashicorp/go-syslog;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=cb04212e101fbbd028f325e04ad45778" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=cb04212e101fbbd028f325e04ad45778" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-jimstudt-http-authentication.bb b/recipes-caddy/caddy/github.com-jimstudt-http-authentication.bb index 074ffc9..de2fa59 100644 --- a/recipes-caddy/caddy/github.com-jimstudt-http-authentication.bb +++ b/recipes-caddy/caddy/github.com-jimstudt-http-authentication.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/jimstudt/http-authentication" inherit go -SRC_URI = "git://github.com/jimstudt/http-authentication;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/jimstudt/http-authentication;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=61e7f1bfbf294711fc438f57de71ccdd" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=61e7f1bfbf294711fc438f57de71ccdd" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-mholt-caddy.bb b/recipes-caddy/caddy/github.com-mholt-caddy.bb index a5b8a30..fdb4e0b 100644 --- a/recipes-caddy/caddy/github.com-mholt-caddy.bb +++ b/recipes-caddy/caddy/github.com-mholt-caddy.bb @@ -4,12 +4,11 @@ GO_IMPORT = "github.com/mholt/caddy" inherit go -SRC_URI = "git://github.com/mholt/caddy;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/mholt/caddy;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e" +S = "${WORKDIR}/git" DEPENDS += "\ github.com-burntsushi-toml \ diff --git a/recipes-caddy/caddy/github.com-russross-blackfriday.bb b/recipes-caddy/caddy/github.com-russross-blackfriday.bb index 1f62a90..323cdf0 100644 --- a/recipes-caddy/caddy/github.com-russross-blackfriday.bb +++ b/recipes-caddy/caddy/github.com-russross-blackfriday.bb @@ -4,9 +4,10 @@ GO_IMPORT = "github.com/russross/blackfriday" inherit go -SRC_URI = "git://github.com/russross/blackfriday;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/russross/blackfriday;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE.txt;md5=ecf8a8a60560c35a862a4a545f2db1b3" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=ecf8a8a60560c35a862a4a545f2db1b3" +S = "${WORKDIR}/git" -FILES_${PN} += "${GOBIN_FINAL}/*" +DEPENDS += "github.com-shurcool-sanitized-anchor-name" diff --git a/recipes-caddy/caddy/github.com-shurcool-sanitized-anchor-name.bb b/recipes-caddy/caddy/github.com-shurcool-sanitized-anchor-name.bb index 616f9e7..2a6bda8 100644 --- a/recipes-caddy/caddy/github.com-shurcool-sanitized-anchor-name.bb +++ b/recipes-caddy/caddy/github.com-shurcool-sanitized-anchor-name.bb @@ -4,9 +4,8 @@ GO_IMPORT = "github.com/shurcooL/sanitized_anchor_name" inherit go -SRC_URI = "git://github.com/shurcooL/sanitized_anchor_name;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/shurcooL/sanitized_anchor_name;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "BSD" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=bee2c3aa5bd0f265ffbd193eb18ca30d" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=bee2c3aa5bd0f265ffbd193eb18ca30d" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/github.com-square-go-jose.bb b/recipes-caddy/caddy/github.com-square-go-jose.bb index 8e566d5..8d5d5f8 100644 --- a/recipes-caddy/caddy/github.com-square-go-jose.bb +++ b/recipes-caddy/caddy/github.com-square-go-jose.bb @@ -4,11 +4,12 @@ GO_IMPORT = "github.com/square/go-jose" inherit go -SRC_URI = "git://github.com/square/go-jose;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/square/go-jose;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" +S = "${WORKDIR}/git" DEPENDS += "github.com-codegangsta-cli" + +GO_INSTALL = "${GO_IMPORT}" diff --git a/recipes-caddy/caddy/github.com-xenolf-lego.bb b/recipes-caddy/caddy/github.com-xenolf-lego.bb index b60b437..0d0e54c 100644 --- a/recipes-caddy/caddy/github.com-xenolf-lego.bb +++ b/recipes-caddy/caddy/github.com-xenolf-lego.bb @@ -4,9 +4,10 @@ GO_IMPORT = "github.com/xenolf/lego" inherit go -SRC_URI = "git://github.com/xenolf/lego;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/xenolf/lego;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=bc6cc6b9955a86b318178c38ac271bba" +LIC_FILES_CHKSUM = "file://LICENSE;md5=bc6cc6b9955a86b318178c38ac271bba" +S = "${WORKDIR}/git" -FILES_${PN} += "${GOBIN_FINAL}/*" +GO_INSTALL = "" diff --git a/recipes-caddy/caddy/gopkg.in-natefinch-lumberjack.v2.bb b/recipes-caddy/caddy/gopkg.in-natefinch-lumberjack.v2.bb index 7a22767..37b2aa8 100644 --- a/recipes-caddy/caddy/gopkg.in-natefinch-lumberjack.v2.bb +++ b/recipes-caddy/caddy/gopkg.in-natefinch-lumberjack.v2.bb @@ -4,9 +4,8 @@ GO_IMPORT = "gopkg.in/natefinch/lumberjack.v2" inherit go -SRC_URI = "git://gopkg.in/natefinch/lumberjack.v2;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://gopkg.in/natefinch/lumberjack.v2;protocol=https" SRCREV = "${AUTOREV}" LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=574cdb55b81249478f5af5f789e9e29f" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LIC_FILES_CHKSUM = "file://LICENSE;md5=574cdb55b81249478f5af5f789e9e29f" +S = "${WORKDIR}/git" diff --git a/recipes-caddy/caddy/gopkg.in-yaml.v2.bb b/recipes-caddy/caddy/gopkg.in-yaml.v2.bb index 0fe47ba..2f70bb9 100644 --- a/recipes-caddy/caddy/gopkg.in-yaml.v2.bb +++ b/recipes-caddy/caddy/gopkg.in-yaml.v2.bb @@ -4,9 +4,8 @@ GO_IMPORT = "gopkg.in/yaml.v2" inherit go -SRC_URI = "git://gopkg.in/yaml.v2;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://gopkg.in/yaml.v2;protocol=https" SRCREV = "${AUTOREV}" -LICENSE = "LGPL-3" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=3493bb7e185df64f59d28a975a1f91a7" - -FILES_${PN} += "${GOBIN_FINAL}/*" +LICENSE = "Apache-2" +LIC_FILES_CHKSUM = "file://LICENSE;md5=6964839e54f4fefcdae13f22b92d0fbb" +S = "${WORKDIR}/git" diff --git a/recipes-devtools/examples/go-examples.inc b/recipes-devtools/examples/go-examples.inc index d8e2328..b29a43c 100644 --- a/recipes-devtools/examples/go-examples.inc +++ b/recipes-devtools/examples/go-examples.inc @@ -2,8 +2,6 @@ DESCRIPTION = "This is a simple example recipe that cross-compiles a Go program. SECTION = "examples" HOMEPAGE = "https://golang.org/" -DEPENDS = "go-cross-${TARGET_ARCH}" - FILESEXTRAPATHS_prepend := "${THISDIR}/files:" LICENSE = "MIT" diff --git a/recipes-devtools/go/go-bootstrap-native_1.4.3.bb b/recipes-devtools/go/go-bootstrap-native_1.4.3.bb index 474270d..d04ac13 100644 --- a/recipes-devtools/go/go-bootstrap-native_1.4.3.bb +++ b/recipes-devtools/go/go-bootstrap-native_1.4.3.bb @@ -2,18 +2,12 @@ require go_${PV}.inc inherit native -do_compile() { - ## Setting `$GOBIN` doesn't do any good, looks like it ends up copying binaries there. - export GOROOT_FINAL="${SYSROOT}${nonarch_libdir}/${PN}-${PV}" - - setup_go_arch +CGO_ENABLED = "0" +GOROOT_FINAL="${SYSROOT}${nonarch_libdir}/${PN}-${PV}" - export CGO_ENABLED="0" - ## TODO: consider setting GO_EXTLINK_ENABLED - - # Compile - cd src && bash -x ./make.bash +do_compile() { + bash -x ./make.bash # Log the resulting environment - env "GOROOT=${WORKDIR}/go-${PV}/go" "${WORKDIR}/go-${PV}/go/bin/go" env + "${S}/bin/go" env } diff --git a/recipes-devtools/go/go-cross b/recipes-devtools/go/go-cross deleted file mode 120000 index c08e80d..0000000 --- a/recipes-devtools/go/go-cross +++ /dev/null @@ -1 +0,0 @@ -go \ No newline at end of file diff --git a/recipes-devtools/go/go-cross.inc b/recipes-devtools/go/go-cross.inc deleted file mode 100644 index 7ea8abe..0000000 --- a/recipes-devtools/go/go-cross.inc +++ /dev/null @@ -1,8 +0,0 @@ -inherit cross - -PN = "go-cross-${TARGET_ARCH}" - -FILESEXTRAPATHS =. "${FILE_DIRNAME}/go-cross:" - -GOROOT_FINAL ="${libdir}/go" -export GOROOT_FINAL diff --git a/recipes-devtools/go/go-cross_1.4.3.bb b/recipes-devtools/go/go-cross_1.4.3.bb deleted file mode 100644 index 448be09..0000000 --- a/recipes-devtools/go/go-cross_1.4.3.bb +++ /dev/null @@ -1,32 +0,0 @@ -require go_${PV}.inc - -GOROOT_FINAL="${libdir}/go" -export GOROOT_FINAL - -DEPENDS = "virtual/${TARGET_PREFIX}gcc" - -inherit cross - -do_compile() { - setup_go_arch - - export CGO_ENABLED="${GO_CROSS_CGO_ENABLED}" - ## TODO: consider setting GO_EXTLINK_ENABLED - - export CC="${BUILD_CC}" - export CC_FOR_TARGET="${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" - export CXX_FOR_TARGET="${TARGET_PREFIX}g++ ${TARGET_CC_ARCH} --sysroot=${STAGING_DIR_TARGET}" - export GO_CCFLAGS="${HOST_CFLAGS}" - export GO_LDFLAGS="${HOST_LDFLAGS}" - - cd src && bash -x ./make.bash - - # log the resulting environment - env "GOROOT=${WORKDIR}/go-${PV}/go" "${WORKDIR}/go-${PV}/go/bin/go" env -} - -do_install() { - install -d "${D}${libdir}/go" - tar -C "${WORKDIR}/go-${PV}/go/" -cf - bin include lib pkg src test | - tar -C "${D}${libdir}/go" -xf - -} diff --git a/recipes-devtools/go/go-cross_1.6.3.bb b/recipes-devtools/go/go-cross_1.6.3.bb deleted file mode 120000 index 5e2a2e6..0000000 --- a/recipes-devtools/go/go-cross_1.6.3.bb +++ /dev/null @@ -1 +0,0 @@ -go-cross_1.7.4.bb \ No newline at end of file diff --git a/recipes-devtools/go/go-cross_1.7.4.bb b/recipes-devtools/go/go-cross_1.7.4.bb deleted file mode 100644 index 4eae3f4..0000000 --- a/recipes-devtools/go/go-cross_1.7.4.bb +++ /dev/null @@ -1,15 +0,0 @@ -require go-cross.inc -require go_${PV}.inc - -# Go binaries are not understood by the strip tool. -INHIBIT_SYSROOT_STRIP = "1" - -do_compile() { - go_compile -} - -do_install() { - go_install -} - -## TODO: implement do_clean() and ensure we actually do rebuild super cleanly diff --git a/recipes-devtools/go/go-native_1.4.3.bb b/recipes-devtools/go/go-native_1.4.3.bb deleted file mode 100644 index af79119..0000000 --- a/recipes-devtools/go/go-native_1.4.3.bb +++ /dev/null @@ -1,26 +0,0 @@ -require go_${PV}.inc - -GOROOT_FINAL="${STAGING_LIBDIR_NATIVE}/go" -export GOROOT_FINAL - -inherit native - -do_compile() { - setup_go_arch - - export CGO_ENABLED="0" - ## TODO: consider setting GO_EXTLINK_ENABLED - - export CC="${BUILD_CC}" - - cd src && bash -x ./make.bash - - # log the resulting environment - env "GOROOT=${WORKDIR}/go-${PV}/go" "${WORKDIR}/go-${PV}/go/bin/go" env -} - -do_install() { - install -d "${D}${libdir}/go" - tar -C "${WORKDIR}/go-${PV}/go/" -cf - bin include lib pkg src test | - tar -C "${D}${libdir}/go" -xf - -} diff --git a/recipes-devtools/go/go.inc b/recipes-devtools/go/go.inc index 4f4c743..be53afb 100644 --- a/recipes-devtools/go/go.inc +++ b/recipes-devtools/go/go.inc @@ -5,101 +5,52 @@ LICENSE = "BSD-3-Clause" SRC_URI_PREFIX = "http://golang.org/dl/" GO_BOOTSTRAP_VERSION="1.4.3" GO_CROSS_CGO_ENABLED?="0" -GOROOT_BOOTSTRAP="${STAGING_LIBDIR_NATIVE}/go-bootstrap-native-${GO_BOOTSTRAP_VERSION}" - -S = "${WORKDIR}/go-${PV}/go" - -setup_go_arch() { - export GOHOSTOS="linux" - export GOOS="linux" - - translate_arch() { - local ARCH - case "$1" in - x86_64) - ARCH=amd64 - ;; - i586|i686) - ARCH=386 - ;; - arm) - ARCH=arm - ;; - aarch64) - # ARM64 is invalid for Go 1.4 - ARCH=arm64 - ;; - esac - - echo "${ARCH}" - } - - GOARCH=`translate_arch "${TARGET_ARCH}"` - export GOARCH - - case "${GOARCH}" in - arm) - case "${TUNE_PKGARCH}" in - cortexa*) - export GOARM=7 - ;; - esac - ;; - esac - - GOHOSTARCH=`translate_arch "${BUILD_ARCH}"` - export GOHOSTARCH -} - -setup_cgo_gcc_wrapper() { - # Is there a bug in the cross-compiler support for CGO? Can't get it - # to work without this wrapper - for t in gcc g++ ; do - cat > ${WORKDIR}/${TARGET_PREFIX}${t} < ${WORKDIR}/go-${PV}.env - cd ${WORKDIR}/go-${PV}/go/src && bash -x ./make.bash - - # log the resulting environment - env "GOROOT=${WORKDIR}/go-${PV}/go" "${WORKDIR}/go-${PV}/go/bin/go" env -} - -go_install() { - install -d "${D}${bindir}" "${D}${GOROOT_FINAL}" - tar -C "${WORKDIR}/go-${PV}/go" -cf - bin lib src pkg test | - tar -C "${D}${GOROOT_FINAL}" -xf - - rm -rf "${D}${GOROOT_FINAL}/pkg/bootstrap" - - mv "${D}${GOROOT_FINAL}/bin/"* "${D}${bindir}/" - - rm -f "${D}${GOROOT_FINAL}/src/"*.rc - - for t in gcc g++ ; do - cat > ${D}${GOROOT_FINAL}/bin/${TARGET_PREFIX}${t} < 0 { + outputHdr = "\nCommand output:\n\n" +diff -ru go.orig/src/cmd/go/build.go go/src/cmd/go/build.go +--- go.orig/src/cmd/go/build.go 2016-02-18 07:35:20.000000000 +1100 ++++ go/src/cmd/go/build.go 2016-03-15 20:54:30.109492787 +1100 +@@ -2893,12 +2893,10 @@ + // ccompilerCmd returns a command line prefix for the given environment + // variable and using the default command when the variable is empty. + func (b *builder) ccompilerCmd(envvar, defcmd, objdir string) []string { +- // NOTE: env.go's mkEnv knows that the first three +- // strings returned are "gcc", "-I", objdir (and cuts them off). ++ // NOTE: env.go's mkEnv knows that the last two ++ // strings returned are "-I", objdir (and cuts them off). + +- compiler := envList(envvar, defcmd) +- a := []string{compiler[0], "-I", objdir} +- a = append(a, compiler[1:]...) ++ a := envList(envvar, defcmd) + + // Definitely want -fPIC but on Windows gcc complains + // "-fPIC ignored for target (all code is position independent)" +@@ -2934,6 +2932,8 @@ + a = append(a, "-fno-common") + } + ++ a = append(a, "-I", objdir) ++ + return a + } + +diff -ru go.orig/src/cmd/go/env.go go/src/cmd/go/env.go +--- go.orig/src/cmd/go/env.go 2016-02-18 07:35:20.000000000 +1100 ++++ go/src/cmd/go/env.go 2016-03-15 21:01:27.694142060 +1100 +@@ -57,10 +57,10 @@ + + if goos != "plan9" { + cmd := b.gccCmd(".") +- env = append(env, envVar{"CC", cmd[0]}) +- env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")}) ++ env = append(env, envVar{"CC", strings.Join(cmd[:len(cmd)-2], " ")}) ++ env = append(env, envVar{"GOGCCFLAGS", ""}) + cmd = b.gxxCmd(".") +- env = append(env, envVar{"CXX", cmd[0]}) ++ env = append(env, envVar{"CXX", strings.Join(cmd[:len(cmd)-2], " ")}) + } + + if buildContext.CgoEnabled { +diff -ru go.orig/src/cmd/go/go_test.go go/src/cmd/go/go_test.go +--- go.orig/src/cmd/go/go_test.go 2016-02-18 07:35:20.000000000 +1100 ++++ go/src/cmd/go/go_test.go 2016-03-15 21:09:18.514794057 +1100 +@@ -2759,3 +2759,13 @@ + tg.setenv("GOPATH", tg.path(".")) + tg.run("test", "-p=4", "p1", "p2", "p3", "p4") + } ++ ++func TestGoEnvCcFlags(t *testing.T) { ++ tg := testgo(t) ++ defer tg.cleanup() ++ tg.setenv("CC", "one two three four") ++ tg.run("env", "CC") ++ if !strings.Contains(tg.getStdout(), "one two three four") { ++ t.Error("CC lost arguments") ++ } ++} diff --git a/recipes-devtools/go/go_1.4.3.inc b/recipes-devtools/go/go_1.4.3.inc index 5e4ea19..a2d48ce 100644 --- a/recipes-devtools/go/go_1.4.3.inc +++ b/recipes-devtools/go/go_1.4.3.inc @@ -4,7 +4,7 @@ GO_BOOTSTRAP_TAG="1_4" GO_BOOTSTRAP_SOURCE="go${GO_BOOTSTRAP_VERSION}.src.tar.gz" GO_BOOTSTRAP_URI = "${SRC_URI_PREFIX}/${GO_BOOTSTRAP_SOURCE}" -SRC_URI = "${GO_BOOTSTRAP_URI};name=go_${GO_BOOTSTRAP_TAG};subdir=go-${PV}" +SRC_URI = "${GO_BOOTSTRAP_URI};name=go_${GO_BOOTSTRAP_TAG}" SRC_URI[go_1_4.md5sum] = "dfb604511115dd402a77a553a5923a04" SRC_URI[go_1_4.sha256sum] = "9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959" @@ -14,14 +14,14 @@ SRC_URI += "\ file://0001-cmd-ld-set-alignment-for-the-.rel.plt-section-on-32-.patch \ " -LIC_FILES_CHKSUM = "file://${WORKDIR}/go-${PV}/go/LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" +LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" SSTATE_SCAN_CMD = "true" do_install() { - install -d "${D}${libdir}/${PN}-${PV}" - tar -C "${WORKDIR}/go-${PV}/go/" -cf - bin include lib pkg src test | - tar -C "${D}${libdir}/${PN}-${PV}" -xf - + install -d "${D}${GOROOT_FINAL}" + tar -C "${S}" -cf - bin include lib pkg src test | + tar -C "${D}${GOROOT_FINAL}" -xf - } ## TODO: implement do_clean() and ensure we actually do rebuild super cleanly diff --git a/recipes-devtools/go/go_1.6.3.bb b/recipes-devtools/go/go_1.6.3.bb index 79c56a8..6a41203 100644 --- a/recipes-devtools/go/go_1.6.3.bb +++ b/recipes-devtools/go/go_1.6.3.bb @@ -1,17 +1,22 @@ require go_${PV}.inc -#PN_class-native = "go-native" -#PN_class-cross = "go-cross-${TARGET_ARCH}" - -GOROOT_FINAL="${libdir}/go" -GOROOT_FINAL_class-native="${STAGING_LIBDIR_NATIVE}/go" +GOROOT_FINAL = "${libdir}/go" +GOROOT_FINAL_class-native = "${STAGING_LIBDIR_NATIVE}/go" export GOROOT_FINAL -# Go binaries are not understood by the strip tool. -INHIBIT_SYSROOT_STRIP = "1" - do_compile() { - go_compile + bash -x ./make.bash +} + +go_install() { + install -d "${D}${bindir}" "${D}${GOROOT_FINAL}" + tar -C "${S}" -cf - bin lib src pkg | + tar -C "${D}${GOROOT_FINAL}" -xf - + rm -rf "${D}${GOROOT_FINAL}/pkg/bootstrap" + + mv "${D}${GOROOT_FINAL}/bin/"* "${D}${bindir}/" + + rm -f "${D}${GOROOT_FINAL}/src/"*.rc } do_install() { @@ -19,8 +24,6 @@ do_install() { } do_install_class-target() { - setup_go_arch - go_install if test "${GOHOSTOS}_${GOHOSTARCH}" != "${GOOS}_${GOARCH}" ; then @@ -39,6 +42,4 @@ do_install_class-target() { ## TODO: implement do_clean() and ensure we actually do rebuild super cleanly -INSANE_SKIP_go = "staticdev" - -BBCLASSEXTEND = "native" +BBCLASSEXTEND = "native nativesdk" diff --git a/recipes-devtools/go/go_1.6.3.inc b/recipes-devtools/go/go_1.6.3.inc index 7ffde00..7062fd9 100644 --- a/recipes-devtools/go/go_1.6.3.inc +++ b/recipes-devtools/go/go_1.6.3.inc @@ -1,16 +1,21 @@ require go.inc -DEPENDS = "go-bootstrap-native" +DEPENDS += "go-bootstrap-native bash-native" +DEPENDS_class-target += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" SSTATE_SCAN_CMD = "true" -SRC_URI = "${SRC_URI_PREFIX}/go${PV}.src.tar.gz;subdir=go-${PV}" +SRC_URI = "${SRC_URI_PREFIX}/go${PV}.src.tar.gz" SRC_URI[md5sum] = "bf3fce6ccaadd310159c9e874220e2a2" SRC_URI[sha256sum] = "6326aeed5f86cf18f16d6dc831405614f855e2d416a91fd3fdc334f772345b00" SRC_URI += "\ file://Fix-ccache-compilation-issue.patch \ file://fix-cross-compilation.patch \ + file://cc-args.patch \ " -LIC_FILES_CHKSUM = "file://${WORKDIR}/go-${PV}/go/LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" +LIC_FILES_CHKSUM = "file://LICENSE;md5=591778525c869cdde0ab5a1bf283cd81" + +# The regular go>=1.5 binary can cross-compile based on GOARCH/GOOS +PROVIDES_append_class-native = "go-cross" diff --git a/recipes-devtools/go/go_1.7.4.inc b/recipes-devtools/go/go_1.7.4.inc index 5269997..aaffc2e 100644 --- a/recipes-devtools/go/go_1.7.4.inc +++ b/recipes-devtools/go/go_1.7.4.inc @@ -1,15 +1,20 @@ require go.inc -DEPENDS = "go-bootstrap-native" +DEPENDS += "go-bootstrap-native bash-native" +DEPENDS_append_class-target = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}g++" SSTATE_SCAN_CMD = "true" -SRC_URI = "${SRC_URI_PREFIX}/go${PV}.src.tar.gz;subdir=go-${PV}" +SRC_URI = "${SRC_URI_PREFIX}/go${PV}.src.tar.gz" SRC_URI[md5sum] = "49c1076428a5d3b5ad7ac65233fcca2f" SRC_URI[sha256sum] = "4c189111e9ba651a2bb3ee868aa881fab36b2f2da3409e80885ca758a6b614cc" SRC_URI += "\ file://fix-cross-compilation.patch \ + file://cc-args.patch \ " -LIC_FILES_CHKSUM = "file://${WORKDIR}/go-${PV}/go/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" +LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707" + +# The regular go>=1.5 binary can cross-compile based on GOARCH/GOOS +PROVIDES_append_class-native = "go-cross" diff --git a/recipes-net/cloud.google.com-go/cloud.google.com-go.bb b/recipes-net/cloud.google.com-go/cloud.google.com-go.bb index 5b3565f..ef9e87b 100644 --- a/recipes-net/cloud.google.com-go/cloud.google.com-go.bb +++ b/recipes-net/cloud.google.com-go/cloud.google.com-go.bb @@ -15,6 +15,7 @@ GO_INSTALL = "\ inherit go -SRC_URI = "git://code.googlesource.com/gocloud;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://code.googlesource.com/gocloud;protocol=https" SRCREV = "05253f6a829103296c351b643f6815aedd81a3fb" +S = "${WORKDIR}/git" diff --git a/recipes-net/github.com-golang-glog/github.com-golang-glog.bb b/recipes-net/github.com-golang-glog/github.com-golang-glog.bb index 08f5593..79e15aa 100644 --- a/recipes-net/github.com-golang-glog/github.com-golang-glog.bb +++ b/recipes-net/github.com-golang-glog/github.com-golang-glog.bb @@ -3,14 +3,15 @@ SECTION = "net" HOMEPAGE = "https://github.com/golang/glog" LICENSE = "Apache-2.0" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=19cbd64715b51267a47bf3750cc6a8a5" +LIC_FILES_CHKSUM = "file://LICENSE;md5=19cbd64715b51267a47bf3750cc6a8a5" GO_IMPORT = "github.com/golang/glog" inherit go SRC_URI = "\ - git://${GO_IMPORT}.git;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT} \ + git://${GO_IMPORT}.git;protocol=https \ " SRCREV = "23def4e6c14b4da8ac2ed8007337bc5eb5007998" +S = "${WORKDIR}/git" diff --git a/recipes-net/github.com-golang-protobuf/github.com-golang-protobuf.bb b/recipes-net/github.com-golang-protobuf/github.com-golang-protobuf.bb index 29421b1..7a3dae2 100644 --- a/recipes-net/github.com-golang-protobuf/github.com-golang-protobuf.bb +++ b/recipes-net/github.com-golang-protobuf/github.com-golang-protobuf.bb @@ -3,14 +3,14 @@ SECTION = "net" HOMEPAGE = "https://github.com/golang/protobuf" LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=14db3a56c3796a940ba32948a15f97d0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=14db3a56c3796a940ba32948a15f97d0" DEPENDS = "golang.org-x-net" GO_IMPORT = "github.com/golang/protobuf" SRC_URI = "\ - git://github.com/golang/protobuf.git;protocol=https;name=protobuf;destsuffix=${PN}-${PV}/src/${GO_IMPORT} \ + git://github.com/golang/protobuf.git;protocol=https;name=protobuf \ " SRCREV_protobuf = "7390af9dcd3c33042ebaf2474a1724a83cf1a7e6" diff --git a/recipes-net/golang.org-x-net/golang.org-x-net.bb b/recipes-net/golang.org-x-net/golang.org-x-net.bb index c3e55c0..da5193f 100644 --- a/recipes-net/golang.org-x-net/golang.org-x-net.bb +++ b/recipes-net/golang.org-x-net/golang.org-x-net.bb @@ -1,9 +1,13 @@ DESCRIPTION = "Go supplementary libraries" SECTION = "net" HOMEPAGE = "https://godoc.org/golang.org/x" -LICENSE = "MIT" +LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" +LIC_FILES_CHKSUM = "\ + file://net/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707 \ + file://crypto/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707 \ + file://text/LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707 \ + " GO_IMPORT = "golang.org/x" @@ -13,11 +17,13 @@ PROVIDES += "golang.org-x-text" inherit go SRC_URI = "\ - git://github.com/golang/net.git;protocol=https;name=net;destsuffix=${PN}-${PV}/src/golang.org/x/net \ - git://github.com/golang/crypto.git;protocol=https;name=crypto;destsuffix=${PN}-${PV}/src/golang.org/x/crypto \ - git://github.com/golang/text.git;protocol=https;name=text;destsuffix=${PN}-${PV}/src/golang.org/x/text \ + git://github.com/golang/net.git;protocol=https;name=net;destsuffix=git/net \ + git://github.com/golang/crypto.git;protocol=https;name=crypto;destsuffix=git/crypto \ + git://github.com/golang/text.git;protocol=https;name=text;destsuffix=git/text \ " SRCREV_net = "07b51741c1d6423d4a6abab1c49940ec09cb1aaf" SRCREV_crypto = "a548aac93ed489257b9d959b40fe1e8c1e20778c" SRCREV_text = "d69c40b4be55797923cec7457fac7a244d91a9b6" + +S = "${WORKDIR}/git" diff --git a/recipes-net/golang.org-x-oauth2/golang.org-x-oauth2.bb b/recipes-net/golang.org-x-oauth2/golang.org-x-oauth2.bb index dc761fe..41ddaa4 100644 --- a/recipes-net/golang.org-x-oauth2/golang.org-x-oauth2.bb +++ b/recipes-net/golang.org-x-oauth2/golang.org-x-oauth2.bb @@ -3,7 +3,7 @@ SECTION = "net" HOMEPAGE = "https://godoc.org/golang.org/x/oauth2" LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=704b1e0c436dbf193e7dcbd4cf06ec81" +LIC_FILES_CHKSUM = "file://LICENSE;md5=704b1e0c436dbf193e7dcbd4cf06ec81" GO_IMPORT = "golang.org/x/oauth2" @@ -15,7 +15,7 @@ DEPENDS = "\ inherit go SRC_URI = "\ - git://github.com/golang/oauth2.git;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT} \ + git://github.com/golang/oauth2.git;protocol=https \ " SRCREV = "4784bb855e56a530f1ce5d788959359ed6cb4a16" diff --git a/recipes-net/grpc/grpc-go.bb b/recipes-net/grpc/grpc-go.bb index 27d5991..1640523 100644 --- a/recipes-net/grpc/grpc-go.bb +++ b/recipes-net/grpc/grpc-go.bb @@ -1,10 +1,10 @@ DESCRIPTION = "The Go language implementation of gRPC. HTTP/2 based RPC" SECTION = "net" HOMEPAGE = "https://github.com/grpc/grpc-go" -LICENSE = "MIT" LICENSE = "BSD-3-Clause" -LIC_FILES_CHKSUM = "file://src/${GO_IMPORT}/LICENSE;md5=a4bad33881612090c6035d8393175996" +LIC_FILES_CHKSUM = "file://LICENSE;md5=a4bad33881612090c6035d8393175996" +S = "${WORKDIR}/git" GO_IMPORT = "google.golang.org/grpc" @@ -29,5 +29,5 @@ GO_INSTALL = "\ inherit go -SRC_URI = "git://github.com/grpc/grpc-go.git;protocol=https;destsuffix=${PN}-${PV}/src/${GO_IMPORT}" +SRC_URI = "git://github.com/grpc/grpc-go.git;protocol=https" SRCREV = "c2781963b3af261a37e0f14fdcb7c1fa13259e1f"