1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # @ECLASS: golang-build.eclass
7 # William Hubbs <williamh@gentoo.org>
8 # @BLURB: Eclass that provides base functions for Go packages.
10 # This eclass provides base functions for software written in the Go
11 # programming language; it also provides the build-time dependency on
18 die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})"
22 if [[ -z ${_GOLANG_BASE} ]]; then
26 DEPEND=">=dev-lang/go-1.4.2:="
29 # @ECLASS-VARIABLE: EGO_PN
32 # This is the import path for the go package to build. Please emerge
33 # dev-lang/go and read "go help importpath" for syntax.
37 # EGO_PN=github.com/user/package
40 # @FUNCTION: ego_pn_check
42 # Make sure EGO_PN has a value.
44 [[ -z "${EGO_PN}" ]] &&
45 die "${ECLASS}.eclass: EGO_PN is not set"
49 # @FUNCTION: get_golibdir
51 # Return the non-prefixed library directory where Go packages
54 echo /usr/lib/go-gentoo
57 # @FUNCTION: get_golibdir_gopath
59 # Return the library directory where Go packages should be installed
60 # This is the prefixed version which should be included in GOPATH
61 get_golibdir_gopath() {
62 echo "${EPREFIX}$(get_golibdir)"
65 # @FUNCTION: golang_install_pkgs
67 # Install Go packages.
68 # This function assumes that $cwd is a Go workspace.
69 golang_install_pkgs() {
70 debug-print-function ${FUNCNAME} "$@"
73 insinto "$(get_golibdir)"
74 insopts -m0644 -p # preserve timestamps for bug 551486