2 # Copyright (C) 2019 Wind River Systems, Inc.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 DESCRIPTION = " Token server for use with Docker registry with Openstack Keystone back end"
17 LICENSE = "Apache-2.0"
18 LIC_FILES_CHKSUM = "file://LICENSE;md5=d2794c0df5b907fdace235a619d80314"
20 GO_IMPORT = "registry-token-server"
22 SRC_URI = "file://registry-token-server-1.0.0.tar.gz \
23 file://registry-token-server.service \
24 file://token_server.conf \
27 RDEPENDS_${PN}-dev_append = "systemd"
39 inherit go goarch ${@bb.utils.contains('VIRTUAL-RUNTIME_init_manager','systemd','systemd','', d)}
43 ln -sfn ${WORKDIR}/${PN}-${PV} ./_build/src/registry-token-server
45 # Pass the needed cflags/ldflags so that cgo
46 # can find the needed headers files and libraries
47 export GOARCH=${TARGET_GOARCH}
48 export CGO_ENABLED="1"
49 export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
50 export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
52 export GOPATH="${WORKDIR}/build/_build:${STAGING_DIR_TARGET}/${prefix}/local/go"
53 cd _build/src/${GO_IMPORT}
54 #oe_runmake registry-token-server
55 export GOROOT=${STAGING_DIR_TARGET}/${prefix}/local/go
56 go build -o ${WORKDIR}/build/bin/registry-token-server registry-token-server
59 SYSTEMD_PACKAGES = "${PN}"
60 SYSTEMD_SERVICE_${PN} = "registry-token-server.service"
61 SYSTEMD_AUTO_ENABLE = "enable"
64 install -d ${D}/${sbindir}
65 install -m 0755 bin/registry-token-server ${D}/${sbindir}
66 install -d ${D}/${sysconfdir}/registry-token-server/registry
67 install -m 0644 ${WORKDIR}/token_server.conf ${D}/${sysconfdir}/registry-token-server/registry
69 if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
70 install -d ${D}${systemd_unitdir}/system
71 install -m 0644 ${WORKDIR}/registry-token-server.service ${D}${systemd_unitdir}/system/