]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
up to 1.6.2; mmap-cgo-stackalign.patch applied upstream
[packages/golang.git] / golang.spec
1 # TODO
2 # - allow disabling tests (currently bcond exists just for showing which are test deps)
3 # - add verbose build output (currently dummy bcond)
4 # - setup GOMAXPROCS=2 from _smp_mflags
5 # - fix CC containing spaces (ccache)
6 # - check if hg use at build time can be dropped
7 # - build all target archs, subpackage them: http://golang.org/doc/install/source#environment
8 # - subpackage -src files?
9 # - subpackage for "shared"?
10
11 # Conditional build:
12 %bcond_without  verbose         # verbose build (V=1)
13 %bcond_without  tests           # build without tests [nop actually]
14 %bcond_without  shared          # Build golang shared objects for stdlib
15 %bcond_without  ext_linker      # Build golang using external/internal(close to cgo disabled) linking.
16
17 %ifnarch %{ix86} %{x8664} %{arm} ppc64le aarch64
18 %undefine       with_shared
19 %undefine       with_ext_linker
20 %endif
21
22 Summary:        Go compiler and tools
23 Summary(pl.UTF-8):      Kompilator języka Go i narzędzia
24 Name:           golang
25 Version:        1.6.2
26 Release:        1
27 # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
28 License:        BSD and Public Domain
29 Group:          Development/Languages
30 # Source0Download: https://golang.org/dl/
31 Source0:        https://storage.googleapis.com/golang/go%{version}.src.tar.gz
32 # Source0-md5:  d1b50fa98d9a71eeee829051411e6207
33 Patch0:         ca-certs.patch
34 Patch1:         %{name}-binutils.patch
35 Patch2:         %{name}-1.2-verbose-build.patch
36 Patch4:         go1.5beta1-disable-TestGdbPython.patch
37 Patch5:         go1.5-zoneinfo_testing_only.patch
38 URL:            http://golang.org/
39 BuildRequires:  bash
40 BuildRequires:  rpm-pythonprov
41 # The compiler is written in Go. Needs go(1.4+) compiler for build.
42 %if %{with bootstrap}
43 BuildRequires:  gcc-go >= 6:5
44 %else
45 BuildRequires:  golang >= 1.4
46 %endif
47 %if %{with tests}
48 BuildRequires:  glibc-static
49 BuildRequires:  hostname
50 BuildRequires:  pcre-devel
51 BuildRequires:  tzdata
52 %endif
53 Requires:       ca-certificates
54 Conflicts:      gcc-go
55 ExclusiveArch:  %{ix86} %{x8664} %{arm}
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %define         no_install_post_strip   1
59 %define         no_install_post_chrpath 1
60 %define         _enable_debug_packages  0
61 %define         _noautoreqfiles         %{_libdir}/%{name}/src
62
63 %define goroot %{_libdir}/%{name}
64
65 %ifarch %{ix86}
66 %define GOARCH 386
67 %endif
68 %ifarch %{x8664}
69 %define GOARCH amd64
70 %endif
71
72 %description
73 Go is an open source programming environment that makes it easy to
74 build simple, reliable, and efficient software.
75
76 %description -l pl.UTF-8
77 Go to mające otwarte źródła środowisko do programowania, pozwalające
78 na łatwe tworzenie prostych, pewnych i wydajnych programów.
79
80 %package doc
81 Summary:        Manual for go
82 Summary(fr.UTF-8):      Documentation pour go
83 Summary(it.UTF-8):      Documentazione di go
84 Summary(pl.UTF-8):      Podręcznik dla go
85 Group:          Documentation
86 %if "%{_rpmversion}" >= "5"
87 BuildArch:      noarch
88 %endif
89
90 %description doc
91 Documentation for go.
92
93 %description doc -l fr.UTF-8
94 Documentation pour go.
95
96 %description doc -l it.UTF-8
97 Documentazione di go.
98
99 %description doc -l pl.UTF-8
100 Dokumentacja do go.
101
102 %prep
103 %setup -qc
104 mv go/* .
105 %patch0 -p1
106 #%patch1 -p1 seems outdated, compiler rewritten in .go instead of .c
107 %patch2 -p1
108 %patch4 -p1
109 %patch5 -p1
110
111 cat > env.sh <<'EOF'
112 # bootstrap compiler GOROOT
113 %if %{with bootstrap}
114 export GOROOT_BOOTSTRAP=%{_prefix}
115 %else
116 export GOROOT_BOOTSTRAP=%{goroot}
117 %endif
118 export GOROOT_FINAL=%{goroot}
119
120 export GOHOSTOS=linux
121 export GOHOSTARCH=%{GOARCH}
122
123 export GOOS=linux
124 export GOARCH=%{GOARCH}
125 %if %{without external_linker}
126 export GO_LDFLAGS="-linkmode internal"
127 %endif
128 %if %{without cgo_enabled}
129 export CGO_ENABLED=0
130 %endif
131
132 # use our gcc options for this build, but store gcc as default for compiler
133 export CFLAGS="%{rpmcflags}"
134 export LDFLAGS="%{rpmldflags}"
135
136 CC="%{__cc}"
137 export CC="${CC#ccache }"
138 export CC_FOR_TARGET="$CC"
139 EOF
140
141 %if 0
142 # optflags for go tools build
143 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
144 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
145 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
146 %endif
147
148 %build
149 . ./env.sh
150 cd src
151 ./make.bash --no-clean
152 cd ..
153
154 # build shared std lib
155 %if %{with shared}
156 GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
157 %endif
158
159 %install
160 rm -rf $RPM_BUILD_ROOT
161 GOROOT=$RPM_BUILD_ROOT%{goroot}
162
163 install -d $GOROOT/{misc,lib,src}
164 install -d $RPM_BUILD_ROOT%{_bindir}
165
166 cp -a pkg lib bin src VERSION $GOROOT
167 cp -a misc/cgo $GOROOT/misc
168
169 # kill Win32 and Plan9 scripts
170 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
171
172 # https://github.com/golang/go/issues/4749
173 find $GOROOT/src | xargs touch -r $GOROOT/VERSION
174 # and level out all the built archives
175 touch $GOROOT/pkg
176 find $GOROOT/pkg | xargs touch -r $GOROOT/pkg
177
178 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
179 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
180 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
181
182 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
183 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
184
185 %ifarch %{ix86}
186 tools="8a 8c 8g 8l"
187 %endif
188 %ifarch %{x8664}
189 tools="6a 6c 6g 6l"
190 %endif
191 %ifarch %{arm}
192 tools="5a 5c 5g 5l"
193 %endif
194 for tool in $tools; do
195         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
196 done
197
198 %clean
199 rm -rf $RPM_BUILD_ROOT
200
201 %files
202 %defattr(644,root,root,755)
203 %doc AUTHORS CONTRIBUTORS LICENSE
204 %ifarch %{arm}
205 %attr(755,root,root) %{_bindir}/5a
206 %attr(755,root,root) %{_bindir}/5c
207 %attr(755,root,root) %{_bindir}/5g
208 %attr(755,root,root) %{_bindir}/5l
209 %endif
210 %ifarch %{x8664}
211 %attr(755,root,root) %{_bindir}/6a
212 %attr(755,root,root) %{_bindir}/6c
213 %attr(755,root,root) %{_bindir}/6g
214 %attr(755,root,root) %{_bindir}/6l
215 %endif
216 %ifarch %{ix86}
217 %attr(755,root,root) %{_bindir}/8a
218 %attr(755,root,root) %{_bindir}/8c
219 %attr(755,root,root) %{_bindir}/8g
220 %attr(755,root,root) %{_bindir}/8l
221 %endif
222 %attr(755,root,root) %{_bindir}/cgo
223 %attr(755,root,root) %{_bindir}/ebnflint
224 %attr(755,root,root) %{_bindir}/go
225 %attr(755,root,root) %{_bindir}/godoc
226 %attr(755,root,root) %{_bindir}/gofmt
227 %dir %{_libdir}/%{name}
228 %{_libdir}/%{name}/VERSION
229 %dir %{_libdir}/%{name}/bin
230 %attr(755,root,root) %{_libdir}/%{name}/bin/*
231
232 %{_libdir}/%{name}/lib
233 %{_libdir}/%{name}/misc
234 %{_libdir}/%{name}/src
235 %dir %{_libdir}/%{name}/pkg
236 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
237 %{_libdir}/%{name}/pkg/obj
238 %dir %{_libdir}/%{name}/pkg/tool
239 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
240 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
241
242 %{_libdir}/%{name}/pkg/bootstrap
243 %{_libdir}/%{name}/pkg/include
244
245 %if %{with shared}
246 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_dynlink
247 %endif
248
249 %if 0
250 #ifarch %{x8664}
251 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
252 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
253 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/compress
254 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/container
255 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/crypto
256 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/debug
257 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/encoding
258 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/go
259 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/hash
260 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/internal
261 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/io
262 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/math
263 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/mime
264 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/net
265 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/os
266 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/path
267 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
268 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
269 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
270 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
271 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
272 %endif
273
274 %files doc
275 %defattr(644,root,root,755)
276 %doc doc/*
This page took 0.084802 seconds and 4 git commands to generate.