aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-devtools/go/go-build_git.bb
blob: 3ac8608465ed81784d4ff879a103533cdc8446cb (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
HOMEPAGE = "https://github.com/lf-edge/runx"
SUMMARY = "console for runx"
DESCRIPTION = "Xen Runtime for OCI"

SRCREV_runx = "da0c75c58ae5232d19b1791c33545db3225e1ea9"
SRCREV_runc = "e4363b038787addfa12e8b0acf5417d4fba01693"

SRC_URI = "\
	  git://github.com/lf-edge/runx;nobranch=1;name=runx \
	  git://github.com/opencontainers/runc.git;nobranch=1;destsuffix=runc;name=runc \
          file://0001-build-use-instead-of-go.patch \
	  "
SRC_URI[md5sum] = "0d701ac1e2a67d47ce7127432df2c32b"
SRC_URI[sha256sum] = "5a26478906d5005f4f809402e981518d2b8844949199f60c4b6e1f986ca2a769"

LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=945fc9aa694796a6337395cc291ddd8c"

S = "${WORKDIR}/git"
PV = "0.1-git${SRCREV_runx}"

inherit features_check
REQUIRED_DISTRO_FEATURES = "vmsep"
GO_PARALLEL_BUILD ?= "${@oe.utils.parallel_make_argument(d, '-p %d')}"

inherit pkgconfig

GO_IMPORT = "import"
inherit go

RDEPENDS_${PN}-dev = "bash"

do_compile() {

    export GOARCH="${TARGET_GOARCH}"
    cd ${S}/src/import/gobuild
    mkdir -p go/src/github.com/opencontainers
    ln -sf ${WORKDIR}/runc ${S}/src/import/gobuild/go/src/github.com/opencontainers/runc
    export GOPATH="${S}/src/import/gobuild/go/src/github.com/opencontainers/runc"

    # Build the target binaries
    export GOARCH="${TARGET_GOARCH}"
    # Pass the needed cflags/ldflags so that cgo can find the needed headers files and libraries
    export CGO_ENABLED="1"
    export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
    export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
    export CFLAGS=""
    export LDFLAGS=""
    export CC="${CC}"
    export LD="${LD}"
    export GOBIN=""

    oe_runmake GO=${GO}
}

do_install() {

    install -d ${D}${datadir}/runX
    install -m 755 ${B}/src/import/gobuild/serial_fd_handler ${D}${datadir}/runX/
    install -m 755 ${B}/src/import/gobuild/recvtty ${D}${datadir}/runX/
 
}

FILES_${PN} += "${datadir}/runX/*"