[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#960842: add <triplet>-go wrappers and golang-go-for-host



Source: golang-defaults
Version: 2:1.14~1
Tags: patch
User: debian-cross@lists.debian.org
Usertags: ftcbfs
Control: affects -1 + src:canid src:go-qrcode src:golang-bindata src:golang-github-benbjohnson-tmpl src:golang-github-calmh-xdr src:golang-github-eknkc-amber src:golang-github-odeke-em-cli-spinner src:golang-github-odeke-em-ripper src:golang-github-rakyll-statik src:golang-gogoprotobuf

On Fri, May 15, 2020 at 06:51:18AM +0200, Helmut Grohne wrote:
> On Fri, May 15, 2020 at 08:34:48AM +1200, Michael Hudson-Doyle wrote:
> > (The gccgo-go / golang-go split is another dimension to this, I guess to
> > cross build with gccgo you need something like option 5)
> 
> That's an interesting wrinkle that I completely overlooked. Thank you!

Given this, I went ahead and implemented a part of this that seems
relatively obvious and uncontroversial to me.

In my draft, I argued that for supporting cross compilation with
golang-any, one must ensure that the triplet-prefixed go is called in
order to support gccgo. But then, the golang go will also have to
provide a triplet-prefixed go to provide a shared interface.

For that reason, I'm attaching a patch that adds these go wrappers to
golang-defaults. It adds new binary packages golang-go-<triplet> and a
package golang-go-for-host.

A few remarks about the patch:
 * It adds new binary packages. Uploading golang-defaults with the patch
   will make it stuck in NEW.
 * debian/control becomes a generated file. The generator is
   debian/control.sh.
 * It fixes a typo in debian/control where one "mips64el" was misspelled
   as "mips64".

This is not a full solution to cross compiling go packages. Like my
previous patches, it is to be considered an incremental step.

Once this is in place, I suggest that we can reduce complexity in
dh-golang. Instead of setting up the magic variables there, we can now
call into the cross wrapper.

Helmut
diff --minimal -Nru golang-defaults-1.14~1/debian/changelog golang-defaults-1.14~1.1/debian/changelog
--- golang-defaults-1.14~1/debian/changelog	2020-03-07 13:47:33.000000000 +0100
+++ golang-defaults-1.14~1.1/debian/changelog	2020-05-17 14:16:54.000000000 +0200
@@ -1,3 +1,10 @@
+golang-defaults (2:1.14~1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Introduce golang-go-for-host package. (Closes: #-1)
+
+ -- Helmut Grohne <helmut@subdivi.de>  Sun, 17 May 2020 14:16:54 +0200
+
 golang-defaults (2:1.14~1) unstable; urgency=medium
 
   * Update to Go 1.14 (src:golang-1.14). Closes: #952831
diff --minimal -Nru golang-defaults-1.14~1/debian/control golang-defaults-1.14~1.1/debian/control
--- golang-defaults-1.14~1/debian/control	2020-03-07 13:45:40.000000000 +0100
+++ golang-defaults-1.14~1.1/debian/control	2020-05-17 14:16:54.000000000 +0200
@@ -70,6 +70,233 @@
  native toolchain ("gc compiler"). Packages that want to build with whichever
  of gc or gccgo is available should depend on golang-any.
 
+Package: golang-go-x86-64-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for amd64
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the x86_64-linux-gnu-go
+ wrapper used for compiling go programs to amd64.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-aarch64-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for arm64
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the aarch64-linux-gnu-go
+ wrapper used for compiling go programs to arm64.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-arm-linux-gnueabi
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for armel
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the arm-linux-gnueabi-go
+ wrapper used for compiling go programs to armel.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-arm-linux-gnueabihf
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for armhf
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the arm-linux-gnueabihf-go
+ wrapper used for compiling go programs to armhf.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-i686-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for i386
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the i686-linux-gnu-go
+ wrapper used for compiling go programs to i386.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-mips-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for mips
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the mips-linux-gnu-go
+ wrapper used for compiling go programs to mips.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-mips64el-linux-gnuabi64
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for mips64el
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the mips64el-linux-gnuabi64-go
+ wrapper used for compiling go programs to mips64el.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-mipsel-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for mipsel
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the mipsel-linux-gnu-go
+ wrapper used for compiling go programs to mipsel.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-powerpc64le-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for ppc64el
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the powerpc64le-linux-gnu-go
+ wrapper used for compiling go programs to ppc64el.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-riscv64-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for riscv64
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the riscv64-linux-gnu-go
+ wrapper used for compiling go programs to riscv64.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-s390x-linux-gnu
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= ${source:Version})
+Description: Go programming language compiler wrapper for s390x
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the s390x-linux-gnu-go
+ wrapper used for compiling go programs to s390x.
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+Package: golang-go-for-host
+Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el riscv64 s390x
+Multi-Arch: same
+Depends: golang-go${archsuffix} (>= ${source:Version})
+Description: Go programming language compiler wrapper
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a dependency package that depends on architecture-suffixed golang-go
+ package matching the architecture of this package. When depending on this
+ package, go must be called through the wrapper only.
+
 Package: golang-any
 Architecture: any
 Depends: golang-go (>= ${source:Version}) | gccgo-go (>= ${source:Version}),
@@ -149,7 +376,7 @@
  http://localhost:6060/doc/install.html.
 
 Package: golang
-Architecture: amd64 arm64 armel armhf i386 mips mips64 mipsel ppc64el riscv64 s390x
+Architecture: amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el riscv64 s390x
 Depends: golang-${golang:GOVER},
          golang-doc (>= ${source:Version}),
          golang-go (>= ${source:Version}),
diff --minimal -Nru golang-defaults-1.14~1/debian/control.sh golang-defaults-1.14~1.1/debian/control.sh
--- golang-defaults-1.14~1/debian/control.sh	1970-01-01 01:00:00.000000000 +0100
+++ golang-defaults-1.14~1.1/debian/control.sh	2020-05-17 14:16:54.000000000 +0200
@@ -0,0 +1,219 @@
+#!/bin/sh
+
+GOLANG_GO_ARCHS="amd64 arm64 armel armhf i386 mips mips64el mipsel ppc64el riscv64 s390x"
+
+cat <<EOF
+Source: golang-defaults
+Maintainer: Go Compiler Team <team+go-compiler@tracker.debian.org>
+Uploaders: Michael Stapelberg <stapelberg@debian.org>,
+           Paul Tagliamonte <paultag@debian.org>,
+           Tianon Gravi <tianon@debian.org>,
+           Michael Hudson-Doyle <mwhudson@debian.org>,
+           Martín Ferrari <tincho@debian.org>,
+           Dr. Tobias Quathamer <toddy@debian.org>,
+           Anthony Fok <foka@debian.org>
+Section: devel
+Priority: optional
+Build-Depends: debhelper-compat (= 12),
+               dh-exec
+Standards-Version: 4.4.0
+Vcs-Browser: https://salsa.debian.org/go-team/compiler/golang-defaults
+Vcs-Git: https://salsa.debian.org/go-team/compiler/golang-defaults.git
+Homepage: https://golang.org
+
+Package: golang-go
+Architecture: $GOLANG_GO_ARCHS
+Depends: golang-\${golang:GOVER}-go,
+         golang-src (>= \${source:Version}),
+         \${misc:Depends}
+Suggests: git
+Breaks: gccgo-5 (<< 5.3.1-12~),
+        gccgo-6 (<< 6-20160319-1~),
+        golang-doc (<< 2:1.6.1+1~),
+        golang-go-darwin-386,
+        golang-go-darwin-amd64,
+        golang-go-freebsd-386,
+        golang-go-freebsd-amd64,
+        golang-go-freebsd-arm,
+        golang-go-linux-386,
+        golang-go-linux-amd64,
+        golang-go-linux-arm,
+        golang-go-netbsd-386,
+        golang-go-netbsd-amd64,
+        golang-go-windows-386,
+        golang-go-windows-amd64,
+        golang-go.tools (<< 1:0.0~git20151026.0.0f9d71c-1~),
+        golang-golang-x-tools (<< 1:0.0~git20151026.0.0f9d71c-1~)
+Conflicts: gccgo-go
+Replaces: golang-doc (<< 2:1.6.1+1~),
+          golang-go-darwin-386,
+          golang-go-darwin-amd64,
+          golang-go-freebsd-386,
+          golang-go-freebsd-amd64,
+          golang-go-freebsd-arm,
+          golang-go-linux-386,
+          golang-go-linux-amd64,
+          golang-go-linux-arm,
+          golang-go-netbsd-386,
+          golang-go-netbsd-amd64,
+          golang-go-windows-386,
+          golang-go-windows-amd64,
+          golang-go.tools (<< 1:0.0~git20151026.0.0f9d71c-1~),
+          golang-golang-x-tools (<< 1:0.0~git20151026.0.0f9d71c-1~)
+Description: Go programming language compiler, linker, compiled stdlib
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a dependency package that depends on the default Go toolchain and
+ compiled standard library. It is only built on architectures that have a
+ native toolchain ("gc compiler"). Packages that want to build with whichever
+ of gc or gccgo is available should depend on golang-any.
+
+EOF
+for arch in $GOLANG_GO_ARCHS; do
+	cat <<EOF
+Package: golang-go-$(dpkg-architecture -f -a$arch -qDEB_HOST_GNU_TYPE 2>/dev/null | tr _ -)
+Architecture: all
+Multi-Arch: foreign
+Depends: golang-go (>= \${source:Version})
+Description: Go programming language compiler wrapper for $(dpkg-architecture -f -a$arch -qDEB_HOST_ARCH 2>/dev/null)
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a wrapper package that contains the $(dpkg-architecture -f -a$arch -qDEB_HOST_GNU_TYPE 2>/dev/null)-go
+ wrapper used for compiling go programs to $(dpkg-architecture -f -a$arch -qDEB_HOST_ARCH 2>/dev/null).
+ When depending on this wrapper package, go must be called through the wrapper
+ only.
+
+EOF
+done
+cat <<EOF
+Package: golang-go-for-host
+Architecture: $GOLANG_GO_ARCHS
+Multi-Arch: same
+Depends: golang-go\${archsuffix} (>= \${source:Version})
+Description: Go programming language compiler wrapper
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a dependency package that depends on architecture-suffixed golang-go
+ package matching the architecture of this package. When depending on this
+ package, go must be called through the wrapper only.
+
+Package: golang-any
+Architecture: any
+Depends: golang-go (>= \${source:Version}) | gccgo-go (>= \${source:Version}),
+         \${misc:Depends}
+Description: Go programming language -- gccgo on "non-Go" platforms
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a dependency package that depends on the default Go toolchain and
+ compiled standard library or gccgo on architectures that do not have a native
+ toolchain ("gc compiler") port. Because the gccgo and Go releases are not on
+ the same schedule, it is not guaranteed that the version of the Go language
+ provided by the version of gccgo that this package depends upon will match the
+ version of this package.
+
+Package: gccgo-go
+Architecture: any
+Depends: gccgo-9,
+         \${misc:Depends}
+Conflicts: golang-go
+Description: Go programming language -- gccgo
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ Installing this package will install the gccgo implementation as /usr/bin/go.
+ It conflicts with golang-go.
+
+Package: golang-src
+Architecture: $GOLANG_GO_ARCHS
+Depends: golang-\${golang:GOVER}-src,
+         \${misc:Depends}
+Description: Go programming language - source files
+ The Go programming language is an open source project to make programmers more
+ productive. Go is expressive, concise, clean, and efficient. Its concurrency
+ mechanisms make it easy to write programs that get the most out of multicore
+ and networked machines, while its novel type system enables flexible and
+ modular program construction. Go compiles quickly to machine code yet has the
+ convenience of garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a dynamically typed,
+ interpreted language.
+ .
+ This is a dependency package that depends on the default Go standard library
+ source code, which is needed for the go build process.
+
+Package: golang-doc
+Architecture: all
+Section: doc
+Depends: golang-\${golang:GOVER}-doc,
+         golang-go (>= \${source:Version}),
+         \${misc:Depends}
+Description: Go programming language - documentation
+ The Go programming language is an open source project to make
+ programmers more productive. Go is expressive, concise, clean, and
+ efficient. Its concurrency mechanisms make it easy to write programs
+ that get the most out of multicore and networked machines, while its
+ novel type system enables flexible and modular program construction.
+ Go compiles quickly to machine code yet has the convenience of
+ garbage collection and the power of run-time reflection. It's a fast,
+ statically typed, compiled language that feels like a dynamically
+ typed, interpreted language.
+ .
+ This is a dependency package that depends on the default Go documentation. You
+ can view the formatted documentation by installing the golang-golang-x-tools
+ package, running "godoc --http=:6060", and then visiting
+ http://localhost:6060/doc/install.html.
+
+Package: golang
+Architecture: $GOLANG_GO_ARCHS
+Depends: golang-\${golang:GOVER},
+         golang-doc (>= \${source:Version}),
+         golang-go (>= \${source:Version}),
+         golang-src (>= \${source:Version}),
+         \${misc:Depends}
+Description: Go programming language compiler - metapackage
+ The Go programming language is an open source project to make
+ programmers more productive. Go is expressive, concise, clean, and
+ efficient. Its concurrency mechanisms make it easy to write programs
+ that get the most out of multicore and networked machines, while its
+ novel type system enables flexible and modular program construction.
+ Go compiles quickly to machine code yet has the convenience of
+ garbage collection and the power of run-time reflection. It's a
+ fast, statically typed, compiled language that feels like a
+ dynamically typed, interpreted language.
+ .
+ This package is a metapackage that, when installed, guarantees
+ that (most of) a full Go development environment is installed.
+EOF
diff --minimal -Nru golang-defaults-1.14~1/debian/rules golang-defaults-1.14~1.1/debian/rules
--- golang-defaults-1.14~1/debian/rules	2020-03-07 13:42:52.000000000 +0100
+++ golang-defaults-1.14~1.1/debian/rules	2020-05-17 14:16:54.000000000 +0200
@@ -1,10 +1,22 @@
 #!/usr/bin/make -f
 # -*- makefile -*-
 
+include /usr/share/dpkg/architecture.mk
+
 export GOVER := $(shell debian/helpers/getver.pl)
+HOST_ARCH_SUFFIX=-$(subst _,-,$(DEB_HOST_GNU_TYPE))
 
 %:
 	dh $@
 
+debian/control:debian/control.sh
+	./$< > $@.tmp
+	mv $@.tmp $@
+
+override_dh_auto_install-indep:
+	mkdir -p debian/golang-go$(HOST_ARCH_SUFFIX)/usr/bin
+	./make-cross-go.sh > debian/golang-go$(HOST_ARCH_SUFFIX)/usr/bin/$(DEB_HOST_GNU_TYPE)-go
+	chmod +x debian/golang-go$(HOST_ARCH_SUFFIX)/usr/bin/$(DEB_HOST_GNU_TYPE)-go
+
 override_dh_gencontrol:
-	dh_gencontrol -- -Vgolang:GOVER=$(GOVER)
+	dh_gencontrol -- -Vgolang:GOVER=$(GOVER) -Varchsuffix=$(HOST_ARCH_SUFFIX)
diff --minimal -Nru golang-defaults-1.14~1/make-cross-go.sh golang-defaults-1.14~1.1/make-cross-go.sh
--- golang-defaults-1.14~1/make-cross-go.sh	1970-01-01 01:00:00.000000000 +0100
+++ golang-defaults-1.14~1.1/make-cross-go.sh	2020-05-17 13:51:19.000000000 +0200
@@ -0,0 +1,47 @@
+#!/bin/sh
+
+GOARM=
+case "$(dpkg-architecture -qDEB_HOST_ARCH_CPU)/$(dpkg-architecture -qDEB_HOST_ARCH_ABI)" in
+	amd64/base) GOARCH=amd64 ;;
+	amd64/x32) GOARCH=amd64p32 ;;
+	arm/eabi) GOARCH=arm; GOARM=5 ;;
+	arm/eabihf) GOARCH=arm; GOARM=7 ;;
+	arm64/base) GOARCH=arm64 ;;
+	i386/base) GOARCH=386 ;;
+	mips/base) GOARCH=mips ;;
+	mips64/abi64) GOARCH=mips64 ;;
+	mips64el/abi64) GOARCH=mips64le ;;
+	mipsel/base) GOARCH=mipsle ;;
+	powerpc/base) GOARCH=ppc ;;
+	ppc64/base) GOARCH=ppc64 ;;
+	ppc64el/base) GOARCH=ppc64le ;;
+	riscv64/base) GOARCH=riscv64 ;;
+	s390/base) GOARCH=s390 ;;
+	s390x/base) GOARCH=s390x ;;
+	sparc/base) GOARCH=sparc ;;
+	sparc64/base) GOARCH=sparc64 ;;
+	*)
+		echo "cannot determine GOARCH for $(dpkg-architecture -qDEB_HOST_ARCH)" 2>&1
+		exit 1
+	;;
+esac
+
+echo "#!/bin/sh"
+echo "export GOARCH=$GOARCH"
+if test -n "$GOARM"; then
+	echo "export GOARM=$GOARM"
+else
+	echo "unset GOARM"
+fi
+if dpkg-architecture -ilinux-any; then
+	echo "export GOOS=linux"
+fi
+cat <<EOF
+: "\${CC:=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)-gcc}"
+export CC
+: "\${PKG_CONFIG:=$(dpkg-architecture -qDEB_HOST_GNU_TYPE)-pkg-config}"
+export PKG_CONFIG
+: "\${CGO_ENABLED:=1}"
+export CGO_ENABLED
+exec /usr/bin/go "\$@"
+EOF

Reply to: