1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: golang-base.eclass
6 # William Hubbs <williamh@gentoo.org>
7 # @BLURB: Eclass that provides base functions for Go packages.
9 # This eclass provides base functions for software written in the Go
10 # programming language; it also provides the build-time dependency on
17 die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})"
21 if [[ -z ${_GOLANG_BASE} ]]; then
25 DEPEND=">=dev-lang/go-1.9"
27 # Do not complain about CFLAGS etc since go projects do not use them.
32 # @ECLASS-VARIABLE: EGO_PN
35 # This is the import path for the go package to build. Please emerge
36 # dev-lang/go and read "go help importpath" for syntax.
40 # EGO_PN=github.com/user/package
43 # @FUNCTION: ego_pn_check
45 # Make sure EGO_PN has a value.
47 [[ -z "${EGO_PN}" ]] &&
48 die "${ECLASS}.eclass: EGO_PN is not set"
52 # @FUNCTION: get_golibdir
54 # Return the non-prefixed library directory where Go packages
57 echo /usr/lib/go-gentoo
60 # @FUNCTION: get_golibdir_gopath
62 # Return the library directory where Go packages should be installed
63 # This is the prefixed version which should be included in GOPATH
64 get_golibdir_gopath() {
65 echo "${EPREFIX}$(get_golibdir)"
68 # @FUNCTION: golang_install_pkgs
70 # Install Go packages.
71 # This function assumes that $cwd is a Go workspace.
72 golang_install_pkgs() {
73 debug-print-function ${FUNCNAME} "$@"
76 insinto "$(get_golibdir)"
77 insopts -m0644 -p # preserve timestamps for bug 551486