From f4c4ab1c8ccf0e15b8925e116899600ee6a19e0d Mon Sep 17 00:00:00 2001 From: Edvin Eriksson Date: Wed, 5 May 2021 08:37:15 +0200 Subject: [PATCH 1/2] fix: install linuxkit in top-level bin folder Signed-off-by: Edvin Eriksson --- Makefile | 6 ++++-- src/cmd/linuxkit/.gitignore | 1 + src/cmd/linuxkit/Makefile | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) create mode 100644 src/cmd/linuxkit/.gitignore diff --git a/Makefile b/Makefile index 3c47141dd..dfd2a40a4 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,11 @@ VERSION="v0.8+" GO_COMPILE=linuxkit/go-compile:7b1f5a37d2a93cd4a9aa2a87db264d8145944006 ifeq ($(OS),Windows_NT) +LINUXKIT?=$(CURDIR)/bin/linuxkit.exe RTF?=bin/rtf.exe GOOS?=windows else +LINUXKIT?=$(CURDIR)/bin/linuxkit RTF?=bin/rtf GOOS?=$(shell uname -s | tr '[:upper:]' '[:lower:]') endif @@ -21,7 +23,7 @@ PREFIX?=/usr/local LOCAL_TARGET?=$(CURDIR)/bin/linuxkit -export VERSION GO_COMPILE GOOS GOARCH LOCAL_TARGET +export VERSION GO_COMPILE GOOS GOARCH LOCAL_TARGET LINUXKIT .DELETE_ON_ERROR: @@ -52,7 +54,7 @@ tmp_mt_bin.tar: Makefile docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/estesp/manifest-tool --clone $(MT_REPO) --commit $(MT_COMMIT) --package github.com/estesp/manifest-tool --ldflags "-X main.gitCommit=$(MT_COMMIT)" -o bin/manifest-tool > $@ .PHONY: linuxkit -linuxkit: +linuxkit: bin make -C ./src/cmd/linuxkit .PHONY: test-cross diff --git a/src/cmd/linuxkit/.gitignore b/src/cmd/linuxkit/.gitignore new file mode 100644 index 000000000..e660fd93d --- /dev/null +++ b/src/cmd/linuxkit/.gitignore @@ -0,0 +1 @@ +bin/ diff --git a/src/cmd/linuxkit/Makefile b/src/cmd/linuxkit/Makefile index a728bc169..cbeeb96fa 100644 --- a/src/cmd/linuxkit/Makefile +++ b/src/cmd/linuxkit/Makefile @@ -31,7 +31,7 @@ $(LINUXKIT): tmp_linuxkit_bin.tar | bin touch $@ tmp_linuxkit_bin.tar: $(LINUXKIT_DEPS) - tar cf - -C . . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o $(LINUXKIT) > $@ + tar cf - -C . . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o bin/linuxkit > $@ .PHONY: test-cross test-cross: From 452910c625fbc5088236a984e51e765f7c5d3062 Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Wed, 26 May 2021 09:57:58 +0100 Subject: [PATCH 2/2] Makefile: Don't encode bindir in the tar archive Prior to this commit we go build -o bin/foo, archive it, and expand the archive, leaving the resulting artifact in bin. This doesn't allow us to easily change the bin directory, or move parts of the makefile around to make things more modular. This commit changes the behaviour to: go build -o foo, archive it, expand to `bin` Signed-off-by: Dave Tucker --- Makefile | 4 ++-- src/cmd/linuxkit/Makefile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dfd2a40a4..f99dbd447 100644 --- a/Makefile +++ b/Makefile @@ -35,12 +35,12 @@ RTF_COMMIT=2351267f358ce6621c0c0d9a069f361268dba5fc RTF_CMD=github.com/linuxkit/rtf/cmd RTF_VERSION=0.0 $(RTF): tmp_rtf_bin.tar | bin - tar xf $< + tar -C $(dir $(RTF)) -xf $< rm $< touch $@ tmp_rtf_bin.tar: Makefile - docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/linuxkit/rtf --clone https://github.com/linuxkit/rtf.git --commit $(RTF_COMMIT) --package github.com/linuxkit/rtf --ldflags "-X $(RTF_CMD).GitCommit=$(RTF_COMMIT) -X $(RTF_CMD).Version=$(RTF_VERSION)" -o $(RTF) > $@ + docker run --rm --log-driver=none -e http_proxy=$(http_proxy) -e https_proxy=$(https_proxy) $(CROSS) $(GO_COMPILE) --clone-path github.com/linuxkit/rtf --clone https://github.com/linuxkit/rtf.git --commit $(RTF_COMMIT) --package github.com/linuxkit/rtf --ldflags "-X $(RTF_CMD).GitCommit=$(RTF_COMMIT) -X $(RTF_CMD).Version=$(RTF_VERSION)" -o $(notdir $(RTF)) > $@ # Manifest tool for multi-arch images MT_COMMIT=bfbd11963b8e0eb5f6e400afaebeaf39820b4e90 diff --git a/src/cmd/linuxkit/Makefile b/src/cmd/linuxkit/Makefile index cbeeb96fa..d5f320bca 100644 --- a/src/cmd/linuxkit/Makefile +++ b/src/cmd/linuxkit/Makefile @@ -26,12 +26,12 @@ all: default LINUXKIT_DEPS=$(wildcard *.go) $(wildcard */*.go) Makefile $(LINUXKIT): tmp_linuxkit_bin.tar | bin - tar xf $< + tar -C $(dir $(LINUXKIT)) -xf $< rm $< touch $@ tmp_linuxkit_bin.tar: $(LINUXKIT_DEPS) - tar cf - -C . . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o bin/linuxkit > $@ + tar cf - -C . . | docker run --rm --net=none --log-driver=none -i $(CROSS) $(GO_COMPILE) --package github.com/linuxkit/linuxkit/src/cmd/linuxkit --ldflags "-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=$(GIT_COMMIT) -X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=$(VERSION)" -o $(notdir $(LINUXKIT)) > $@ .PHONY: test-cross test-cross: