summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/go.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/go.bbclass')
-rw-r--r--meta/classes-recipe/go.bbclass24
1 files changed, 7 insertions, 17 deletions
diff --git a/meta/classes-recipe/go.bbclass b/meta/classes-recipe/go.bbclass
index d32509aa6d..e0f667373e 100644
--- a/meta/classes-recipe/go.bbclass
+++ b/meta/classes-recipe/go.bbclass
@@ -7,6 +7,9 @@
7inherit goarch 7inherit goarch
8inherit linuxloader 8inherit linuxloader
9 9
10# if the GO_IMPORT is not set in recipe generate an error
11GO_IMPORT ??= "${@bb.fatal("The recipe needs to set GO_IMPORT for go.bbclass to work")}"
12
10GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}" 13GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"
11 14
12export GODEBUG = "gocachehash=1" 15export GODEBUG = "gocachehash=1"
@@ -15,13 +18,12 @@ GOROOT:class-native = "${STAGING_LIBDIR_NATIVE}/go"
15GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go" 18GOROOT:class-nativesdk = "${STAGING_DIR_TARGET}${libdir}/go"
16GOROOT = "${STAGING_LIBDIR}/go" 19GOROOT = "${STAGING_LIBDIR}/go"
17export GOROOT 20export GOROOT
18export GOROOT_FINAL = "${libdir}/go"
19export GOCACHE = "${B}/.cache" 21export GOCACHE = "${B}/.cache"
20 22
21export GOARCH = "${TARGET_GOARCH}" 23export GOARCH = "${TARGET_GOARCH}"
22export GOOS = "${TARGET_GOOS}" 24export GOOS = "${TARGET_GOOS}"
23export GOHOSTARCH="${BUILD_GOARCH}" 25export GOHOSTARCH = "${BUILD_GOARCH}"
24export GOHOSTOS="${BUILD_GOOS}" 26export GOHOSTOS = "${BUILD_GOOS}"
25 27
26GOARM[export] = "0" 28GOARM[export] = "0"
27GOARM:arm:class-target = "${TARGET_GOARM}" 29GOARM:arm:class-target = "${TARGET_GOARM}"
@@ -80,19 +82,7 @@ export GOPROXY ??= "https://proxy.golang.org,direct"
80export GOTMPDIR ?= "${WORKDIR}/build-tmp" 82export GOTMPDIR ?= "${WORKDIR}/build-tmp"
81GOTMPDIR[vardepvalue] = "" 83GOTMPDIR[vardepvalue] = ""
82 84
83python go_do_unpack() { 85GO_SRCURI_DESTSUFFIX = "${@os.path.join(os.path.basename(d.getVar('S')), 'src', d.getVar('GO_IMPORT')) + '/'}"
84 src_uri = (d.getVar('SRC_URI') or "").split()
85 if len(src_uri) == 0:
86 return
87
88 fetcher = bb.fetch2.Fetch(src_uri, d)
89 for url in fetcher.urls:
90 if fetcher.ud[url].type == 'git':
91 if fetcher.ud[url].parm.get('destsuffix') is None:
92 s_dirname = os.path.basename(d.getVar('S'))
93 fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src', d.getVar('GO_IMPORT')) + '/'
94 fetcher.unpack(d.getVar('WORKDIR'))
95}
96 86
97go_list_packages() { 87go_list_packages() {
98 ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \ 88 ${GO} list -f '{{.ImportPath}}' ${GOBUILDFLAGS} ${GO_INSTALL} | \
@@ -151,7 +141,7 @@ go_stage_testdata() {
151 cd "$oldwd" 141 cd "$oldwd"
152} 142}
153 143
154EXPORT_FUNCTIONS do_unpack do_configure do_compile do_install 144EXPORT_FUNCTIONS do_configure do_compile do_install
155 145
156FILES:${PN}-dev = "${libdir}/go/src" 146FILES:${PN}-dev = "${libdir}/go/src"
157FILES:${PN}-staticdev = "${libdir}/go/pkg" 147FILES:${PN}-staticdev = "${libdir}/go/pkg"