1 |
On Wed, Jun 17, 2015 at 03:51:12PM -0500, William Hubbs wrote: |
2 |
> # Copyright 1999-2015 Gentoo Foundation |
3 |
> # Distributed under the terms of the GNU General Public License v2 |
4 |
> # $Header: $ |
5 |
> |
6 |
> # @ECLASS: golang-build.eclass |
7 |
> # @MAINTAINER: |
8 |
> # William Hubbs <williamh@g.o> |
9 |
> # @BLURB: Eclass for compiling go packages. |
10 |
> # @DESCRIPTION: |
11 |
> # This eclass provides default src_compile, src_test and src_install |
12 |
> # functions for software written in the Go programming language. |
13 |
> |
14 |
> case "${EAPI:-0}" in |
15 |
> 5) |
16 |
> ;; |
17 |
> *) |
18 |
> die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})" |
19 |
> ;; |
20 |
> esac |
21 |
> |
22 |
> # Note that src_install is not exported. This is deliberate. You should |
23 |
> # run this function from your src_install function then follow up with |
24 |
> # installing everything in the image. |
25 |
> EXPORT_FUNCTIONS src_compile src_test |
26 |
> |
27 |
> if [[ -z ${_GOLANG} ]]; then |
28 |
> |
29 |
|
30 |
This is fixed, it should be GOLANG_BUILD |
31 |
|
32 |
> _GOLANG=1 |
33 |
> |
34 |
|
35 |
So is this. |
36 |
|
37 |
> DEPEND=">=dev-lang/go-1.4.2" |
38 |
> |
39 |
> # @ECLASS-VARIABLE: EGO_PN_BUILD |
40 |
> # @REQUIRED |
41 |
> # @DESCRIPTION: |
42 |
> # This is the import path for the go package(s) to build. Please emerge |
43 |
> # dev-lang/go and read "go help importpath" for syntax. |
44 |
> # |
45 |
> # If it is not set, we try to set it to EGO_PN assuming that you used |
46 |
> # the golang-vcs eclass. |
47 |
> # |
48 |
> # Example: |
49 |
> # @CODE |
50 |
> # EGO_PN_BUILD=github.com/user/package |
51 |
> # @CODE |
52 |
> |
53 |
> # @FUNCTION: _golang-build_setup |
54 |
> # @INTERNAL |
55 |
> # @DESCRIPTION: |
56 |
> # Add ${WORKDIR}/${P} to the front of GOPATH if necessary and make sure |
57 |
> # EGO_PN_BUILD has a value. |
58 |
> _golang-build_setup() { |
59 |
> case "$GOPATH" in |
60 |
> ${WORKDIR}/${P}*) ;; |
61 |
> *) [[ -n "${GOPATH}" ]] && |
62 |
> export GOPATH="${WORKDIR}/${P}:${GOPATH}" || |
63 |
> export GOPATH="${WORKDIR}/${P}" |
64 |
> ;; |
65 |
> esac |
66 |
> |
67 |
> [ -z "${EGO_PN_BUILD}" ] && |
68 |
> [ -n "${EGO_PN}" ] && |
69 |
> EGO_PN_BUILD="${EGO_PN}" |
70 |
> [ -z "${EGO_PN_BUILD}" ] && |
71 |
> die "${ECLASS}.eclass: EGO_PN_BUILD is not set" |
72 |
> return 0 |
73 |
> } |
74 |
> |
75 |
> golang-build_src_compile() { |
76 |
> debug-print-function ${FUNCNAME} "$@" |
77 |
> |
78 |
> _golang-build_setup |
79 |
> set -- go build -d -v -work -x "${EGO_PN_BUILD}" |
80 |
> echo "$@" |
81 |
> "$@" || die |
82 |
> } |
83 |
> |
84 |
> golang-build_src_install() { |
85 |
> debug-print-function ${FUNCNAME} "$@" |
86 |
> |
87 |
> _golang-build_setup |
88 |
> set -- go install -d -v -work -x "${EGO_PN_BUILD}" |
89 |
> echo "$@" |
90 |
> "$@" || die |
91 |
> } |
92 |
> |
93 |
> golang-build_src_test() { |
94 |
> debug-print-function ${FUNCNAME} "$@" |
95 |
> |
96 |
> _golang-build_setup |
97 |
> set -- go test -v -x ${EGO_PN_BUILD} |
98 |
> echo "$@" |
99 |
> "$@" || die |
100 |
> } |
101 |
> |
102 |
> fi |