blob: 52587358b1448b14f27cea600e123ae10a122718 [file] [log] [blame]
Jackie Huang57fdea72020-04-23 11:29:15 +08001#
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
16DESCRIPTION = "StarlingX distributedcloud packages collection"
17HOMEPAGE = "https://opendev.org/starlingx"
18SECTION = "network"
19LICENSE = "Apache-2.0"
20LIC_FILES_CHKSUM = "file://src/registry-token-server/registry-token-server/src/LICENSE;md5=d2794c0df5b907fdace235a619d80314"
21
22PROTOCOL = "https"
23BRANCH = "r/stx.3.0"
24SRCNAME = "containers"
25SRCREV = "1a4b803e946b488c1f3adb25ab0614d1b0c3c9b8"
26PV = "1.0.0+git${SRCPV}"
27S = "${WORKDIR}/git"
28
29SRC_URI = "git://opendev.org/starlingx/${SRCNAME}.git;protocol=${PROTOCOL};rev=${SRCREV};branch=${BRANCH}"
30
31GO_IMPORT = "registry-token-server"
32
33RDEPENDS_${PN}-dev_append = " \
34 systemd \
35 "
36
37DEPENDS += "\
38 go-logrus \
39 docker-distribution \
40 go-libtrust \
41 go-patricia \
42 go-mux \
43 go-context \
44 go-phercloud \
45 "
46
47RDEPENDS_${PN} = " \
48 docker-distribution \
49 docker-ce \
50 "
51
52inherit go goarch ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
53
54do_compile() {
55 mkdir -p _build/src
56 ln -sfn ${S}/src/registry-token-server/registry-token-server/src/ ./_build/src/registry-token-server
57
58 # Pass the needed cflags/ldflags so that cgo
59 # can find the needed headers files and libraries
60 export GOARCH=${TARGET_GOARCH}
61 export CGO_ENABLED="1"
62 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
63 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
64
65 export GOPATH="${WORKDIR}/build/_build:${STAGING_DIR_TARGET}/${prefix}/local/go"
66 cd _build/src/${GO_IMPORT}
67 #oe_runmake registry-token-server
68 export GOROOT=${STAGING_DIR_TARGET}/${prefix}/local/go
69 go build -o ${WORKDIR}/build/bin/registry-token-server registry-token-server
70}
71
72SYSTEMD_PACKAGES = "${PN}"
73SYSTEMD_SERVICE_${PN} = "registry-token-server.service"
74SYSTEMD_AUTO_ENABLE = "disable"
75
76do_install() {
77 SRCPATH="${S}/src/registry-token-server/registry-token-server/centos/files"
78 install -d ${D}/${bindir}
79 install -m 0755 bin/registry-token-server ${D}/${bindir}
80 install -d -m 0755 ${D}/${sysconfdir}/registry-token-server/registry
81 install -m 0644 ${SRCPATH}//token_server.conf ${D}/${sysconfdir}/registry-token-server/registry
82
83 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
84 install -d ${D}${systemd_unitdir}/system
85 install -m 0644 ${SRCPATH}/registry-token-server.service ${D}${systemd_unitdir}/system/
86 fi
87}
88