summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2015-08-09 11:50:25 -0500
committerWilliam Hubbs <williamh@gentoo.org>2015-08-10 09:27:53 -0500
commitfbfc50c70e13f14050ad9cf1893a111f4c98bf18 (patch)
tree68687a8510c67ef71ccffe1f61ebedd6e13425ad /eclass/golang-build.eclass
parentConvert CVS style headers back to git style headers (diff)
downloadgentoo-fbfc50c70e13f14050ad9cf1893a111f4c98bf18.tar.gz
gentoo-fbfc50c70e13f14050ad9cf1893a111f4c98bf18.tar.bz2
gentoo-fbfc50c70e13f14050ad9cf1893a111f4c98bf18.zip
golang-build.eclass: add support for EGO_BUILD_FLAGS
Diffstat (limited to 'eclass/golang-build.eclass')
-rw-r--r--eclass/golang-build.eclass17
1 files changed, 15 insertions, 2 deletions
diff --git a/eclass/golang-build.eclass b/eclass/golang-build.eclass
index 6f5a1578ed04..7a7e567b162b 100644
--- a/eclass/golang-build.eclass
+++ b/eclass/golang-build.eclass
@@ -26,6 +26,19 @@ if [[ -z ${_GOLANG_BUILD} ]]; then
_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 @@ golang-build_src_compile() {
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 @@ golang-build_src_install() {
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