blob: 759cd6168ab8c0cbc830323216746f5e9d08f2bf (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
SUMMARY = "a lightweight and portable command-line YAML processor"
HOMEPAGE = "https://github.com/mikefarah/yq"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=e40a0dcd62f8269b9bff37fe9aa7dcc2"
SRCREV_yq = "0f4fb8d35ec1a939d78dd6862f494d19ec589f19"
SRCREV_FORMAT = "yq"
SRC_URI = "git://github.com/mikefarah/yq.git;name=yq;branch=master;protocol=https;destsuffix=${GO_SRCURI_DESTSUFFIX} \
file://run-ptest \
"
# GO_MOD_FETCH_MODE: "vcs" (all git://) or "hybrid" (gomod:// + git://)
GO_MOD_FETCH_MODE ?= "hybrid"
# VCS mode: all modules via git://
include ${@ "go-mod-git.inc" if d.getVar("GO_MOD_FETCH_MODE") == "vcs" else ""}
include ${@ "go-mod-cache.inc" if d.getVar("GO_MOD_FETCH_MODE") == "vcs" else ""}
# Hybrid mode: gomod:// for most, git:// for selected
include ${@ "go-mod-hybrid-gomod.inc" if d.getVar("GO_MOD_FETCH_MODE") == "hybrid" else ""}
include ${@ "go-mod-hybrid-git.inc" if d.getVar("GO_MOD_FETCH_MODE") == "hybrid" else ""}
include ${@ "go-mod-hybrid-cache.inc" if d.getVar("GO_MOD_FETCH_MODE") == "hybrid" else ""}
PV = "4.52.5+git"
GO_IMPORT = "import"
# go-mod-discovery configuration
GO_MOD_DISCOVERY_BUILD_TARGET = "./..."
GO_MOD_DISCOVERY_GIT_REPO = "https://github.com/mikefarah/yq.git"
GO_MOD_DISCOVERY_GIT_REF = "${SRCREV_yq}"
inherit go goarch ptest
inherit go-mod-discovery
# GO's internal linker doesn't support PIE for linux 32 bits target,
# so -buildmode=pie requires external (cgo) linking on ARM and x86.
GOBUILDFLAGS:remove = "-buildmode=pie"
do_compile() {
cd ${S}/src/import
export GOPATH="${S}/src/import/.gopath:${STAGING_DIR_TARGET}/${prefix}/local/go"
export CGO_ENABLED="0"
${GO} build -trimpath ${GOBUILDFLAGS} -o ${B}/yq .
}
do_install() {
install -d ${D}${bindir}
install -m 0755 ${B}/yq ${D}${bindir}/yq
}
do_install_ptest() {
install -d ${D}${PTEST_PATH}/tests
cp -r ${S}/src/import/scripts/* ${D}${PTEST_PATH}/tests
cp -r ${S}/src/import/acceptance_tests/* ${D}${PTEST_PATH}/tests
cp -r ${S}/src/import/examples ${D}${PTEST_PATH}/tests
}
RDEPENDS:${PN}-ptest += "bash"
RDEPENDS:${PN}-dev += "bash"
BBCLASSEXTEND = "native"
|