aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Madison <matt@madison.systems>2017-09-13 14:54:06 -0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-13 22:12:19 +0100
commit5624a773e4db3ad2251641e69b04dc380e74a4c7 (patch)
treee8e132b746e0e60936ae28c9dec48c1baee62091
parentf562b5e91c12ab67140de537ea269fe1ac85a764 (diff)
downloadopenembedded-core-5624a773e4db3ad2251641e69b04dc380e74a4c7.zip
openembedded-core-5624a773e4db3ad2251641e69b04dc380e74a4c7.tar.gz
openembedded-core-5624a773e4db3ad2251641e69b04dc380e74a4c7.tar.bz2
go.bbclass: add support linking against shared runtime
For architectures that support it, use the -linkshared build option to build packages against the shared Go runtime. Signed-off-by: Matt Madison <matt@madison.systems> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/go.bbclass11
1 files changed, 9 insertions, 2 deletions
diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index 8d363e8..d805dc2 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -31,7 +31,14 @@ DEPENDS_GOLANG_class-nativesdk = "virtual/${TARGET_PREFIX}go-crosssdk virtual/${
DEPENDS_append = " ${DEPENDS_GOLANG}"
-export GOBUILDFLAGS ?= "-v"
+GO_LINKSHARED ?= "${@'-linkshared' if d.getVar('GO_DYNLINK') else ''}"
+GO_RPATH_LINK = "${@'-Wl,-rpath-link=${STAGING_DIR_TARGET}${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
+GO_RPATH = "${@'-r ${libdir}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
+GO_RPATH_class-native = "${@'-r ${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
+GO_RPATH_LINK_class-native = "${@'-Wl,-rpath-link=${STAGING_LIBDIR_NATIVE}/go/pkg/${TARGET_GOTUPLE}_dynlink' if d.getVar('GO_DYNLINK') else ''}"
+GO_EXTLDFLAGS ?= "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${GO_RPATH_LINK} ${LDFLAGS}"
+GO_LDFLAGS ?= '-ldflags="${GO_RPATH} -extldflags '${GO_EXTLDFLAGS}'"'
+export GOBUILDFLAGS ?= "-v ${GO_LDFLAGS}"
GOBUILDFLAGS_prepend_task-compile = "${GO_PARALLEL_BUILD} "
export GO = "${HOST_PREFIX}go"
@@ -81,7 +88,7 @@ go_do_configure() {
go_do_compile() {
${GO} env
if [ -n "${GO_INSTALL}" ]; then
- ${GO} install ${GOBUILDFLAGS} `go_list_packages`
+ ${GO} install ${GO_LINKSHARED} ${GOBUILDFLAGS} `go_list_packages`
fi
}
do_compile[cleandirs] = "${B}/bin ${B}/pkg"