~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to debian/rules

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
datadir := /usr/share/go
9
9
bindir := /bin
10
10
 
 
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 \
 
15
        archs="amd64 386"; \
 
16
        [ "$$os" = "linux" ] || [ "$$os" = "freebsd" ] && archs="amd64 arm 386"; \
 
17
        for arch in $$(echo $$archs); do
 
18
FOR_GO_ARCH_END := done; done
 
19
 
11
20
build-arch build-indep build clean install binary-arch binary-indep binary: debian/control
12
21
        +dh --parallel $(opt_no_act) $@
13
22
 
14
23
override_dh_auto_clean:
15
24
        rm -rf bin pkg
 
25
        # golang-go-$os-$arch.install files are auto-generated in override_dh_install
 
26
        rm -f debian/golang-go-*.install
16
27
        rm -f debian/*+
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
33
44
 
 
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, …).
 
48
gencontrol:
 
49
        echo "# DO NOT EDIT THIS FILE. EDIT debian/control.* instead!" > debian/control.tmp
 
50
        cat debian/control.base >> debian/control.tmp
 
51
        ${FOR_GO_ARCH} \
 
52
                BUILDARCHS=all; \
 
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; \
 
55
        ${FOR_GO_ARCH_END}
 
56
        mv debian/control.tmp debian/control
 
57
 
34
58
override_dh_install:
 
59
        -${FOR_GO_ARCH} \
 
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; \
 
63
        ${FOR_GO_ARCH_END}
 
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; \
 
73
        done
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 {} \;
46
98
 
47
99
override_dh_strip:
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
 
102
 
 
103
override_dh_prep:
 
104
        dh_prep
 
105
        echo 'go:Hostarch=$(GOHOSTARCH)' >> debian/golang-go.substvars
 
106
 
 
107
override_dh_builddeb:
 
108
        dh_builddeb -- -Zxz
49
109
 
50
110
debian/build.stamp:
51
111
        rm -f debian/build.stamp
52
112
        mkdir -p $(GOBIN)
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.
 
118
        #
 
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.
 
121
        -${FOR_GO_ARCH} \
 
122
                export GOARCH=$$arch; \
 
123
                export GOOS=$$os; \
 
124
                cd src && bash ./make.bash --no-clean; \
 
125
                [ "$$arch" = "amd64" ] && [ "$$os" = "linux" ] && $(GOBIN)/go install -race std; \
 
126
                cd ..; \
 
127
        ${FOR_GO_ARCH_END}
54
128
        >debian/build.stamp
55
129
 
56
130
opt_no_act =