All,

after some testing, i decided that the eclass should make both the
golibdir and the prefixed version of it available with functions.

The reason for this is that the prefixed golibdir should be part of
GOPATH when building packages.

The functions are get_golibdir and get_golibdir_gopath.

Here's the updated patch.

William

Index: golang-build.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v
retrieving revision 1.4
diff -u -B -r1.4 golang-build.eclass
--- golang-build.eclass	6 Jul 2015 16:48:21 -0000	1.4
+++ golang-build.eclass	22 Jul 2015 22:05:03 -0000
@@ -48,11 +48,40 @@
 	return 0
 }
 
+# @FUNCTION: get_golibdir
+# @DESCRIPTION:
+# Return the non-prefixed library directory where Go packages
+# should be installed
+get_golibdir() {
+	echo /usr/lib/go-gentoo
+}
+
+# @FUNCTION: get_golibdir
+# @DESCRIPTION:
+# Return the library directory where Go packages should be installed
+# This is the prefixed version which should be included in GOPATH
+get_golibdir_gopath() {
+	echo "${EPREFIX}$(get_golibdir)"
+}
+
+# @FUNCTION: golang_install_pkgs
+# @DESCRIPTION:
+# Install Go packages.
+# This function assumes that $cwd is a Go workspace.
+golang_install_pkgs() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	_golang-build_setup
+	insinto "$(get_golibdir)"
+	insopts -m0644 -p # preserve timestamps for bug 551486
+	doins -r pkg src
+}
+
 golang-build_src_compile() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	_golang-build_setup
-	set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
+	set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
 		go build -v -work -x "${EGO_PN}"
 	echo "$@"
 	"$@" || die
@@ -62,20 +91,18 @@
 	debug-print-function ${FUNCNAME} "$@"
 
 	_golang-build_setup
-	set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
+	set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
 		go install -v -work -x "${EGO_PN}"
 	echo "$@"
 	"$@" || die
-	insinto /usr/lib/go-gentoo
-	insopts -m0644 -p # preserve timestamps for bug 551486
-	doins -r pkg src
+	golang_install_pkgs
 }
 
 golang-build_src_test() {
 	debug-print-function ${FUNCNAME} "$@"
 
 	_golang-build_setup
-	set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
+	set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
 		go test -v -work -x "${EGO_PN}"
 	echo "$@"
 	"$@" || die

Attachment: signature.asc
Description: Digital signature

Reply via email to