diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 13:14:25 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 13:14:25 +0000 |
commit | 398739326c6a75c0e091cb7be0df48f4a813a4f5 (patch) | |
tree | bc890762d77f42f8840c214c1a1b8f70060e6308 /debian/rules | |
parent | Adding upstream version 1.16.10. (diff) | |
download | golang-1.16-debian.tar.xz golang-1.16-debian.zip |
Adding debian version 1.16.10-1.debian/1.16.10-1debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/rules')
-rwxr-xr-x | debian/rules | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..a1209e0 --- /dev/null +++ b/debian/rules @@ -0,0 +1,137 @@ +#!/usr/bin/make -f +# This file is in the public domain. +# You may freely use, modify, distribute, and relicense it. + +# We need DEB_HOST_ARCH, so include the needed makefile snippet +include /usr/share/dpkg/architecture.mk +# for DEB_VERSION_UPSTREAM +include /usr/share/dpkg/pkg-info.mk + +export GOVER := $(shell echo $(DEB_VERSION_UPSTREAM) | grep -oP '^([0-9]+\.[0-9]+)') + +export GOROOT := $(CURDIR) +export GOROOT_FINAL := /usr/lib/go-$(GOVER) + +export GOPATH := $(CURDIR)/gopath/ +# Go 1.12 needs a build cache, otherwise the build fails. +export GOCACHE := $(GOPATH)/gocache + +# source files generated during building. +# especially zbootstrap.go has different defaultGOARM values on armhf and armel, +# since the value is set from debian/helpers/goenv.sh +GENERATED_FILES := \ + src/cmd/cgo/zdefaultcc.go \ + src/cmd/go/internal/cfg/zdefaultcc.go \ + src/cmd/go/internal/cfg/zosarch.go \ + src/cmd/internal/objabi/zbootstrap.go \ + src/go/build/zcgo.go \ + src/runtime/internal/sys/zversion.go + +%: + +dh $@ $(opt_no_act) + +gencontrol: + for file in control gbp.conf source/lintian-overrides watch; do \ + { \ + echo '#'; \ + echo '# WARNING: "debian/'$$file'" is generated via "debian/rules gencontrol" (sourced from "debian/'$$file'.in")'; \ + echo '#'; \ + echo; \ + sed -e 's/X.Y/$(GOVER)/g' debian/$$file.in; \ + } > debian/$$file; \ + done + +# The signing key for the source tarballs is rotated yearly. +update_upstream_signing_key: + wget -O debian/upstream/signing-key.asc https://dl.google.com/dl/linux/linux_signing_key.pub + +override_dh_auto_clean: + # remove autogenerated files + rm -f -v $(GENERATED_FILES) + # remove built objects + rm -rf bin pkg + # remove generated files + @set -e; cd debian; for x in golang-X.Y-*; do \ + rm -f -v golang-$(GOVER)-$${x##golang-X.Y-}; \ + done + +execute_after_dh_prep: + dh_prep + @set -e; cd debian; for x in golang-X.Y-*; do \ + sed -e 's/X.Y/$(GOVER)/g' $$x > golang-$(GOVER)-$${x##golang-X.Y-}; \ + done + + +override_dh_auto_test-arch: + set -ex; \ + cd src; \ + export PATH="$(GOROOT)/bin:$$PATH"; \ + export GO_TEST_TIMEOUT_SCALE=10; \ + eval "$$(go tool dist env)"; \ + bash run.bash -k -no-rebuild; + # -k keep going even when error occurred + # -no-rebuild don't rebuild std and cmd packages + + # On linux/amd64 run.bash installs some race enabled standard library + # packages. Delete them again to avoid accidentally including them in + # the package. + set -ex; \ + export PATH="$(GOROOT)/bin:$$PATH"; \ + eval "$$(go tool dist env)"; \ + rm -rf "$(GOROOT)/pkg/$${GOOS}_$${GOARCH}_race/" + +override_dh_compress-indep: + dh_compress -Xusr/share/doc/golang-$(GOVER)-doc/html -Xusr/share/doc/golang-$(GOVER)-doc/favicon.ico + +execute_before_dh_install-arch: + rm -rf $(GOCACHE) + +execute_after_dh_install-indep: + # Remove generated source files, they are installed in golang-$(GOVER)-go. + cd debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/ && rm -v -f $(GENERATED_FILES) + # Remove Plan9 rc(1) scripts + find debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src -type f -name '*.rc' -delete + # Make scripts executable which have been missed by upstream + chmod a+x debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/cmp.bash + chmod a+x debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/cmd/vendor/golang.org/x/sys/unix/mkall.sh + chmod a+x debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/cmd/vendor/golang.org/x/sys/unix/mkerrors.sh + chmod a+x debian/golang-$(GOVER)-src/usr/share/go-$(GOVER)/src/cmd/vendor/golang.org/x/sys/windows/mkerrors.bash + +override_dh_strip: + dh_strip -Xtestdata + +# Do not run dh_dwz, as there is no debug information currently. +override_dh_dwz: + +override_dh_strip_nondeterminism: + dh_strip_nondeterminism -Xtestdata + +override_dh_shlibdeps: + dh_shlibdeps -Xtestdata -Xtest + +override_dh_makeshlibs: + dh_makeshlibs -Xtestdata -Xtest + +override_dh_auto_build-arch: + [ -f VERSION ] || echo "debian snapshot $(DEB_VERSION)" > VERSION + + # on i386, need to rebuild with go1.16 for GO386=softfloat + export GOROOT_BOOTSTRAP=$$(env -i GOPATH=$(GOPATH) go env GOROOT) \ + && if [ "$(DEB_HOST_ARCH)" = "i386" ] && dpkg --compare-versions $$(GOROOT_BOOTSTRAP=/usr ./debian/helpers/goenv.sh echo '$$GOVERSION_BOOTSTRAP') lt "1.16"; then \ + mkdir -p $(CURDIR)/bootstrap \ + && cp -Rp $(CURDIR)/src bootstrap/ \ + && cp -Rp $(CURDIR)/VERSION bootstrap/ \ + && cd $(CURDIR)/bootstrap/src \ + && $(CURDIR)/debian/helpers/goenv.sh bash ./make.bash --no-banner \ + && export GOROOT_BOOTSTRAP=$(CURDIR)/bootstrap; \ + fi \ + && cd $(CURDIR)/src \ + && $(CURDIR)/debian/helpers/goenv.sh bash ./make.bash --no-banner + + # rm bootstrap dir + rm -rf $(CURDIR)/bootstrap + +opt_no_act := +ifneq (,$(findstring n,$(MAKEFLAGS))) + opt_no_act := --no-act +endif |