github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/debian/rules (about) 1 #!/usr/bin/make -f 2 # -*- makefile -*- 3 4 include /usr/share/dpkg/default.mk 5 6 # Uncomment this to turn on verbose mode. 7 #export DH_VERBOSE=1 8 9 # The engine is built and tested using upstream scripts 10 # and Makefiles, rather than dh_auto_*. Therefore we can't rely 11 # on dh to set the environment for us, we have to do it here. 12 export GOPATH := $(CURDIR)/_build 13 export GOCACHE := $(GOPATH)/go-build 14 export GO111MODULE := off 15 export GOPROXY := off 16 17 #export DH_GOLANG_BUILDPKG := github.com/docker/docker github.com/docker/cli 18 export DH_GOLANG_GO_GENERATE := 1 19 export DH_GOLANG_INSTALL_ALL := 1 20 export DH_GOLANG_INSTALL_EXTRA := testdata/ 21 export DH_GOLANG_EXCLUDES := \ 22 integration-cli \ 23 overlay_test \ 24 vendor 25 26 # Package names 27 CLI_PKG := github.com/docker/cli 28 ENGINE_PKG := github.com/docker/docker 29 LIBNETWORK_PKG := github.com/docker/libnetwork 30 SWARMKIT_PKG := github.com/docker/swarmkit 31 32 # Version and commits 33 DOCKER_VERSION := $(DEB_VERSION_UPSTREAM) 34 ENGINE_GITCOMMIT := $(shell ./debian/helpers/gitcommit.sh engine $(DOCKER_VERSION)) 35 ifndef ENGINE_GITCOMMIT 36 $(error Missing ENGINE_GITCOMMIT - see debian/helpers/engine-gitcommits) 37 endif 38 CLI_GITCOMMIT := $(shell ./debian/helpers/gitcommit.sh cli $(DOCKER_VERSION)) 39 ifndef CLI_GITCOMMIT 40 $(error Missing CLI_GITCOMMIT - see debian/helpers/cli-gitcommits) 41 endif 42 43 # Cf. scripts/build/binary scripts/build/.variables 44 CLI_BUILDTIME := $(shell date -u -d "@$(SOURCE_DATE_EPOCH)" +"%Y-%m-%dT%H:%M:%SZ") 45 CLI_BUILDTAGS := pkcs11 46 CLI_LDFLAGS += -X $(CLI_PKG)/cli/version.BuildTime=$(CLI_BUILDTIME) 47 CLI_LDFLAGS += -X $(CLI_PKG)/cli/version.GitCommit=$(CLI_GITCOMMIT) 48 CLI_LDFLAGS += -X $(CLI_PKG)/cli/version.Version=$(DOCKER_VERSION) 49 ifeq (,$(filter $(DEB_BUILD_ARCH), mipsel mips64el)) 50 CLI_BUILDMODE := -buildmode=pie 51 endif 52 53 # engine: have "make.sh" keep "bundle/$(DOCKER_VERSION)" around between runs 54 # (we clean it up appropriately ourselves) 55 ENGINE_KEEPBUNDLE := 1 56 57 ENGINE_BUILDTAGS := apparmor seccomp 58 ENGINE_TESTFLAGS := -test.short 59 60 BUILT_LIBC := $(shell dpkg-query -f '$${source:Package} (= $${source:Version})' -W libc-dev-bin) 61 62 %: 63 dh $@ --buildsystem=golang --with=bash-completion,golang --builddirectory=_build 64 65 override_dh_golang: 66 ## Set DH_GOLANG_BUILDPKG so that Built-Using is properly generated. 67 DH_GOLANG_BUILDPKG="$(CLI_PKG)/... $(ENGINE_PKG)/... $(LIBNETWORK_PKG)/... $(SWARMKIT_PKG)/..." \ 68 dh_golang -O--buildsystem=golang -O--builddirectory=_build 69 70 override_dh_clean: 71 dh_clean 72 $(RM) -v -r autogen bundles man/man*/ 73 # -find . -type f -name '*.pb.go' -delete -printf 'removed %p\n' ## delete generated .pb.go files 74 ## Remove Files-Excluded (when built from checkout or non-DFSG tarball): 75 $(RM) -rv `perl -0nE 'say grep { $$_=q{ */}.$$_ } split(/\s+/,$$1) if m{^Files\-Excluded:\s*(.*?)(?:\n\n|^Files|^Comment:)}sm;' debian/copyright` 76 -find */vendor -mindepth 1 -type d -empty -delete -printf 'removed %p\n' 77 78 override_dh_auto_configure: 79 ## dh_auto_configure symlinks dirs from "/usr/share/gocode/src" into 80 ## $(GOPATH) unless folders already exist there in which case files 81 ## are copied. Pre-making directories allows us to use debhelper to 82 ## create proper GOPATH source tree yet have certain directories writable 83 ## even if they are provided by already installed package. 84 mkdir -pv $(GOPATH)/src/$(CLI_PKG) 85 mkdir -pv $(GOPATH)/src/$(ENGINE_PKG) 86 mkdir -pv $(GOPATH)/src/$(LIBNETWORK_PKG) 87 mkdir -pv $(GOPATH)/src/$(SWARMKIT_PKG) 88 89 ## Prepare builddirectory but throw away sourcedirectory. 90 DH_GOPKG="__IGNORE__" dh_auto_configure 91 92 ## Each package must be removed from working tree first, in case some 93 ## of the packages that we are going to build are already installed. 94 ## This is also useful for building in unclean environment. 95 ## 96 ## This is _necessary_ to avoid merging packages that we build with 97 ## pre-installed packages. See #827226 for details. 98 ## Debhelper knows only about "main" DH_GOPKG package but we build several 99 ## and we have to ensure that build tree is properly prepared. 100 $(RM) -r $(GOPATH)/src/$(CLI_PKG) 101 cp -ra cli $(GOPATH)/src/$(CLI_PKG) 102 $(RM) -r $(GOPATH)/src/$(ENGINE_PKG) 103 cp -ra engine $(GOPATH)/src/$(ENGINE_PKG) 104 $(RM) -r $(GOPATH)/src/$(LIBNETWORK_PKG) 105 cp -ra libnetwork $(GOPATH)/src/$(LIBNETWORK_PKG) 106 $(RM) -r $(GOPATH)/src/$(SWARMKIT_PKG) 107 cp -ra swarmkit $(GOPATH)/src/$(SWARMKIT_PKG) 108 109 override_dh_auto_build: 110 ## Order is important: 111 112 DH_GOPKG=$(LIBNETWORK_PKG) dh_auto_build -v 113 114 ## ## FIXME: DH_GOLANG_BUILDPKG --> DH_GOPKG 115 DH_GOLANG_BUILDPKG=$(SWARMKIT_PKG) dh_auto_build -v 116 117 ## build ("cd" first to ensure we build from within GOPATH) 118 cd $(GOPATH)/src/$(ENGINE_PKG) \ 119 && KEEPBUNDLE=$(ENGINE_KEEPBUNDLE) VERSION=$(DOCKER_VERSION) DOCKER_BUILDTAGS='$(ENGINE_BUILDTAGS)' \ 120 DOCKER_GITCOMMIT=$(ENGINE_GITCOMMIT) PRODUCT=docker ./hack/make.sh dynbinary 121 122 DH_GOPKG=$(CLI_PKG) DH_GOLANG_BUILDPKG=$(CLI_PKG)/cmd/docker \ 123 dh_auto_build -v -- -tags '$(CLI_BUILDTAGS)' -ldflags '$(CLI_LDFLAGS)' $(CLI_BUILDMODE) 124 cd $(GOPATH)/src/$(CLI_PKG) && ./scripts/docs/generate-man.sh 125 126 override_dh_auto_test: 127 128 override_dh_install: 129 ## Rename binaries 130 cd $(GOPATH)/src/$(ENGINE_PKG)/bundles/dynbinary-daemon \ 131 && mv dockerd-$(DOCKER_VERSION) dockerd 132 cd $(GOPATH)/bin \ 133 && mv proxy docker-proxy 134 ## Do not install extra license files: 135 dh_install -XLICENSE 136 ## Apparmor thing, not sure it's needed, we don't install a profile 137 dh_apparmor --profile-name=docker.io -pdocker.io 138 139 override_dh_auto_install: 140 ## skip dh_auto_install to stop dh_golang trying to copy bits 141 ## for /usr/share/gocode (we use dh_install for that) 142 143 override_dh_installinit: 144 dh_installinit -v --name=docker --no-enable --no-start --no-stop-on-upgrade --no-restart-after-upgrade 145 146 override_dh_installsystemd: 147 dh_installsystemd -v --name=docker --no-enable --no-start --no-stop-on-upgrade --no-restart-after-upgrade 148 149 override_dh_installudev: 150 # use priority z80 to match the upstream priority of 80 151 dh_installudev -v --name=docker --priority=z80 152 153 override_dh_gencontrol: 154 echo 'libc:Built-Using=$(BUILT_LIBC)' >> debian/docker.io.substvars 155 dh_gencontrol