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
53
[ "$$os" = "linux" ] && BUILDARCHS="i386 amd64 armel armhf"; \
54
sed -e "s,@OS@,$$os,g; s,@ARCH@,$$arch,g; s,@BUILDARCHS@,$$BUILDARCHS,g" debian/control.cross >> debian/control.tmp; \
56
mv debian/control.tmp debian/control
34
58
override_dh_install:
60
echo "pkg/$${os}_$${arch} /usr/lib/go/pkg/" > debian/golang-go-$$os-$$arch.install; \
61
[ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && echo "pkg/linux_amd64_race /usr/lib/go/pkg" >> debian/golang-go-$$os-$$arch.install; \
62
echo "golang-go-$$os-$$arch: arch-independent-package-contains-binary-or-object" > debian/golang-go-$$os-$$arch.lintian-overrides; \
64
# Install the native runtime/cgo.a to the golang-go package.
65
# runtime/cgo is only built for the native architecture, but the
66
# golang-go-OS-ARCH packages are built on one particular buildd, which
67
# might either be i386 or amd64.
68
echo "listing of $$(pwd):"; ls -hlR .
69
echo "listing of GOBIN: ($(GOBIN))"; ls -hlR $(GOBIN)
70
for file in $$(cd pkg/ && ls */runtime/cgo.a); do \
71
mkdir -p $(CURDIR)/debian/golang-go/usr/lib/go/pkg/$$(dirname $$file); \
72
mv pkg/$$file $(CURDIR)/debian/golang-go/usr/lib/go/pkg/$$file; \
35
74
dh_install --fail-missing
36
# Remove binary from documentation
37
-rm $(CURDIR)/debian/golang-doc/usr/share/doc/golang-doc/html/articles/wiki/get.bin
75
# Replace jquery in the html documentation with a symlink to libjs-jquery.
76
-rm $(CURDIR)/debian/golang-doc/usr/share/doc/golang-doc/html/jquery.js && \
77
ln -s /usr/share/javascript/jquery/jquery.min.js $(CURDIR)/debian/golang-doc/usr/share/doc/golang-doc/html/jquery.js
38
78
# Make scripts executable
39
79
chmod +x $(CURDIR)/debian/golang-src/usr/share/go/src/cmd/godoc/setup-godoc-app.bash
40
80
# Remove testdata and tests from installed src directory
41
81
find $(CURDIR)/debian/golang-src/usr/share/go/src -type d -name testdata -prune -execdir rm -rf {} \;
42
82
find $(CURDIR)/debian/golang-src/usr/share/go/src -type f -name '*_test.go' -delete
83
# Remove .syso files of the race detector; it is not used yet and the files are arch-dependent.
84
find $(CURDIR)/debian/golang-src/usr/share/go/src/pkg/runtime/race -type f -name '*.syso' -delete
85
# Remove Plan9 rc(1) scripts
86
find $(CURDIR)/debian/golang-src/usr/share/go/src -type f -name "*.rc" -delete
87
# Remove empty /usr/share/go/src from golang-go, it is provided by golang-src
88
find $(CURDIR)/debian/golang-go/usr/share/go/src -type d -delete
89
# Subsequently, /usr/share/go is empty, too, so remove
90
find $(CURDIR)/debian/golang-go/usr/share/go -type d -delete
91
# For some reason, Go cross-compiles a handful of tools: {yacc,fix,api,vet,cgo}.
92
# Delete those, as they cannot be ran anyway.
93
# This is tracked upstream at https://code.google.com/p/go/issues/detail?id=5667
94
(cd $(CURDIR)/debian/golang-go/usr/lib/go/pkg/tool && find . -depth -path "./$(GOHOSTOS)_$(GOHOSTARCH)*" -prune -o -delete)
43
95
# Touch built and installed files and directories to have same timestamp
44
96
touch $(CURDIR)/debian/golang-go/usr/lib/go/pkg
45
97
find $(CURDIR)/debian/golang-go/usr/lib/go/pkg -exec touch -r $(CURDIR)/debian/golang-go/usr/lib/go/pkg {} \;
48
dh_strip -X".a" -Xgoinstall -Xgodoc -Xgoyacc -Xbin/cgo -Xebnflint -Xgofix -Xgofmt -Xgovet -Xgotest --dbg-package=$(PACKAGE)-dbg
100
# strip disabled as golang upstream doesn't support it and it makes go
101
# crash. See http://bugs.debian.org/717172
105
echo 'go:Hostarch=$(GOHOSTARCH)' >> debian/golang-go.substvars
107
override_dh_builddeb:
50
110
debian/build.stamp:
51
111
rm -f debian/build.stamp
53
+cd src && bash ./make.bash --no-banner
113
# Build native tools first, then bootstrap all other GOOS/GOARCH combinations.
114
cd src && bash ./make.bash --no-banner
115
# For the race detector to work (go test -race), we need to install the
116
# std library with the race detector enabled. This will result in
117
# having an additional “architecture” directory, e.g. linux_amd64_race.
119
# The race detector currently only works on linux/amd64. The check within
120
# the following loop works precisely the same way src/race.bash does.
122
export GOARCH=$$arch; \
124
cd src && bash ./make.bash --no-clean; \
125
[ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && $(GOBIN)/go install -race std; \
54
128
>debian/build.stamp