summaryrefslogtreecommitdiff
blob: 8609714f08d78dc50c3d16b52e77807aef432a49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
inherit go-module

DESCRIPTION="A Go tool to auto generate methods for your enums"
HOMEPAGE="https://github.com/dmarkham/enumer"
SRC_URI="https://github.com/dmarkham/enumer/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://dev.gentoo.org/~zmedico/dist/${P}-deps.tar.xz"

LICENSE="BSD-2"
LICENSE+=" BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~riscv"
DOCS=(README.md)

src_prepare() {
	default
	local sed_args=()
	# -buildmode=pie not supported when -race is enabled
	[[ ${GOFLAGS} == *buildmode=pie* ]] && sed_args+=(
		-e 's/ -race / /'
	)
	if [[ ${#sed_args[@]} -gt 0 ]]; then
		sed  "${sed_args[@]}" -i Makefile || die
	fi
}

src_compile() {
	CGO_ENABLED=0 ego build -a -o ./enumer .
}

src_install() {
	einstalldocs
	dobin "${PN}"
}

src_test() {
	emake test
}