diff options
author | Paul Barker <pbarker@toganlabs.com> | 2018-05-08 20:14:12 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-05-09 10:49:25 -0400 |
commit | 0aa5985622933db5c935939c3ca4f77d0ce66a97 (patch) | |
tree | 80415528f798d946d3a6e10ebb0680f79580ac3c /recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch | |
parent | bc88053cab85bde494cbcf5678bf0abece466758 (diff) | |
download | meta-virtualization-0aa5985622933db5c935939c3ca4f77d0ce66a97.tar.gz |
netns: Update to v0.4.0
The netns project has been moved into the 'genuinetools' organisation and so
URLs have been updated. The copyright line in the license file has been updated
to reference "The Genuinetools Authors".
The patch name has been updated to make it more suitable for submission
upstream.
Signed-off-by: Paul Barker <pbarker@toganlabs.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
Diffstat (limited to 'recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch')
-rw-r--r-- | recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch b/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch new file mode 100644 index 00000000..84fb9a43 --- /dev/null +++ b/recipes-networking/netns/files/0001-Allow-selection-of-go-compiler.patch | |||
@@ -0,0 +1,107 @@ | |||
1 | From 6576f228339b7931e05a8e861f085f483817806b Mon Sep 17 00:00:00 2001 | ||
2 | From: Paul Barker <pbarker@toganlabs.com> | ||
3 | Date: Tue, 8 May 2018 11:01:14 +0000 | ||
4 | Subject: [PATCH] Allow selection of go compiler | ||
5 | |||
6 | By running `make GO=/path/to/go` we can now select the appropriate go compiler | ||
7 | to use. This also makes it possible to cross compile netns more easily. | ||
8 | |||
9 | Signed-off-by: Paul Barker <pbarker@toganlabs.com> | ||
10 | Upstream-status: Pending | ||
11 | --- | ||
12 | Makefile | 25 ++++++++++++++----------- | ||
13 | 1 file changed, 14 insertions(+), 11 deletions(-) | ||
14 | |||
15 | diff --git a/Makefile b/Makefile | ||
16 | index 3a22f3e..476cb9b 100644 | ||
17 | --- a/src/import/Makefile | ||
18 | +++ b/src/import/Makefile | ||
19 | @@ -23,6 +23,9 @@ CTIMEVAR=-X $(PKG)/version.GITCOMMIT=$(GITCOMMIT) -X $(PKG)/version.VERSION=$(VE | ||
20 | GO_LDFLAGS=-ldflags "-w $(CTIMEVAR)" | ||
21 | GO_LDFLAGS_STATIC=-ldflags "-w $(CTIMEVAR) -extldflags -static" | ||
22 | |||
23 | +# Set our default go compiler | ||
24 | +GO := go | ||
25 | + | ||
26 | # List the GOOS and GOARCH to build | ||
27 | GOOSARCHES = linux/arm linux/arm64 linux/amd64 linux/386 | ||
28 | |||
29 | @@ -33,12 +36,12 @@ build: $(NAME) ## Builds a dynamic executable or package | ||
30 | |||
31 | $(NAME): *.go VERSION.txt | ||
32 | @echo "+ $@" | ||
33 | - go build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
34 | + $(GO) build -tags "$(BUILDTAGS)" ${GO_LDFLAGS} -o $(NAME) . | ||
35 | |||
36 | .PHONY: static | ||
37 | static: ## Builds a static executable | ||
38 | @echo "+ $@" | ||
39 | - CGO_ENABLED=0 go build \ | ||
40 | + CGO_ENABLED=0 $(GO) build \ | ||
41 | -tags "$(BUILDTAGS) static_build" \ | ||
42 | ${GO_LDFLAGS_STATIC} -o $(NAME) . | ||
43 | |||
44 | @@ -55,23 +58,23 @@ lint: ## Verifies `golint` passes | ||
45 | .PHONY: test | ||
46 | test: ## Runs the go tests | ||
47 | @echo "+ $@" | ||
48 | - @go test -v -tags "$(BUILDTAGS) cgo" $(shell go list ./... | grep -v vendor) | ||
49 | + @$(GO) test -v -tags "$(BUILDTAGS) cgo" $(shell $(GO) list ./... | grep -v vendor) | ||
50 | |||
51 | .PHONY: vet | ||
52 | vet: ## Verifies `go vet` passes | ||
53 | @echo "+ $@" | ||
54 | - @go vet $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
55 | + @$(GO) vet $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
56 | |||
57 | .PHONY: staticcheck | ||
58 | staticcheck: ## Verifies `staticcheck` passes | ||
59 | @echo "+ $@" | ||
60 | - @staticcheck $(shell go list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
61 | + @staticcheck $(shell $(GO) list ./... | grep -v vendor) | grep -v '.pb.go:' | tee /dev/stderr | ||
62 | |||
63 | .PHONY: cover | ||
64 | cover: ## Runs go test with coverage | ||
65 | @echo "" > coverage.txt | ||
66 | - @for d in $(shell go list ./... | grep -v vendor); do \ | ||
67 | - go test -race -coverprofile=profile.out -covermode=atomic "$$d"; \ | ||
68 | + @for d in $(shell $(GO) list ./... | grep -v vendor); do \ | ||
69 | + $(GO) test -race -coverprofile=profile.out -covermode=atomic "$$d"; \ | ||
70 | if [ -f profile.out ]; then \ | ||
71 | cat profile.out >> coverage.txt; \ | ||
72 | rm profile.out; \ | ||
73 | @@ -81,11 +84,11 @@ cover: ## Runs go test with coverage | ||
74 | .PHONY: install | ||
75 | install: ## Installs the executable or package | ||
76 | @echo "+ $@" | ||
77 | - go install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . | ||
78 | + $(GO) install -a -tags "$(BUILDTAGS)" ${GO_LDFLAGS} . | ||
79 | |||
80 | define buildpretty | ||
81 | mkdir -p $(BUILDDIR)/$(1)/$(2); | ||
82 | -GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
83 | +GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ | ||
84 | -o $(BUILDDIR)/$(1)/$(2)/$(NAME) \ | ||
85 | -a -tags "$(BUILDTAGS) static_build netgo" \ | ||
86 | -installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
87 | @@ -99,7 +102,7 @@ cross: *.go VERSION.txt ## Builds the cross-compiled binaries, creating a clean | ||
88 | $(foreach GOOSARCH,$(GOOSARCHES), $(call buildpretty,$(subst /,,$(dir $(GOOSARCH))),$(notdir $(GOOSARCH)))) | ||
89 | |||
90 | define buildrelease | ||
91 | -GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 go build \ | ||
92 | +GOOS=$(1) GOARCH=$(2) CGO_ENABLED=0 $(GO) build \ | ||
93 | -o $(BUILDDIR)/$(NAME)-$(1)-$(2) \ | ||
94 | -a -tags "$(BUILDTAGS) static_build netgo" \ | ||
95 | -installsuffix netgo ${GO_LDFLAGS_STATIC} .; | ||
96 | @@ -115,7 +118,7 @@ release: *.go VERSION.txt ## Builds the cross-compiled binaries, naming them in | ||
97 | .PHONY: bump-version | ||
98 | BUMP := patch | ||
99 | bump-version: ## Bump the version in the version file. Set BUMP to [ patch | major | minor ] | ||
100 | - @go get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
101 | + @$(GO) get -u github.com/jessfraz/junk/sembump # update sembump tool | ||
102 | $(eval NEW_VERSION = $(shell sembump --kind $(BUMP) $(VERSION))) | ||
103 | @echo "Bumping VERSION.txt from $(VERSION) to $(NEW_VERSION)" | ||
104 | echo $(NEW_VERSION) > VERSION.txt | ||
105 | -- | ||
106 | 2.7.4 | ||
107 | |||