/[gentoo-x86]/eclass/golang-base.eclass
Gentoo

Contents of /eclass/golang-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Mon Jul 27 19:11:00 2015 UTC (4 years, 5 months ago) by williamh
Branch: MAIN
CVS Tags: HEAD
Add golang-base.eclass for the basic golang functions and set up the
other go eclasses to use it.

1 williamh 1.1 # Copyright 1999-2015 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v 1.4 2015/07/06 16:48:21 williamh Exp $
4    
5     # @ECLASS: golang-build.eclass
6     # @MAINTAINER:
7     # William Hubbs <williamh@gentoo.org>
8     # @BLURB: Eclass that provides base functions for Go packages.
9     # @DESCRIPTION:
10     # This eclass provides base functions for software written in the Go
11     # programming language; it also provides the build-time dependency on
12     # dev-lang/go.
13    
14     case "${EAPI:-0}" in
15     5)
16     ;;
17     *)
18     die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})"
19     ;;
20     esac
21    
22     if [[ -z ${_GOLANG_BASE} ]]; then
23    
24     _GOLANG_BASE=1
25    
26     DEPEND=">=dev-lang/go-1.4.2:="
27     STRIP_MASK="*.a"
28    
29     # @ECLASS-VARIABLE: EGO_PN
30     # @REQUIRED
31     # @DESCRIPTION:
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.
34     #
35     # Example:
36     # @CODE
37     # EGO_PN=github.com/user/package
38     # @CODE
39    
40     # @FUNCTION: ego_pn_check
41     # @DESCRIPTION:
42     # Make sure EGO_PN has a value.
43     ego_pn_check() {
44     [[ -z "${EGO_PN}" ]] &&
45     die "${ECLASS}.eclass: EGO_PN is not set"
46     return 0
47     }
48    
49     # @FUNCTION: get_golibdir
50     # @DESCRIPTION:
51     # Return the non-prefixed library directory where Go packages
52     # should be installed
53     get_golibdir() {
54     echo /usr/lib/go-gentoo
55     }
56    
57     # @FUNCTION: get_golibdir_gopath
58     # @DESCRIPTION:
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)"
63     }
64    
65     # @FUNCTION: golang_install_pkgs
66     # @DESCRIPTION:
67     # Install Go packages.
68     # This function assumes that $cwd is a Go workspace.
69     golang_install_pkgs() {
70     debug-print-function ${FUNCNAME} "$@"
71    
72     ego_pn_check
73     insinto "$(get_golibdir)"
74     insopts -m0644 -p # preserve timestamps for bug 551486
75     doins -r pkg src
76     }
77    
78     fi

  ViewVC Help
Powered by ViewVC 1.1.20