We have moved to Git. This repository is only provided for compatibility with old installations. Learn how to migrate your installation here.

comparison eclass/x-mgcf-golang-single.eclass @ 249:0685ed0fb913

[sync] imported 2c6bf87..18f98a6 from upstream commit 18f98a6f47cd77c1007b60dbfc7a838ffa99df0c Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 21:11:43 2023 +0200 app-crypt/acmetool: version bump to 0.2.2 commit ee2df4ec1deab61cd7bb7de2cd13ffdd066cc41a Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:30:58 2023 +0200 app-crypt/acmetool: split 0.2.1 from 9999, changed dependencies commit f3c9cf1c7a24619446390b0b71bf5bc090dfce77 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:29:33 2023 +0200 removed dependency to go-overlay commit b2057a9b0ba65917f3840a6b121c1e78397c4723 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:27:28 2023 +0200 golang eclasses: prefixed exported functions x-mgcf- commit e8d02d1edc997fec9e0b1e5d053a5b82ca4accf2 Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 19:08:52 2023 +0200 renamed golang eclasses, updated maintainer, added disclaimer commit 748ea4be8ee777bc788cb2a8801b118b41e6f8aa Author: Daniel Neugebauer <dneuge@energiequant.de> Date: Mon Mar 27 18:43:56 2023 +0200 copied eclasses for Go from go-overlay Reason: These eclasses are used to build app-crypt/acmetool. We previously imported go-overlay as a master repository to use the eclasses defined there but the overlay has been removed from official Gentoo overlay index due to inactivity. The removal broke new initial checkouts for this repository as go-overlay can no longer be found. Gentoo bug for MegaCoffee: https://bugs.gentoo.org/903167 Gentoo bug that caused removal: https://bugs.gentoo.org/864653 Original repository: https://github.com/Dr-Terrible/go-overlay
author Migration Sync <gentoo-overlay@megacoffee.net>
date Mon, 27 Mar 2023 19:15:01 +0000
parents
children
comparison
equal deleted inserted replaced
248:566e55bdfa9a 249:0685ed0fb913
1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 # @ECLASS: x-mgcf-golang-single.eclass
6 # @MAINTAINER:
7 # MegaCoffee Overlay <gentoo-overlay@megacoffee.net>
8 # @AUTHOR:
9 # Mauro Toffanin <toffanin.mauro@gmail.com>
10 # @BLURB: An eclass for GoLang packages not installed inside GOPATH/GOBIN.
11 # @DESCRIPTION:
12 # This eclass allows to install arbitrary packages written in GoLang which
13 # don't support being installed inside the Go environment.
14 # This mostly includes traditional packages (C/C++/GUI) embedding tools written
15 # in GoLang, and GoLang packages that need to be compiled with GCC instead of
16 # the standard Go interpreter.
17 #
18 # @EXAMPLE:
19 # Typical ebuild using golang-single.eclass:
20 #
21 # @CODE
22 # EAPI=5
23 #
24 # GOLANG_PKG_IMPORTPATH="github.com/captObvious"
25 # GOLANG_PKG_ARCHIVESUFFIX=".zip"
26 # GOLANG_PKG_HAVE_TEST
27 # inherit golang-single qt4-r2
28 #
29 # DESCRIPTION="Foo bar application"
30 # HOMEPAGE="http://example.org/foo/"
31 #
32 # LICENSE="MIT"
33 # KEYWORDS="~amd64 ~x86"
34 # SLOT="0"
35 # IUSE="doc qt4"
36 #
37 # CDEPEND="
38 # qt4? (
39 # dev-qt/qtcore:4
40 # dev-qt/qtgui:4
41 # )"
42 # RDEPEND="${CDEPEND}
43 # !media-gfx/bar"
44 # DEPEND="${CDEPEND}
45 # doc? ( app-doc/doxygen )"
46 #
47 # DOCS=(AUTHORS ChangeLog README "Read me.txt" TODO)
48 #
49 # PATCHES=(
50 # "${FILESDIR}/${P}-qt4.patch" # bug 123458
51 # "${FILESDIR}/${P}-as-needed.patch"
52 # )
53 #
54 # src_install() {
55 # use doc && HTML_DOCS=("${BUILD_DIR}/apidocs/html/")
56 # autotools-utils_src_install
57 # if use examples; then
58 # dobin "${BUILD_DIR}"/foo_example{1,2,3} \\
59 # || die 'dobin examples failed'
60 # fi
61 # }
62 #
63 # @CODE
64
65 inherit x-mgcf-golang-common
66
67 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
68 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
69 # !!! !!!
70 # !!! L E G A C Y E C L A S S !!!
71 # !!! !!!
72 # !!! DO NOT USE OUTSIDE OF MEGACOFFEE OVERLAY !!!
73 # !!! !!!
74 # !!! DO NOT USE FOR NEW EBUILDS !!!
75 # !!! !!!
76 # !!! This eclass has only been copied to megacoffee overlay from !!!
77 # !!! go-overlay: https://github.com/Dr-Terrible/go-overlay !!!
78 # !!! !!!
79 # !!! The only purpose is to keep currently depending ebuilds !!!
80 # !!! until they could be migrated to standard eclasses for Go, !!!
81 # !!! if suitable. !!!
82 # !!! !!!
83 # !!! go-overlay was previously imported by megacoffee until it !!!
84 # !!! got removed from Gentoo overlay index in March 2023, !!!
85 # !!! rendering megacoffee overlay unreachable as a result. !!!
86 # !!! !!!
87 # !!! Related bugs: https://bugs.gentoo.org/864653 !!!
88 # !!! https://bugs.gentoo.org/903167 !!!
89 # !!! !!!
90 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
91 # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
92
93
94 EXPORT_FUNCTIONS src_prepare src_unpack src_configure src_compile src_install src_test
95
96 if [[ -z ${_GOLANG_SINGLE_ECLASS} ]]; then
97 _GOLANG_SINGLE_ECLASS=1
98
99
100 # This eclass uses GOLANG_PKG_IMPORTPATH to populate SRC_URI.
101 SRC_URI="${SRC_URI:="https://${GOLANG_PKG_IMPORTPATH}/${GOLANG_PKG_NAME}/archive/${GOLANG_PKG_ARCHIVEPREFIX}${GOLANG_PKG_VERSION}${GOLANG_PKG_ARCHIVESUFFIX} -> ${P}${GOLANG_PKG_ARCHIVESUFFIX}"}"
102
103 # This eclass uses GOLANG_PKG_DEPENDENCIES associative array to populate SRC_URI
104 # with the required snapshots of the supplied GoLang dependencies.
105 if [[ ${#GOLANG_PKG_DEPENDENCIES[@]} -gt 0 ]]; then
106
107 for i in ${!GOLANG_PKG_DEPENDENCIES[@]} ; do
108
109 # Collects all the tokens of the dependency.
110 local -A DEPENDENCY=()
111 while read -d $'\n' key value; do
112 [[ -z ${key} ]] && continue
113 DEPENDENCY[$key]="${value}"
114 done <<-EOF
115 $( _factorize_dependency_entities "${GOLANG_PKG_DEPENDENCIES[$i]}" )
116 EOF
117
118 # Debug
119 debug-print "${FUNCNAME}: DEPENDENCY = ${GOLANG_PKG_DEPENDENCIES[$i]}"
120 debug-print "${FUNCNAME}: importpath = ${DEPENDENCY[importpath]}"
121 debug-print "${FUNCNAME}: revision = ${DEPENDENCY[revision]}"
122
123 # Downloads the archive.
124 case ${DEPENDENCY[importpath]} in
125 github*)
126 SRC_URI+=" https://${DEPENDENCY[importpath]}/archive/${DEPENDENCY[revision]}${GOLANG_PKG_ARCHIVESUFFIX} -> ${DEPENDENCY[importpath]//\//-}-${DEPENDENCY[revision]}${GOLANG_PKG_ARCHIVESUFFIX}"
127 ;;
128 bitbucket*)
129 SRC_URI+=" https://${DEPENDENCY[importpath]}/get/${DEPENDENCY[revision]}.zip -> ${DEPENDENCY[importpath]//\//-}-${DEPENDENCY[revision]}.zip"
130 ;;
131 code.google*)
132 SRC_URI+=" https://${DEPENDENCY[project_name]}.googlecode.com/archive/${DEPENDENCY[revision]}.tar.gz -> ${DEPENDENCY[importpath]//\//-}-${DEPENDENCY[revision]}.tar.gz"
133 ;;
134 *) die "This eclass doesn't support '${DEPENDENCY[importpath]}'" ;;
135 esac
136
137 done
138 fi
139
140
141 # @FUNCTION: x-mgcf-golang-single_src_unpack
142 # @DESCRIPTION:
143 # Unpack the source archive.
144 x-mgcf-golang-single_src_unpack() {
145 debug-print-function ${FUNCNAME} "${@}"
146
147 default
148
149 # Creates S.
150 mkdir -p "${S%/*}" || die
151
152 # Moves main GoLang package from WORKDIR into GOPATH.
153 if [[ "${GOLANG_PKG_IMPORTPATH}" != "${GOLANG_PKG_IMPORTPATH_ALIAS}" ]]; then
154 local alias_abspath="${WORKDIR}/gopath/src/${GOLANG_PKG_IMPORTPATH_ALIAS}/${GOLANG_PKG_NAME}"
155 mkdir -p "${alias_abspath%/*}" || die
156 mv "${GOLANG_PKG_NAME}-${GOLANG_PKG_VERSION}" "${alias_abspath}"/ || die
157 else
158 mv "${GOLANG_PKG_NAME}-${GOLANG_PKG_VERSION}" "${S}"/ || die
159 fi
160 }
161
162
163 # @FUNCTION: x-mgcf-golang-single_src_prepare
164 # @DESCRIPTION:
165 # Prepare source code.
166 x-mgcf-golang-single_src_prepare() {
167 debug-print-function ${FUNCNAME} "$@"
168
169 # Sets up GoLang build environment.
170 x-mgcf-golang_setup
171
172 x-mgcf-golang-common_src_prepare
173 }
174
175 # @FUNCTION: x-mgcf-golang-single_src_configure
176 # @DESCRIPTION:
177 # Configure the package.
178 x-mgcf-golang-single_src_configure() {
179 debug-print-function ${FUNCNAME} "$@"
180
181 x-mgcf-golang-common_src_configure
182 }
183
184 # @FUNCTION: x-mgcf-golang-single_src_compile
185 # @DESCRIPTION:
186 # Compiles the package.
187 x-mgcf-golang-single_src_compile() {
188 debug-print-function ${FUNCNAME} "$@"
189
190 x-mgcf-golang-common_src_compile
191 }
192
193 # @FUNCTION: x-mgcf-golang-single_src_install
194 # @DESCRIPTION:
195 # Installs binaries and documents from DOCS or HTML_DOCS arrays.
196 x-mgcf-golang-single_src_install() {
197 debug-print-function ${FUNCNAME} "$@"
198
199 x-mgcf-golang-common_src_install
200 }
201
202 # @FUNCTION: x-mgcf-golang-single_src_test
203 # @DESCRIPTION:
204 # Runs the unit tests for the main package.
205 x-mgcf-golang-single_src_test() {
206 debug-print-function ${FUNCNAME} "$@"
207
208 x-mgcf-golang-common_src_test
209 }
210
211 fi