1 # build ids are not currently generated:
2 # https://code.google.com/p/go/issues/detail?id=5238
4 # also, debuginfo extraction currently fails with
5 # "Failed to write file: invalid section alignment"
6 %global debug_package %{nil}
8 # we are shipping the full contents of src in the data subpackage, which
9 # contains binary-like things (ELF data for tests, etc)
10 %global _binaries_in_noarch_packages_terminate_build 0
12 # Do not check any files in doc or src for requires
13 %global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$
15 # Don't alter timestamps of especially the .a files (or else go will rebuild later)
16 # Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
17 %global __strip /bin/true
19 # rpmbuild magic to keep from having meta dependency on libc.so.6
20 # %define _use_internal_dependency_generator 0
21 # %define __find_requires %{nil}
22 # %global __spec_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot \
23 # /usr/lib/rpm/brp-compress
25 %global golibdir %{_libdir}/golang
27 # Golang build options.
29 # Build golang using external/internal(close to cgo disabled) linking.
30 %ifarch %{ix86} x86_64 ppc64le %{arm} aarch64 s390x
31 %global external_linker 1
33 %global external_linker 0
36 # Build golang with cgo enabled/disabled(later equals more or less to internal linking).
37 %ifarch %{ix86} x86_64 ppc64le %{arm} aarch64 s390x
43 #%global golang_bootstrap 1
45 # Controls what ever we fail on failed tests
47 %global fail_on_tests 0
49 %global fail_on_tests 1
54 # Pre build std lib with -race enabled
61 %global goroot /usr/lib/%{name}
62 %global gopath %{_datadir}/gocode
63 %global go_arches %{ix86} x86_64 %{arm} aarch64 ppc64le
64 %global golibdir %{_libdir}/golang
67 %global gohostarch amd64
70 %global gohostarch 386
73 %global gohostarch arm
76 %global gohostarch arm64
79 %global gohostarch ppc64
82 %global gohostarch ppc64le
85 %global gohostarch s390x
89 %global go_version 1.21.4
94 Summary: The Go Programming Language
96 URL: http://golang.org/
97 Source0: https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz
99 Provides: go = %{version}-%{release}
100 Provides: go-srpm-macros
102 Provides: bundled(golang(golang.org/x/crypto/chacha20poly1305))
103 Provides: bundled(golang(golang.org/x/crypto/cryptobyte))
104 Provides: bundled(golang(golang.org/x/crypto/cryptobyte/asn1))
105 Provides: bundled(golang(golang.org/x/crypto/curve25519))
106 Provides: bundled(golang(golang.org/x/crypto/internal/chacha20))
107 Provides: bundled(golang(golang.org/x/crypto/poly1305))
108 Provides: bundled(golang(golang.org/x/net/dns/dnsmessage))
109 Provides: bundled(golang(golang.org/x/net/http/httpguts))
110 Provides: bundled(golang(golang.org/x/net/http/httpproxy))
111 Provides: bundled(golang(golang.org/x/net/http2/hpack))
112 Provides: bundled(golang(golang.org/x/net/idna))
113 Provides: bundled(golang(golang.org/x/net/internal/nettest))
114 Provides: bundled(golang(golang.org/x/net/nettest))
115 Provides: bundled(golang(golang.org/x/text/secure))
116 Provides: bundled(golang(golang.org/x/text/secure/bidirule))
117 Provides: bundled(golang(golang.org/x/text/transform))
118 Provides: bundled(golang(golang.org/x/text/unicode))
119 Provides: bundled(golang(golang.org/x/text/unicode/bidi))
120 Provides: bundled(golang(golang.org/x/text/unicode/norm))
121 Provides: bundled(golang(github.com/google/pprof/driver))
122 Provides: bundled(golang(github.com/google/pprof/internal/binutils))
123 Provides: bundled(golang(github.com/google/pprof/internal/driver))
124 Provides: bundled(golang(github.com/google/pprof/internal/elfexec))
125 Provides: bundled(golang(github.com/google/pprof/internal/graph))
126 Provides: bundled(golang(github.com/google/pprof/internal/measurement))
127 Provides: bundled(golang(github.com/google/pprof/internal/plugin))
128 Provides: bundled(golang(github.com/google/pprof/internal/proftest))
129 Provides: bundled(golang(github.com/google/pprof/internal/report))
130 Provides: bundled(golang(github.com/google/pprof/internal/symbolizer))
131 Provides: bundled(golang(github.com/google/pprof/internal/symbolz))
132 Provides: bundled(golang(github.com/google/pprof/profile))
133 Provides: bundled(golang(github.com/google/pprof/third.party/d3))
134 Provides: bundled(golang(github.com/google/pprof/third.party/d3flamegraph))
135 Provides: bundled(golang(github.com/google/pprof/third.party/svgpan))
136 Provides: bundled(golang(github.com/ianlancetaylor/demangle))
137 Provides: bundled(golang(golang.org/x/arch/arm/armasm))
138 Provides: bundled(golang(golang.org/x/arch/arm64/arm64asm))
139 Provides: bundled(golang(golang.org/x/arch/ppc64/ppc64asm))
140 Provides: bundled(golang(golang.org/x/arch/x86/x86asm))
141 Provides: bundled(golang(golang.org/x/crypto/ssh/terminal))
142 Provides: bundled(golang(golang.org/x/sys/unix))
143 Provides: bundled(golang(golang.org/x/sys/windows))
144 Provides: bundled(golang(golang.org/x/sys/windows/registry))
146 Requires: %{name}-bin = %{version}-%{release}
147 Requires: %{name}-src = %{version}-%{release}
148 Requires: go-srpm-macros
150 # Having documentation separate was broken
151 Obsoletes: %{name}-docs < 1.1-4
153 # RPM can't handle symlink -> dir with subpackages, so merge back
154 Obsoletes: %{name}-data < 1.1.1-4
156 # go1.4 deprecates a few packages
157 Obsoletes: %{name}-vim < 1.4
158 Obsoletes: emacs-%{name} < 1.4
160 # These are the only RHEL/Fedora architectures that we compile this package for
161 ExclusiveArch: %{go_arches}
163 Source10: go%{version}.linux-386.tar.gz
164 Source11: go%{version}.linux-amd64.tar.gz
165 Source12: go%{version}.linux-armv6l.tar.gz
166 Source13: go%{version}.linux-arm64.tar.gz
168 Source102: macros.golang
174 Summary: Golang compiler docs
175 Requires: %{name} = %{version}-%{release}
177 Obsoletes: %{name}-docs < 1.1-4
183 Summary: Golang compiler miscellaneous sources
184 Requires: %{name} = %{version}-%{release}
191 Summary: Golang compiler tests for stdlib
192 Requires: %{name} = %{version}-%{release}
199 Summary: Golang compiler source tree
205 Summary: Golang core compiler tools
206 Requires: go = %{version}-%{release}
213 Summary: Golang shared object libraries
221 Summary: Golang std library with -race enabled
223 Requires: %{name} = %{version}-%{release}
233 gzip -dc %{SOURCE10} | tar -xvf -
237 gzip -dc %{SOURCE11} | tar -xvf -
241 gzip -dc %{SOURCE12} | tar -xvf -
245 gzip -dc %{SOURCE13} | tar -xvf -
255 rm -rf $RPM_BUILD_ROOT
256 # remove GC build cache
257 rm -rf pkg/obj/go-build/*
259 # create the top level directories
260 mkdir -p $RPM_BUILD_ROOT%{_bindir}
261 mkdir -p $RPM_BUILD_ROOT%{goroot}
263 # install everything into libdir (until symlink problems are fixed)
264 # https://code.google.com/p/go/issues/detail?id=5830
265 cp -ap api bin codereview.cfg doc lib misc pkg src test VERSION \
266 $RPM_BUILD_ROOT%{goroot}
269 find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \;
270 # and level out all the built archives
271 touch $RPM_BUILD_ROOT%{goroot}/pkg
272 find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \;
274 export GOROOT=$RPM_BUILD_ROOT%{goroot}
275 GODEBUG=installgoroot=all $GOROOT/bin/go install std
277 # generate the spec file ownership of this source tree and packages
279 src_list=$cwd/go-src.list
280 pkg_list=$cwd/go-pkg.list
281 shared_list=$cwd/go-shared.list
282 race_list=$cwd/go-race.list
283 misc_list=$cwd/go-misc.list
284 docs_list=$cwd/go-docs.list
285 tests_list=$cwd/go-tests.list
286 rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
287 touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list $race_list
288 pushd $RPM_BUILD_ROOT%{goroot}
289 find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list
290 find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $src_list
292 find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
293 find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -a ! -path '*_race/*' -printf '%{goroot}/%p\n' >> $pkg_list
295 find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
296 find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
298 find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
299 find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
302 mkdir -p %{buildroot}/%{_libdir}/
303 mkdir -p %{buildroot}/%{golibdir}/
304 for file in $(find . -iname "*.so" ); do
306 mv $file %{buildroot}/%{golibdir}
307 pushd $(dirname $file)
308 ln -fs %{golibdir}/$(basename $file) $(basename $file)
310 echo "%%{goroot}/$file" >> $shared_list
311 echo "%%{golibdir}/$(basename $file)" >> $shared_list
314 find pkg/*_dynlink/ -type d -printf '%%%dir %{goroot}/%p\n' >> $shared_list
315 find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
320 find pkg/*_race/ -type d -printf '%%%dir %{goroot}/%p\n' >> $race_list
321 find pkg/*_race/ ! -type d -printf '%{goroot}/%p\n' >> $race_list
325 find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
326 find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
327 find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
328 find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test.go' \) -printf '%{goroot}/%p\n' >> $tests_list
329 # this is only the zoneinfo.zip
330 find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
331 find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
334 # remove the doc Makefile
335 rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile
337 # put binaries to bindir, linked to the arch we're building,
338 # leave the arch independent pieces in {goroot}
339 mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}
340 ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go
341 ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt
343 # ensure these exist and are owned
344 mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com
345 mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org
346 mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p
347 mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x
349 rm -f $RPM_BUILD_ROOT%{_bindir}/go
350 ln -sf /usr/lib/golang/bin/go $RPM_BUILD_ROOT%{_bindir}/go
351 rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt
352 ln -sf /usr/lib/golang/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
355 mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm
356 cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang
359 #export GOROOT=$(pwd -P)
360 #export PATH="$GOROOT"/bin:"$PATH"
363 #%if !%{external_linker}
364 #export GO_LDFLAGS="-linkmode internal"
367 #%if !%{cgo_enabled} || !%{external_linker}
368 #export CGO_ENABLED=0
371 # make sure to not timeout
372 #export GO_TEST_TIMEOUT_SCALE=2
374 #%if %{fail_on_tests}
375 #./run.bash --no-rebuild -v -v -v -k
377 #./run.bash --no-rebuild -v -v -v -k || :
384 # VERSION has to be present in the GOROOT, for `go install std` to work
385 %doc %{goroot}/VERSION
391 %exclude %{goroot}/bin/
392 %exclude %{goroot}/pkg/
393 %exclude %{goroot}/src/
394 %exclude %{goroot}/doc/
395 %exclude %{goroot}/misc/
396 %exclude %{goroot}/test/
399 # ensure directory ownership, so they are cleaned up if empty
402 %dir %{gopath}/src/github.com/
403 %dir %{gopath}/src/bitbucket.org/
404 %dir %{gopath}/src/code.google.com/
405 %dir %{gopath}/src/code.google.com/p/
406 %dir %{gopath}/src/golang.org
407 %dir %{gopath}/src/golang.org/x
409 %{_sysconfdir}/rpm/macros.golang
411 %files -f go-src.list src
413 %files -f go-docs.list docs
415 %files -f go-misc.list misc
417 %files -f go-tests.list tests
419 %files -f go-pkg.list bin
424 %files -f go-shared.list shared
428 %files -f go-race.list race