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 # @SUPPORTED_EAPIS: 5 6 7
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 GO_DEPEND=">=dev-lang/go-1.10"
27 if [[ ${EAPI:-0} == [56] ]]; then
30 BDEPEND="${GO_DEPEND}"
33 # Do not complain about CFLAGS etc since go projects do not use them.
36 # Upstream does not support stripping go packages
39 # @ECLASS-VARIABLE: EGO_PN
42 # This is the import path for the go package to build. Please emerge
43 # dev-lang/go and read "go help importpath" for syntax.
47 # EGO_PN=github.com/user/package
50 # @FUNCTION: ego_pn_check
52 # Make sure EGO_PN has a value.
54 [[ -z "${EGO_PN}" ]] &&
55 die "${ECLASS}.eclass: EGO_PN is not set"
59 # @FUNCTION: get_golibdir
61 # Return the non-prefixed library directory where Go packages
64 echo /usr/lib/go-gentoo
67 # @FUNCTION: get_golibdir_gopath
69 # Return the library directory where Go packages should be installed
70 # This is the prefixed version which should be included in GOPATH
71 get_golibdir_gopath() {
72 echo "${EPREFIX}$(get_golibdir)"
75 # @FUNCTION: golang_install_pkgs
77 # Install Go packages.
78 # This function assumes that $cwd is a Go workspace.
79 golang_install_pkgs() {
80 debug-print-function ${FUNCNAME} "$@"
83 insinto "$(get_golibdir)"
84 insopts -m0644 -p # preserve timestamps for bug 551486