Skip to content

Commit d28f4aa

Browse files
committed
Makefile: allow overriding package name
With this patch applied, the package-name in the `--version` output can be overridden; make PACKAGE=containerd.io binaries ./bin/containerd --version containerd containerd.io v1.2.0-329-ga15b6e20.m a15b6e2.m Signed-off-by: Sebastiaan van Stijn <[email protected]> (cherry picked from commit b858cfb) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 8ecb055 commit d28f4aa

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ DESTDIR=/usr/local
2222
# Used to populate variables in version package.
2323
VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always)
2424
REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
25+
PACKAGE=github.com/containerd/containerd
2526

2627
ifneq "$(strip $(shell command -v go 2>/dev/null))" ""
2728
GOOS ?= $(shell go env GOOS)
@@ -77,8 +78,8 @@ MANPAGES=ctr.1 containerd.1 config.toml.5 containerd-config.1
7778
# Build tags seccomp and apparmor are needed by CRI plugin.
7879
BUILDTAGS ?= seccomp apparmor
7980
GO_TAGS=$(if $(BUILDTAGS),-tags "$(BUILDTAGS)",)
80-
GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) $(EXTRA_LDFLAGS)'
81-
SHIM_GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PKG) -extldflags "-static"'
81+
GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
82+
SHIM_GO_LDFLAGS=-ldflags '-s -w -X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static"'
8283

8384
#Replaces ":" (*nix), ";" (windows) with newline for easy parsing
8485
GOPATHS=$(shell echo ${GOPATH} | tr ":" "\n" | tr ";" "\n")

0 commit comments

Comments
 (0)