diff options
author | Michael Stapelberg <stapelberg@debian.org> | 2013-06-07 23:18:31 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2013-06-07 23:18:31 +0200 |
commit | 36f57d659c29f20b9a1adbda1e7a88c818d14f11 (patch) | |
tree | 69701e9a7a28851a03913e56efc1873f02fea8f9 | |
parent | 5775df42605ddf6c984570597bd36764d3c45841 (diff) | |
download | golang-debian/2%1.1-2.tar.gz |
build golang-go-$GOOS-$GOARCH for cross compilation, update changelogdebian/2%1.1-2
-rw-r--r-- | debian/README.Debian | 21 | ||||
-rw-r--r-- | debian/changelog | 12 | ||||
-rw-r--r-- | debian/control | 196 | ||||
-rw-r--r-- | debian/control.base | 148 | ||||
-rw-r--r-- | debian/control.cross | 16 | ||||
-rw-r--r-- | debian/golang-go.install | 3 | ||||
-rwxr-xr-x | debian/rules | 53 |
7 files changed, 443 insertions, 6 deletions
diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 000000000..5ad7f24d8 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,21 @@ +== Cross-Compilation + +Go supports cross-compilation. The environment variables GOOS (e.g. linux, +netbsd, …) and GOARCH (amd64, 386, arm) influence the resulting binary. + +For example, to compile helloworld for linux_386, use: + + ~/gocode/src/helloworld $ GOARCH=386 go build + ~/gocode/src/helloworld $ file helloworld + helloworld: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), + statically linked, not stripped + +If you get an error message like this: + + ~/gocode/src/helloworld $ GOARCH=386 go build + go build runtime: linux/386 must be bootstrapped using make.bash + +…you are missing the appropriate golang-go-$GOOS-$GOARCH debian package, +i.e. golang-go-linux-386 in this case. + +-- Michael Stapelberg <stapelberg@debian.org> Fri, 07 Jun 2013 22:34:12 +0200 diff --git a/debian/changelog b/debian/changelog index 9dad59073..1c0663f22 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +golang (2:1.1-2) unstable; urgency=low + + [ Ondřej Surý ] + * Promote Michael to Maintainer + + [ Michael Stapelberg ] + * Build golang-go-$GOOS-$GOARCH packages for cross-compiling (Closes: #710090) + * Build race detector on linux/amd64 (only supported arch) (Closes: #710691) + * Switch compression to xz (50% smaller binaries) + + -- Michael Stapelberg <stapelberg@debian.org> Fri, 07 Jun 2013 23:18:09 +0200 + golang (2:1.1-1) unstable; urgency=low * New upstream release: Go 1.1! diff --git a/debian/control b/debian/control index 12785bc84..941c4d18e 100644 --- a/debian/control +++ b/debian/control @@ -1,3 +1,4 @@ +# DO NOT EDIT THIS FILE. EDIT debian/control.* instead! Source: golang Section: devel Priority: optional @@ -12,7 +13,8 @@ Homepage: http://golang.org/ Package: golang-go Architecture: i386 amd64 armel armhf Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, - golang-src (>= ${source:Version}) + golang-src (>= ${source:Version}), + golang-go-linux-${go:Hostarch} (= ${source:Version}) Replaces: golang-weekly-go, golang-weekly-tools, golang-tools Conflicts: golang-weekly-go, golang-weekly-tools, golang-tools Provides: go-compiler, golang-weekly-go, golang-weekly-tools, golang-tools @@ -145,3 +147,195 @@ Suggests: golang-go Description: Go programming language - Vim highlighting syntax files This package provides syntax files for the Vim editor for editing code in Google's Go programming language. + +Package: golang-go-linux-amd64 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for linux_amd64 + This package contains the Go standard library, + compiled for linux_amd64. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-linux-arm +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for linux_arm + This package contains the Go standard library, + compiled for linux_arm. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-linux-386 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for linux_386 + This package contains the Go standard library, + compiled for linux_386. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-freebsd-amd64 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for freebsd_amd64 + This package contains the Go standard library, + compiled for freebsd_amd64. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-freebsd-arm +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for freebsd_arm + This package contains the Go standard library, + compiled for freebsd_arm. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-freebsd-386 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for freebsd_386 + This package contains the Go standard library, + compiled for freebsd_386. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-windows-amd64 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for windows_amd64 + This package contains the Go standard library, + compiled for windows_amd64. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-windows-386 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for windows_386 + This package contains the Go standard library, + compiled for windows_386. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-darwin-amd64 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for darwin_amd64 + This package contains the Go standard library, + compiled for darwin_amd64. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-darwin-386 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for darwin_386 + This package contains the Go standard library, + compiled for darwin_386. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-netbsd-amd64 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for netbsd_amd64 + This package contains the Go standard library, + compiled for netbsd_amd64. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. + +Package: golang-go-netbsd-386 +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for netbsd_386 + This package contains the Go standard library, + compiled for netbsd_386. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. diff --git a/debian/control.base b/debian/control.base new file mode 100644 index 000000000..c7a8a0b42 --- /dev/null +++ b/debian/control.base @@ -0,0 +1,148 @@ +Source: golang +Section: devel +Priority: optional +Maintainer: Michael Stapelberg <stapelberg@debian.org> +Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-golang/golang.git +Vcs-Git: git://anonscm.debian.org/pkg-golang/golang.git +Build-Depends: debhelper (>= 7.4.10), bison, ed, mawk | awk, perl, netbase +Build-Depends-Indep: po-debconf +Standards-Version: 3.9.3 +Homepage: http://golang.org/ + +Package: golang-go +Architecture: i386 amd64 armel armhf +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}, + golang-src (>= ${source:Version}), + golang-go-linux-${go:Hostarch} (= ${source:Version}) +Replaces: golang-weekly-go, golang-weekly-tools, golang-tools +Conflicts: golang-weekly-go, golang-weekly-tools, golang-tools +Provides: go-compiler, golang-weekly-go, golang-weekly-tools, golang-tools +Description: Go programming language compiler + 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 provides an assembler, a compiler, and a linker for the + Go programming language. This is Google's implementation of the Go + tool chain. + +Package: golang-src +Replaces: golang-weekly-src, golang-go (<< 2:1-3~) +Conflicts: golang-weekly-src +Provides: golang-weekly-src +Breaks: golang-go (<< 2:1-3~) +Architecture: i386 amd64 armel armhf +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Go programming language compiler - 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 package provides the Go programming language source files needed + for godoc and goinstall. + +Package: golang-doc +Replaces: golang-weekly-doc +Conflicts: golang-weekly-doc +Provides: golang-weekly-doc +Depends: ${misc:Depends}, golang-go, libjs-jquery +Architecture: all +Section: doc +Description: Go programming language compiler - 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 package provides the documentation for the Go programming + language. You can view the formatted documentation by running "godoc + --http=:6060", and then visiting http://localhost:6060/doc/install.html. + +Package: golang-dbg +Replaces: golang-weekly-dbg +Conflicts: golang-weekly-dbg +Provides: golang-weekly-dbg +Architecture: i386 amd64 armel armhf +Depends: ${misc:Depends}, golang-go (= ${binary:Version}) +Recommends: gdb +Section: debug +Priority: extra +Description: Go programming language compiler - debug 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 package provides the debug symbols for Google's Go tool + chain binaries (assembler, compiler, linker) needed for properly + debugging errors in the tool chain with gdb. + +Package: golang +Replaces: golang-weekly +Conflicts: golang-weekly +Provides: golang-weekly +Depends: ${misc:Depends}, + golang-go (>= ${source:Version}), + golang-src (>= ${source:Version}), + golang-doc (>= ${source:Version}) +Architecture: all +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. + +Package: golang-mode +Architecture: all +Depends: ${misc:Depends}, emacs23 | emacsen, emacsen-common (>= 1.4.14) +Suggests: golang-go +Description: Go programming language - mode for GNU Emacs + This package provides a GNU Emacs major mode for editing code in + Google's Go programming language. + +Package: kate-syntax-go +Architecture: all +Depends: ${misc:Depends}, kate +Suggests: golang-go +Description: Go programming language - Kate highlighting syntax files + This package provides syntax files for the Kate editor for editing code + in Google's Go programming language. + +Package: vim-syntax-go +Architecture: all +Depends: ${misc:Depends}, vim +Recommends: vim-addon-manager +Suggests: golang-go +Description: Go programming language - Vim highlighting syntax files + This package provides syntax files for the Vim editor for editing code + in Google's Go programming language. diff --git a/debian/control.cross b/debian/control.cross new file mode 100644 index 000000000..321f02028 --- /dev/null +++ b/debian/control.cross @@ -0,0 +1,16 @@ + +Package: golang-go-@OS@-@ARCH@ +Architecture: all +Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends} +Description: Go standard library compiled for @OS@_@ARCH@ + This package contains the Go standard library, + compiled for @OS@_@ARCH@. + . + This package is just one of a number of packages, each providing the Go + standard library for a specific operating system/architecture combination. + Go supports cross-compilation, so each of these packages is useful on any + architecture. + . + The files contained in this package are independent of the host architecture, + that is, you can use golang-go-linux-amd64 to generate a binary for + linux_amd64, even though you are executing the Go compiler on linux_386. diff --git a/debian/golang-go.install b/debian/golang-go.install index a94edb563..09db19908 100644 --- a/debian/golang-go.install +++ b/debian/golang-go.install @@ -1,4 +1,5 @@ bin/go /usr/bin bin/godoc /usr/bin bin/gofmt /usr/bin -pkg /usr/lib/go/ +pkg/obj /usr/lib/go/pkg/ +pkg/tool /usr/lib/go/pkg/ diff --git a/debian/rules b/debian/rules index 13b18a6c8..0959d236e 100755 --- a/debian/rules +++ b/debian/rules @@ -8,11 +8,22 @@ libexecdir := /usr/lib/go datadir := /usr/share/go bindir := /bin +# We loop over supported operating systems and architectures multiple times, +# so these two variables contain a centralized version of that code. +# The variables $$os and $$arch can be used inside such a loop. +FOR_GO_ARCH := for os in $$(echo linux freebsd windows darwin netbsd); do \ + archs="amd64 386"; \ + [ "$$os" = "linux" ] || [ "$$os" = "freebsd" ] && archs="amd64 arm 386"; \ + for arch in $$(echo $$archs); do +FOR_GO_ARCH_END := done; done + build-arch build-indep build clean install binary-arch binary-indep binary: debian/control +dh --parallel $(opt_no_act) $@ override_dh_auto_clean: rm -rf bin pkg + # golang-go-$os-$arch.install files are auto-generated in override_dh_install + rm -f debian/golang-go-*.install rm -f debian/*+ rm -f debian/build.stamp rm -f test/pass.out test/run.out test/times.out @@ -31,7 +42,23 @@ endif override_dh_compress: dh_compress -Xusr/share/doc/$(PACKAGE)-doc/html -Xusr/share/doc/$(PACKAGE)-doc/godoc +# Generates debian/control from debian/control.base and debian/control.cross. +# In the latter, @OS@ and @ARCH@ are replaced with every supported combination +# of operating system and architecture (e.g. linux_amd64, linux_386, …). +gencontrol: + echo "# DO NOT EDIT THIS FILE. EDIT debian/control.* instead!" > debian/control.tmp + cat debian/control.base >> debian/control.tmp + ${FOR_GO_ARCH} \ + sed -e "s,@OS@,$$os,g; s,@ARCH@,$$arch,g" debian/control.cross >> debian/control.tmp; \ + ${FOR_GO_ARCH_END} + mv debian/control.tmp debian/control + override_dh_install: + -${FOR_GO_ARCH} \ + echo "pkg/$${os}_$${arch} /usr/lib/go/pkg/" > debian/golang-go-$$os-$$arch.install; \ + [ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && echo "pkg/linux_amd64_race /usr/lib/go/pkg" >> debian/golang-go-$$os-$$arch.install; \ + echo "golang-go-$$os-$$arch: arch-independent-package-contains-binary-or-object" > debian/golang-go-$$os-$$arch.lintian-overrides; \ + ${FOR_GO_ARCH_END} dh_install --fail-missing # Replace jquery in the html documentation with a symlink to libjs-jquery. -rm $(CURDIR)/debian/golang-doc/usr/share/doc/golang-doc/html/jquery.js && \ @@ -49,6 +76,10 @@ override_dh_install: find $(CURDIR)/debian/golang-go/usr/share/go/src -type d -delete # Subsequently, /usr/share/go is empty, too, so remove find $(CURDIR)/debian/golang-go/usr/share/go -type d -delete + # For some reason, Go cross-compiles a handful of tools: {yacc,fix,api,vet,cgo}. + # Delete those, as they cannot be ran anyway. + # This is tracked upstream at https://code.google.com/p/go/issues/detail?id=5667 + (cd $(CURDIR)/debian/golang-go/usr/lib/go/pkg/tool && find . -depth -path "./$(GOHOSTOS)_$(GOHOSTARCH)*" -prune -o -delete) # Touch built and installed files and directories to have same timestamp touch $(CURDIR)/debian/golang-go/usr/lib/go/pkg find $(CURDIR)/debian/golang-go/usr/lib/go/pkg -exec touch -r $(CURDIR)/debian/golang-go/usr/lib/go/pkg {} \; @@ -56,17 +87,31 @@ override_dh_install: override_dh_strip: dh_strip -X".a" -Xgoinstall -Xgodoc -Xgoyacc -Xbin/cgo -Xebnflint -Xgofix -Xgofmt -Xgovet -Xgotest --dbg-package=$(PACKAGE)-dbg +override_dh_prep: + dh_prep + echo 'go:Hostarch=$(GOHOSTARCH)' >> debian/golang-go.substvars + +override_dh_builddeb: + dh_builddeb -- -Zxz + debian/build.stamp: rm -f debian/build.stamp mkdir -p $(GOBIN) - +cd src && bash ./make.bash --no-banner + # Build native tools first, then bootstrap all other GOOS/GOARCH combinations. + cd src && bash ./make.bash --no-banner # For the race detector to work (go test -race), we need to install the # std library with the race detector enabled. This will result in # having an additional “architecture” directory, e.g. linux_amd64_race. # - # The race detector currently only works on linux/amd64. The following - # check works precisely the same way src/race.bash does. - -[ "$(shell uname -m)" = "x86_64" ] && [ "$(shell uname)" = "Linux" ] && $(CURDIR)/bin/go install -race std + # The race detector currently only works on linux/amd64. The check within + # the following loop works precisely the same way src/race.bash does. + -${FOR_GO_ARCH} \ + export GOARCH=$$arch; \ + export GOOS=$$os; \ + cd src && bash ./make.bash --no-clean; \ + [ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && $(GOBIN)/go install -race std; \ + cd ..; \ + ${FOR_GO_ARCH_END} >debian/build.stamp opt_no_act = |