Add initial meta-stx to support StarlingX build
[pti/rtp.git] / meta-stx / recipes-containers / docker-forward-journald / docker-forward-journald_git.bb
1 #
2 ## Copyright (C) 2019 Wind River Systems, Inc.
3 #
4 #  Licensed under the Apache License, Version 2.0 (the "License");
5 #  you may not use this file except in compliance with the License.
6 #  You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 #  Unless required by applicable law or agreed to in writing, software
11 #  distributed under the License is distributed on an "AS IS" BASIS,
12 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 #  See the License for the specific language governing permissions and
14 #  limitations under the License.
15
16 SUMMARY = "Forward stdin to journald"
17 HOMEPAGE = "https://github.com/docker/docker"
18 SECTION = "devel"
19 LICENSE = "Apache-2.0"
20 LIC_FILES_CHKSUM = "file://src/forward-journald/LICENSE;md5=e3fc50a88d0a364313df4b21ef20c29e"
21
22 PROTOCOL = "https"
23 SRCNAME = "forward-journald"
24 SRCREV = "77e02a9774a6ca054e41c27f6f319d701f1cbaea"
25 PV = "1.10.3+git${SRCPV}"
26 S = "${WORKDIR}/git"
27
28 SRC_URI = "git://github.com/projectatomic/${SRCNAME}.git;protocol=${PROTOCOL};rev=${SRCREV};"
29
30 GO_IMPORT = "forward-journald"
31 inherit go goarch
32
33 do_compile() {
34         mkdir -p _build/src
35         ln -sfn ${S}/src/forward-journald ./_build/src/${SRCNAME}
36         export GOARCH=${TARGET_GOARCH}
37         export CGO_ENABLED="1"
38         export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
39         export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
40
41         export GOPATH="${WORKDIR}/build/_build:${STAGING_DIR_TARGET}/${prefix}/local/go"
42         cd _build/src/${SRCNAME}
43         export GOROOT=${STAGING_DIR_TARGET}/${prefix}/local/go
44         go build -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -o ${WORKDIR}/build/bin/forward-journald forward-journald
45 }
46
47 do_install() {
48         install -m 0755 -d ${D}/${bindir}/
49
50         install -m 0755 bin/forward-journald ${D}/${bindir}/
51 }
52
53 INSANE_SKIP_${PN} = "ldflags"