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:="
28 # Do not complain about CFLAGS etc since go projects do not use them.
33 # @ECLASS-VARIABLE: EGO_PN
36 # This is the import path for the go package to build. Please emerge
37 # dev-lang/go and read "go help importpath" for syntax.
41 # EGO_PN=github.com/user/package
44 # @FUNCTION: ego_pn_check
46 # Make sure EGO_PN has a value.
48 [[ -z "${EGO_PN}" ]] &&
49 die "${ECLASS}.eclass: EGO_PN is not set"
53 # @FUNCTION: get_golibdir
55 # Return the non-prefixed library directory where Go packages
58 echo /usr/lib/go-gentoo
61 # @FUNCTION: get_golibdir_gopath
63 # Return the library directory where Go packages should be installed
64 # This is the prefixed version which should be included in GOPATH
65 get_golibdir_gopath() {
66 echo "${EPREFIX}$(get_golibdir)"
69 # @FUNCTION: golang_install_pkgs
71 # Install Go packages.
72 # This function assumes that $cwd is a Go workspace.
73 golang_install_pkgs() {
74 debug-print-function ${FUNCNAME} "$@"
77 insinto "$(get_golibdir)"
78 insopts -m0644 -p # preserve timestamps for bug 551486