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"?
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.
17 %ifnarch %{ix86} %{x8664} %{arm} ppc64le aarch64
19 %undefine with_ext_linker
22 Summary: Go compiler and tools
23 Summary(pl.UTF-8): Kompilator języka Go i narzędzia
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/
40 BuildRequires: rpm-pythonprov
41 # The compiler is written in Go. Needs go(1.4+) compiler for build.
43 BuildRequires: gcc-go >= 6:5
45 BuildRequires: golang >= 1.4
48 BuildRequires: glibc-static
49 BuildRequires: hostname
50 BuildRequires: pcre-devel
53 Requires: ca-certificates
55 ExclusiveArch: %{ix86} %{x8664} %{arm}
56 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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
63 %define goroot %{_libdir}/%{name}
73 Go is an open source programming environment that makes it easy to
74 build simple, reliable, and efficient software.
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.
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
86 %if "%{_rpmversion}" >= "5"
93 %description doc -l fr.UTF-8
94 Documentation pour go.
96 %description doc -l it.UTF-8
99 %description doc -l pl.UTF-8
106 #%patch1 -p1 seems outdated, compiler rewritten in .go instead of .c
112 # bootstrap compiler GOROOT
113 %if %{with bootstrap}
114 export GOROOT_BOOTSTRAP=%{_prefix}
116 export GOROOT_BOOTSTRAP=%{goroot}
118 export GOROOT_FINAL=%{goroot}
120 export GOHOSTOS=linux
121 export GOHOSTARCH=%{GOARCH}
124 export GOARCH=%{GOARCH}
125 %if %{without external_linker}
126 export GO_LDFLAGS="-linkmode internal"
128 %if %{without cgo_enabled}
132 # use our gcc options for this build, but store gcc as default for compiler
133 export CFLAGS="%{rpmcflags}"
134 export LDFLAGS="%{rpmldflags}"
137 export CC="${CC#ccache }"
138 export CC_FOR_TARGET="$CC"
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
151 ./make.bash --no-clean
154 # build shared std lib
156 GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
160 rm -rf $RPM_BUILD_ROOT
161 GOROOT=$RPM_BUILD_ROOT%{goroot}
163 install -d $GOROOT/{misc,lib,src}
164 install -d $RPM_BUILD_ROOT%{_bindir}
166 cp -a pkg lib bin src VERSION $GOROOT
167 cp -a misc/cgo $GOROOT/misc
169 # kill Win32 and Plan9 scripts
170 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
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
176 find $GOROOT/pkg | xargs touch -r $GOROOT/pkg
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
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
194 for tool in $tools; do
195 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
199 rm -rf $RPM_BUILD_ROOT
202 %defattr(644,root,root,755)
203 %doc AUTHORS CONTRIBUTORS LICENSE
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
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
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
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/*
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}/*
242 %{_libdir}/%{name}/pkg/bootstrap
243 %{_libdir}/%{name}/pkg/include
246 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_dynlink
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
275 %defattr(644,root,root,755)