| 1 | #!/usr/bin/make -f |
| 2 | |
| 3 | export DH_GOLANG_GO_GENERATE := 1 |
| 4 | export DH_GOLANG_EXCLUDES := benchmark |
| 5 | |
| 6 | %: |
| 7 | dh $@ |
| 8 | |
| 9 | # Re-generate all non-source files. |
| 10 | # |
| 11 | # In theory 'export DH_GOLANG_GO_GENERATE:=1' should suffice, but for |
| 12 | # some reason it does not re-generate the files generated by code |
| 13 | # under _gen/. So we need to do that part manually. |
| 14 | # |
| 15 | # The complexity below is mostly to confirm that the re-generated |
| 16 | # files are identical to the shipped sources. Otherwise we could |
| 17 | # introduce a problem if we would use different re-generated source |
| 18 | # code files due to some tool reason (e.g., build dependency changes). |
| 19 | # |
| 20 | # Two files cannot be reproduced still, so we exclude them for now: |
| 21 | # https://github.com/klauspost/reedsolomon/issues/346 |
| 22 | execute_before_dh_auto_configure: |
| 23 | find|grep galois_gen_amd64.go |
| 24 | sha256sum `rgrep -l 'DO NOT EDIT' . | grep -v -e '/_gen/' -e '/debian/rules' -e 'galois_gen_amd64.s' -e 'galois_gen_switch_nopshufb_arm64.go' | sed -e 's,./,,'` | tee $(CURDIR)/debian/regen-check.SHA256SUMS |
| 25 | test `cat $(CURDIR)/debian/regen-check.SHA256SUMS | wc -l` = 7 |
| 26 | rm -v `cut -f3 -d" " $(CURDIR)/debian/regen-check.SHA256SUMS` |
| 27 | env GO111MODULE=off GOPATH=/usr/share/gocode GOCACHE=$(CURDIR)/_build/.gocache go generate -x -v |
| 28 | env GO111MODULE=off GOPATH=/usr/share/gocode GOCACHE=$(CURDIR)/_build/.gocache go generate -x -v _gen/gen.go |
| 29 | sha256sum -c $(CURDIR)/debian/regen-check.SHA256SUMS |
| 30 | rm -v $(CURDIR)/debian/regen-check.SHA256SUMS |
| 31 | |
| 32 | override_dh_auto_test: |
| 33 | ifneq (,$(filter $(DEB_HOST_ARCH), armhf armel i386 ppc64el riscv64)) |
| 34 | # Skip some time consuming tests, to avoid FTBFS issue |
| 35 | # on reproducible-builds.org CI tests. |
| 36 | dh_auto_test $(DH_BUILD_OPTS) -- -short |
| 37 | else |
| 38 | dh_auto_test $(DH_BUILD_OPTS) -- -timeout 25m |
| 39 | endif |