summaryrefslogtreecommitdiff
blob: 05d4e9a472aec7416fdf3c461e027b22a9650a19 (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
42
43
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
inherit go-module

EGIT_COMMIT=f4c2cfe
DESCRIPTION="Pure Go implementation of jq with yaml support"
HOMEPAGE="https://github.com/itchyny/gojq"
SRC_URI="https://github.com/itchyny/gojq/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
	https://dev.gentoo.org/~zmedico/dist/${P}-deps.tar.xz"

LICENSE="MIT"
LICENSE+=" Apache-2.0 BSD"
SLOT="0"
KEYWORDS="~amd64"
DOCS=(README.md)

src_prepare() {
	default
	local -a sed_args=(
		-e "s/^VERSION := .*/VERSION := ${PV}/"
		-e "s/^CURRENT_REVISION = .*/CURRENT_REVISION = ${EGIT_COMMIT}/"
	)
	# -buildmode=pie not supported when -race is enabled
	[[ ${GOFLAGS} == *buildmode=pie* ]] && sed_args+=(
		-e 's/ -race / /'
	)
	sed  "${sed_args[@]}" -i Makefile || die
}

src_compile() {
	emake build
}

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

src_test() {
	emake test
}