File: rules

package info (click to toggle)
containerd 2.1.4~ds2-5
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 21,772 kB
  • sloc: sh: 1,885; makefile: 591
file content (69 lines) | stat: -rwxr-xr-x 2,641 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

PKG        := github.com/containerd/containerd
GO_LDFLAGS += -X $(PKG)/version.Version=$(DEB_VERSION_UPSTREAM)
GO_LDFLAGS += -X $(PKG)/version.Revision=$(DEB_VERSION)

# avoid dependencies
EXCLUDES += containerd-shim-runc-v2
EXCLUDES += containerd-stress
EXCLUDES += containerd/v2/plugins
EXCLUDES += contrib/checkpoint
EXCLUDES += contrib/fuzz
EXCLUDES += go-buildtag
EXCLUDES += integration
EXCLUDES += protoc-gen-go-fieldpath
EXCLUDES += runtime/v2/example/cmd

# Exclude extra files in -dev package to make it slimmer.
EXTRA_EXCLUDES += vendor

export DH_GOLANG_EXCLUDES := $(EXCLUDES)

%:
	dh $@ --buildsystem=golang --with=golang --builddirectory=_build

override_dh_auto_build:
ifeq (,$(AUTOPKGTEST_TMP))
	# the Debian golang debhelper disables GO 1.11 modules explicitly, which
	# prevents the "replace" statment in go.mod from working. In the upstream,
	# build system, the code is accessed both ways to allow sharing code with
	# the v1 codebase. cf.
	# https://github.com/containerd/containerd/commit/2ac2b9c909fb64f4d06958a0ca2f556bec348d05
	# The interface prototype definitions are treated as its own golang submodule that is
	# imported without /v2 in order to make it compatible with the 1.0 API code base.
	mv -v _build/src/github.com/containerd/containerd/v2/api _build/src/github.com/containerd/containerd/
endif
	# install vendored sources
	ln -sfr --verbose debian/vendor/ _build/src/vendor
	dh_auto_build -- -ldflags '$(GO_LDFLAGS)'

ifeq (,$(AUTOPKGTEST_TMP))
execute_after_dh_auto_build:
	mkdir -p man
	make man/containerd-config.8
	make man/containerd-config.toml.5
	_build/bin/gen-manpages containerd.8 man
	_build/bin/gen-manpages ctr.8 man
	rm -vf _build/bin/gen-manpages

	sed 's|/usr/local/bin|/usr/bin|' containerd.service > debian/containerd.service
	mkdir -vp debian/bash-completion
	install -m644 -T /usr/share/gocode/src/github.com/urfave/cli/autocomplete/bash_autocomplete \
		debian/bash-completion/ctr
	mkdir -vp debian/zsh-completion
	sed 's|$$PROG|ctr|g' /usr/share/gocode/src/github.com/urfave/cli/autocomplete/zsh_autocomplete > \
		debian/zsh-completion/_ctr
endif

override_dh_auto_install:
	DH_GOLANG_EXCLUDES="$(EXCLUDES) $(EXTRA_EXCLUDES)" dh_auto_install

execute_after_dh_install-indep:
	# now move the gprc api definitions to its own package
	mkdir -pv debian/golang-github-containerd-containerd-api-dev/usr/share/gocode/src/github.com/containerd/containerd/
	cp -vr _build/src/github.com/containerd/containerd/api \
	          debian/golang-github-containerd-containerd-api-dev/usr/share/gocode/src/github.com/containerd/containerd/