mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-19 20:59:41 +02:00
docker: restructure to build docker-proxy using provided Makefile
Rather than invoking go directly to build docker-proxy, we can use the libnetwork Make infrastructure. This picks up our exported go enviroment variables, and other sysroot flags. We also apply one patch to ensure that the cross-go toolchain is used, and that the proper build flags are used. Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
parent
b51b71e577
commit
ab3965109b
|
@ -23,10 +23,11 @@ SRCREV_libnetwork = "4cb38c2987c236dce03c868d99b57b1e28a4b81c"
|
||||||
SRCREV_cli = "0f1bb353423e45e02315e985bd9ddebe6da18457"
|
SRCREV_cli = "0f1bb353423e45e02315e985bd9ddebe6da18457"
|
||||||
SRC_URI = "\
|
SRC_URI = "\
|
||||||
git://github.com/moby/moby.git;nobranch=1;name=docker \
|
git://github.com/moby/moby.git;nobranch=1;name=docker \
|
||||||
git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=libnetwork \
|
git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \
|
||||||
git://github.com/docker/cli;branch=master;name=cli;destsuffix=cli \
|
git://github.com/docker/cli;branch=master;name=cli;destsuffix=git/cli \
|
||||||
file://docker.init \
|
file://docker.init \
|
||||||
file://hi.Dockerfile \
|
file://hi.Dockerfile \
|
||||||
|
file://0001-libnetwork-use-GO-instead-of-go.patch \
|
||||||
"
|
"
|
||||||
|
|
||||||
# Apache-2.0 for docker
|
# Apache-2.0 for docker
|
||||||
|
@ -91,8 +92,8 @@ do_compile() {
|
||||||
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
|
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
|
||||||
|
|
||||||
mkdir -p .gopath/src/github.com/docker
|
mkdir -p .gopath/src/github.com/docker
|
||||||
ln -sf ${WORKDIR}/libnetwork .gopath/src/github.com/docker/libnetwork
|
ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
|
||||||
ln -sf ${WORKDIR}/cli .gopath/src/github.com/docker/cli
|
ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli
|
||||||
|
|
||||||
export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
|
export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
|
||||||
export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
|
export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
|
||||||
|
@ -115,15 +116,16 @@ do_compile() {
|
||||||
# to build this:
|
# to build this:
|
||||||
VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary
|
VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" ./hack/make.sh dynbinary
|
||||||
|
|
||||||
# build the proxy
|
|
||||||
go build -o ${S}/src/import/docker-proxy github.com/docker/libnetwork/cmd/proxy
|
|
||||||
|
|
||||||
# build the cli
|
# build the cli
|
||||||
cd ${S}/src/import/.gopath/src/github.com/docker/cli
|
cd ${S}/src/import/.gopath/src/github.com/docker/cli
|
||||||
export CFLAGS=""
|
export CFLAGS=""
|
||||||
export LDFLAGS=""
|
export LDFLAGS=""
|
||||||
export DOCKER_VERSION=${DOCKER_VERSION}
|
export DOCKER_VERSION=${DOCKER_VERSION}
|
||||||
VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
|
VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
|
||||||
|
|
||||||
|
# build the proxy
|
||||||
|
cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
|
||||||
|
oe_runmake cross-local
|
||||||
}
|
}
|
||||||
|
|
||||||
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
|
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
|
||||||
|
@ -137,9 +139,9 @@ INITSCRIPT_PARAMS_${PN} = "defaults"
|
||||||
|
|
||||||
do_install() {
|
do_install() {
|
||||||
mkdir -p ${D}/${bindir}
|
mkdir -p ${D}/${bindir}
|
||||||
cp ${WORKDIR}/cli/build/docker ${D}/${bindir}/docker
|
cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker
|
||||||
cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
|
cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
|
||||||
cp ${S}/src/import/docker-proxy ${D}/${bindir}/docker-proxy
|
cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
|
||||||
|
|
||||||
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
|
||||||
install -d ${D}${systemd_unitdir}/system
|
install -d ${D}${systemd_unitdir}/system
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
From 04c07804930faad708218a3134c81de06a9c742a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Bruce Ashfield <bruce.ashfield@windriver.com>
|
||||||
|
Date: Fri, 6 Apr 2018 23:58:22 -0400
|
||||||
|
Subject: [PATCH] libnetwork: use $(GO) instead of go
|
||||||
|
|
||||||
|
Ensure that the libnetwork makefile uses the go cross flags and
|
||||||
|
utilities.
|
||||||
|
|
||||||
|
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
|
||||||
|
---
|
||||||
|
Makefile | 14 +++++++-------
|
||||||
|
1 file changed, 7 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/libnetwork/Makefile b/libnetwork/Makefile
|
||||||
|
index 17060bc212c7..90cc7a72ef45 100644
|
||||||
|
--- a/libnetwork/Makefile
|
||||||
|
+++ b/libnetwork/Makefile
|
||||||
|
@@ -26,9 +26,9 @@ build: ${build_image}.created
|
||||||
|
build-local:
|
||||||
|
@echo "🐳 $@"
|
||||||
|
@mkdir -p "bin"
|
||||||
|
- go build -tags experimental -o "bin/dnet" ./cmd/dnet
|
||||||
|
- go build -o "bin/docker-proxy" ./cmd/proxy
|
||||||
|
- GOOS=linux go build -o "./cmd/diagnostic/diagnosticClient" ./cmd/diagnostic
|
||||||
|
+ $(GO) build -tags experimental -o "bin/dnet" ./cmd/dnet
|
||||||
|
+ $(GO) build -o "bin/proxy" ./cmd/proxy
|
||||||
|
+ GOOS=linux $(GO) build -o "./cmd/diagnostic/diagnosticClient" ./cmd/diagnostic
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo "🐳 $@"
|
||||||
|
@@ -51,8 +51,8 @@ cross: ${build_image}.created
|
||||||
|
|
||||||
|
cross-local:
|
||||||
|
@echo "🐳 $@"
|
||||||
|
- go build -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
|
||||||
|
- go build -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
|
||||||
|
+ @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/docker-proxy-$$GOOS-$$GOARCH" ./cmd/proxy
|
||||||
|
+ @$(GO) build -linkshared $(GOBUILDFLAGS) -o "bin/dnet-$$GOOS-$$GOARCH" ./cmd/dnet
|
||||||
|
|
||||||
|
check: ${build_image}.created
|
||||||
|
@${docker} ./wrapmake.sh check-local
|
||||||
|
@@ -68,7 +68,7 @@ run-tests:
|
||||||
|
if ls $$dir/*.go &> /dev/null; then \
|
||||||
|
pushd . &> /dev/null ; \
|
||||||
|
cd $$dir ; \
|
||||||
|
- go test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
|
||||||
|
+ $(GO) test ${INSIDECONTAINER} -test.parallel 5 -test.v -covermode=count -coverprofile=./profile.tmp ; \
|
||||||
|
ret=$$? ;\
|
||||||
|
if [ $$ret -ne 0 ]; then exit $$ret; fi ;\
|
||||||
|
popd &> /dev/null; \
|
||||||
|
@@ -94,7 +94,7 @@ coveralls:
|
||||||
|
# Depends on binaries because vet will silently fail if it can not load compiled imports
|
||||||
|
vet: ## run go vet
|
||||||
|
@echo "🐳 $@"
|
||||||
|
- @test -z "$$(go vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)"
|
||||||
|
+ @test -z "$$($(GO) vet ${PACKAGES} 2>&1 | grep -v 'constant [0-9]* not a string in call to Errorf' | egrep -v '(timestamp_test.go|duration_test.go|exit status 1)' | tee /dev/stderr)"
|
||||||
|
|
||||||
|
misspell:
|
||||||
|
@echo "🐳 $@"
|
||||||
|
--
|
||||||
|
2.4.0.53.g8440f74
|
||||||
|
|
Loading…
Reference in New Issue
Block a user