Gentoo Archives: gentoo-commits

From: "William Hubbs (williamh)" <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: ChangeLog golang-build.eclass
Date: Wed, 24 Jun 2015 15:38:45
Message-Id: 20150624153834.0C4A8A54@oystercatcher.gentoo.org
1 williamh 15/06/24 15:38:34
2
3 Modified: ChangeLog
4 Added: golang-build.eclass
5 Log:
6 Add an eclass for building Go software
7
8 Revision Changes Path
9 1.1683 eclass/ChangeLog
10
11 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1683&view=markup
12 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1683&content-type=text/plain
13 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1682&r2=1.1683
14
15 Index: ChangeLog
16 ===================================================================
17 RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v
18 retrieving revision 1.1682
19 retrieving revision 1.1683
20 diff -u -r1.1682 -r1.1683
21 --- ChangeLog 24 Jun 2015 13:36:03 -0000 1.1682
22 +++ ChangeLog 24 Jun 2015 15:38:33 -0000 1.1683
23 @@ -1,6 +1,9 @@
24 # ChangeLog for eclass directory
25 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
26 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1682 2015/06/24 13:36:03 grknight Exp $
27 +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1683 2015/06/24 15:38:33 williamh Exp $
28 +
29 + 24 Jun 2015; William Hubbs <williamh@g.o> +golang-build.eclass:
30 + Add an eclass for building Go software
31
32 24 Jun 2015; <grknight@g.o> depend.php.eclass:
33 depend.php.eclass is deprecated and is set to be removed 30 days after bug
34
35
36
37 1.1 eclass/golang-build.eclass
38
39 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/golang-build.eclass?rev=1.1&view=markup
40 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/golang-build.eclass?rev=1.1&content-type=text/plain
41
42 Index: golang-build.eclass
43 ===================================================================
44 # Copyright 1999-2015 Gentoo Foundation
45 # Distributed under the terms of the GNU General Public License v2
46 # $Header: /var/cvsroot/gentoo-x86/eclass/golang-build.eclass,v 1.1 2015/06/24 15:38:33 williamh Exp $
47
48 # @ECLASS: golang-build.eclass
49 # @MAINTAINER:
50 # William Hubbs <williamh@g.o>
51 # @BLURB: Eclass for compiling go packages.
52 # @DESCRIPTION:
53 # This eclass provides default src_compile, src_test and src_install
54 # functions for software written in the Go programming language.
55
56 case "${EAPI:-0}" in
57 5)
58 ;;
59 *)
60 die "${ECLASS}: Unsupported eapi (EAPI=${EAPI})"
61 ;;
62 esac
63
64 EXPORT_FUNCTIONS src_compile src_install src_test
65
66 if [[ -z ${_GOLANG_BUILD} ]]; then
67
68 _GOLANG_BUILD=1
69
70 DEPEND=">=dev-lang/go-1.4.2:="
71 STRIP_MASK="*.a"
72
73 # @ECLASS-VARIABLE: EGO_PN
74 # @REQUIRED
75 # @DESCRIPTION:
76 # This is the import path for the go package(s) to build. Please emerge
77 # dev-lang/go and read "go help importpath" for syntax.
78 #
79 # Example:
80 # @CODE
81 # EGO_PN=github.com/user/package
82 # @CODE
83
84 # @FUNCTION: _golang-build_setup
85 # @INTERNAL
86 # @DESCRIPTION:
87 # Make sure EGO_PN has a value.
88 _golang-build_setup() {
89 [ -z "${EGO_PN}" ] &&
90 die "${ECLASS}.eclass: EGO_PN is not set"
91 return 0
92 }
93
94 golang-build_src_compile() {
95 debug-print-function ${FUNCNAME} "$@"
96
97 _golang-build_setup
98 set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
99 go build -v -work -x "${EGO_PN}"
100 echo "$@"
101 "$@" || die
102 }
103
104 golang-build_src_install() {
105 debug-print-function ${FUNCNAME} "$@"
106
107 _golang-build_setup
108 set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
109 go install -v -work -x "${EGO_PN}"
110 echo "$@"
111 "$@" || die
112 insinto /usr/lib/go-gentoo
113 insopts -m0644 -p # preserve timestamps for bug 551486
114 doins -r pkg src
115 }
116
117 golang-build_src_test() {
118 debug-print-function ${FUNCNAME} "$@"
119
120 _golang-build_setup
121 set -- env GOPATH="${WORKDIR}/${P}:${EPREFIX}/usr/lib/go-gentoo" \
122 go test -v -work -x "${EGO_PN}"
123 echo "$@"
124 "$@" || die
125 }
126
127 fi