All,

this doesn't affect any usage in the tree yet, but it will soon, so I
want to go ahead and add the support.

EGO_BUILD_FLAGS is a variable that allows you to pass build flags to the
go compiler; specifically it should be used for the flags documented in
"go help build" as common to the build and install commands.

William

Index: golang-build.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v
retrieving revision 1.6
diff -u -B -r1.6 golang-build.eclass
--- golang-build.eclass	27 Jul 2015 19:11:00 -0000	1.6
+++ golang-build.eclass	7 Aug 2015 20:37:13 -0000
@@ -26,6 +26,19 @@
 
 _GOLANG_BUILD=1
 
+# @ECLASS-VARIABLE: EGO_BUILD_FLAGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# This allows you to pass build flags to the Go compiler. These flags
+# are common to the "go build" and "go install" commands used below.
+# Please emerge dev-lang/go and run "go help build" for the
+# documentation for these flags.
+#
+# Example:
+# @CODE
+# EGO_BUILD_FLAGS="-ldflags \"-X main.version ${PV}\""
+# @CODE
+
 # @ECLASS-VARIABLE: EGO_PN
 # @REQUIRED
 # @DESCRIPTION:
@@ -42,7 +55,7 @@
 
 	ego_pn_check
 	set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
-		go build -v -work -x "${EGO_PN}"
+		go build -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
 	echo "$@"
 	"$@" || die
 }
@@ -52,7 +65,7 @@
 
 	ego_pn_check
 	set -- env GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
-		go install -v -work -x "${EGO_PN}"
+		go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}"
 	echo "$@"
 	"$@" || die
 	golang_install_pkgs

Attachment: signature.asc
Description: Digital signature

Reply via email to