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 # or choose only useful crosscompilers?
9 # - subpackage -src files?
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 %bcond_without cgo # cgo (importing C libraries) support
18 %ifnarch %{ix86} %{x8664} %{arm} aarch64 mips64 mips64le ppc64le
20 %undefine with_ext_linker
24 Summary: Go compiler and tools
25 Summary(pl.UTF-8): Kompilator języka Go i narzędzia
29 # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
30 License: BSD and Public Domain
31 Group: Development/Languages
32 # Source0Download: https://golang.org/dl/
33 Source0: https://storage.googleapis.com/golang/go%{version}.src.tar.gz
34 # Source0-md5: 506de2d870409e9003e1440bcfeb3a65
35 Patch0: ca-certs.patch
36 Patch2: %{name}-1.2-verbose-build.patch
37 Patch4: go1.5beta1-disable-TestGdbPython.patch
38 Patch5: go1.5-zoneinfo_testing_only.patch
39 URL: http://golang.org/
41 BuildRequires: rpm-pythonprov
42 # The compiler is written in Go. Needs go(1.4+) compiler for build.
44 BuildRequires: gcc-go >= 6:5
46 BuildRequires: golang >= 1.4
49 BuildRequires: glibc-static
50 BuildRequires: hostname
51 BuildRequires: pcre-devel
54 Requires: ca-certificates
56 ExclusiveArch: %{ix86} %{x8664} %{arm} aarch64 mips64 mips64le ppc64 ppc64le s390x
57 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
59 %define no_install_post_strip 1
60 %define no_install_post_chrpath 1
61 %define _enable_debug_packages 0
62 %define _noautoreqfiles %{_libdir}/%{name}/src
64 %define goroot %{_libdir}/%{name}
79 %define GOARCH mips64x
81 %ifarch ppc64 ppc64le s390x
82 %define GOARCH %{_arch}
86 Go is an open source programming environment that makes it easy to
87 build simple, reliable, and efficient software.
89 %description -l pl.UTF-8
90 Go to mające otwarte źródła środowisko do programowania, pozwalające
91 na łatwe tworzenie prostych, pewnych i wydajnych programów.
94 Summary: Golang shared object libraries
95 Summary(pl.UTF-8): Biblioteki obiektów współdzielonych dla języka Go
97 Requires: %{name} = %{version}-%{release}
100 Golang shared object libraries.
102 %description shared -l pl.UTF-8
103 Biblioteki obiektów współdzielonych dla języka Go.
106 Summary: Documentation for Go language
107 Summary(fr.UTF-8): Documentation pour Go
108 Summary(it.UTF-8): Documentazione di Go
109 Summary(pl.UTF-8): Dokumentacja do języka Go
111 %if "%{_rpmversion}" >= "5"
116 Documentation for Go language.
118 %description doc -l fr.UTF-8
119 Documentation pour Go.
121 %description doc -l it.UTF-8
122 Documentazione di Go.
124 %description doc -l pl.UTF-8
125 Dokumentacja do języka Go.
136 # bootstrap compiler GOROOT
137 %if %{with bootstrap}
138 export GOROOT_BOOTSTRAP=%{_prefix}
140 export GOROOT_BOOTSTRAP=%{goroot}
142 export GOROOT_FINAL=%{goroot}
144 export GOHOSTOS=linux
145 export GOHOSTARCH=%{GOARCH}
148 export GOARCH=%{GOARCH}
149 %if %{without external_linker}
150 export GO_LDFLAGS="-linkmode internal"
158 # use our gcc options for this build, but store gcc as default for compiler
159 export CFLAGS="%{rpmcflags}"
160 export LDFLAGS="%{rpmldflags}"
163 export CC="${CC#ccache }"
164 export CC_FOR_TARGET="$CC"
168 # optflags for go tools build
169 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[ ]*//;s/[ ]*$//;s/[ ]\+/ /g' -e 's/ /\",\"/g')\""
170 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
171 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
177 ./make.bash --no-clean
180 # build shared std lib
182 GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
186 rm -rf $RPM_BUILD_ROOT
187 GOROOT=$RPM_BUILD_ROOT%{goroot}
189 install -d $GOROOT/{misc,lib,src}
190 install -d $RPM_BUILD_ROOT%{_bindir}
192 cp -a pkg lib bin src VERSION $GOROOT
193 cp -a misc/cgo $GOROOT/misc
195 # kill Win32 and Plan9 scripts
196 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
198 # https://github.com/golang/go/issues/4749
199 find $GOROOT/src | xargs touch -r $GOROOT/VERSION
200 # and level out all the built archives
202 find $GOROOT/pkg | xargs touch -r $GOROOT/pkg
204 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
205 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
206 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
208 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
209 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
220 for tool in $tools; do
221 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
225 rm -rf $RPM_BUILD_ROOT
228 %defattr(644,root,root,755)
229 %doc AUTHORS CONTRIBUTORS LICENSE
231 %attr(755,root,root) %{_bindir}/5a
232 %attr(755,root,root) %{_bindir}/5c
233 %attr(755,root,root) %{_bindir}/5g
234 %attr(755,root,root) %{_bindir}/5l
237 %attr(755,root,root) %{_bindir}/6a
238 %attr(755,root,root) %{_bindir}/6c
239 %attr(755,root,root) %{_bindir}/6g
240 %attr(755,root,root) %{_bindir}/6l
243 %attr(755,root,root) %{_bindir}/8a
244 %attr(755,root,root) %{_bindir}/8c
245 %attr(755,root,root) %{_bindir}/8g
246 %attr(755,root,root) %{_bindir}/8l
248 %attr(755,root,root) %{_bindir}/cgo
249 %attr(755,root,root) %{_bindir}/ebnflint
250 %attr(755,root,root) %{_bindir}/go
251 %attr(755,root,root) %{_bindir}/godoc
252 %attr(755,root,root) %{_bindir}/gofmt
253 %dir %{_libdir}/%{name}
254 %{_libdir}/%{name}/VERSION
255 %dir %{_libdir}/%{name}/bin
256 %attr(755,root,root) %{_libdir}/%{name}/bin/*
258 %{_libdir}/%{name}/lib
259 %{_libdir}/%{name}/misc
260 %{_libdir}/%{name}/src
261 %dir %{_libdir}/%{name}/pkg
262 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
263 %{_libdir}/%{name}/pkg/obj
264 %dir %{_libdir}/%{name}/pkg/tool
265 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
266 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
268 %{_libdir}/%{name}/pkg/bootstrap
269 %{_libdir}/%{name}/pkg/include
273 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
274 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
275 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/compress
276 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/container
277 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/crypto
278 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/debug
279 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/encoding
280 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/go
281 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/hash
282 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/internal
283 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/io
284 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/math
285 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/mime
286 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/net
287 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/os
288 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/path
289 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
290 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
291 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
292 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
293 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
298 %defattr(644,root,root,755)
299 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_dynlink
303 %defattr(644,root,root,755)