8
8
datadir := /usr/share/go
11
# We loop over supported operating systems and architectures multiple times,
12
# so these two variables contain a centralized version of that code.
13
# The variables $$os and $$arch can be used inside such a loop.
14
FOR_GO_ARCH := for os in $$(echo linux freebsd windows darwin netbsd); do \
16
[ "$$os" = "linux" ] || [ "$$os" = "freebsd" ] && archs="amd64 arm 386"; \
17
for arch in $$(echo $$archs); do
18
FOR_GO_ARCH_END := done; done
11
20
build-arch build-indep build clean install binary-arch binary-indep binary: debian/control
12
21
+dh --parallel $(opt_no_act) $@
14
23
override_dh_auto_clean:
25
# golang-go-$os-$arch.install files are auto-generated in override_dh_install
26
rm -f debian/golang-go-*.install
17
28
rm -f debian/build.stamp
18
29
rm -f test/pass.out test/run.out test/times.out
31
42
override_dh_compress:
32
43
dh_compress -Xusr/share/doc/$(PACKAGE)-doc/html -Xusr/share/doc/$(PACKAGE)-doc/godoc
45
# Generates debian/control from debian/control.base and debian/control.cross.
46
# In the latter, @OS@ and @ARCH@ are replaced with every supported combination
47
# of operating system and architecture (e.g. linux_amd64, linux_386, …).
49
echo "# DO NOT EDIT THIS FILE. EDIT debian/control.* instead!" > debian/control.tmp
50
cat debian/control.base >> debian/control.tmp
52
sed -e "s,@OS@,$$os,g; s,@ARCH@,$$arch,g" debian/control.cross >> debian/control.tmp; \
54
mv debian/control.tmp debian/control
34
56
override_dh_install:
58
echo "pkg/$${os}_$${arch} /usr/lib/go/pkg/" > debian/golang-go-$$os-$$arch.install; \
59
[ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && echo "pkg/linux_amd64_race /usr/lib/go/pkg" >> debian/golang-go-$$os-$$arch.install; \
60
echo "golang-go-$$os-$$arch: arch-independent-package-contains-binary-or-object" > debian/golang-go-$$os-$$arch.lintian-overrides; \
62
# Install the native runtime/cgo.a to the golang-go package.
63
# runtime/cgo is only built for the native architecture, but the
64
# golang-go-OS-ARCH packages are built on one particular buildd, which
65
# might either be i386 or amd64.
66
echo "listing of $$(pwd):"; ls -hlR .
67
echo "listing of GOBIN: ($(GOBIN))"; ls -hlR $(GOBIN)
68
for file in $$(cd pkg/ && ls */runtime/cgo.a); do \
69
mkdir -p $(CURDIR)/debian/golang-go/usr/lib/go/pkg/$$(dirname $$file); \
70
mv pkg/$$file $(CURDIR)/debian/golang-go/usr/lib/go/pkg/$$file; \
35
72
dh_install --fail-missing
36
73
# Replace jquery in the html documentation with a symlink to libjs-jquery.
37
74
-rm $(CURDIR)/debian/golang-doc/usr/share/doc/golang-doc/html/jquery.js && \
49
86
find $(CURDIR)/debian/golang-go/usr/share/go/src -type d -delete
50
87
# Subsequently, /usr/share/go is empty, too, so remove
51
88
find $(CURDIR)/debian/golang-go/usr/share/go -type d -delete
89
# For some reason, Go cross-compiles a handful of tools: {yacc,fix,api,vet,cgo}.
90
# Delete those, as they cannot be ran anyway.
91
# This is tracked upstream at https://code.google.com/p/go/issues/detail?id=5667
92
(cd $(CURDIR)/debian/golang-go/usr/lib/go/pkg/tool && find . -depth -path "./$(GOHOSTOS)_$(GOHOSTARCH)*" -prune -o -delete)
52
93
# Touch built and installed files and directories to have same timestamp
53
94
touch $(CURDIR)/debian/golang-go/usr/lib/go/pkg
54
95
find $(CURDIR)/debian/golang-go/usr/lib/go/pkg -exec touch -r $(CURDIR)/debian/golang-go/usr/lib/go/pkg {} \;
57
98
dh_strip -X".a" -Xgoinstall -Xgodoc -Xgoyacc -Xbin/cgo -Xebnflint -Xgofix -Xgofmt -Xgovet -Xgotest --dbg-package=$(PACKAGE)-dbg
102
echo 'go:Hostarch=$(GOHOSTARCH)' >> debian/golang-go.substvars
104
override_dh_builddeb:
59
107
debian/build.stamp:
60
108
rm -f debian/build.stamp
62
+cd src && bash ./make.bash --no-banner
110
# Build native tools first, then bootstrap all other GOOS/GOARCH combinations.
111
cd src && bash ./make.bash --no-banner
112
# For the race detector to work (go test -race), we need to install the
113
# std library with the race detector enabled. This will result in
114
# having an additional “architecture” directory, e.g. linux_amd64_race.
116
# The race detector currently only works on linux/amd64. The check within
117
# the following loop works precisely the same way src/race.bash does.
119
export GOARCH=$$arch; \
121
cd src && bash ./make.bash --no-clean; \
122
[ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && $(GOBIN)/go install -race std; \
63
125
>debian/build.stamp