source: projects/specs/trunk/g/golang/golang-vl.spec @ 12045

Revision 12045, 15.1 KB checked in by iwaim, 5 years ago (diff)

golang 1.10.3-1

Line 
1# temporalily ignore test failures
2%ifarch %{ix86} x86_64
3%bcond_without ignore_tests
4%else
5%bcond_with ignore_tests
6%endif
7
8# Define arches for PA and SA
9%global golang_arches   %{ix86} x86_64
10%global go_arches       %{golang_arches}
11
12# Where to set GOPATH for builds
13%global gopath          %{_datadir}/gocode
14
15# build ids are not currently generated:
16# https://code.google.com/p/go/issues/detail?id=5238
17#
18# also, debuginfo extraction currently fails with
19# "Failed to write file: invalid section alignment"
20%global debug_package %{nil}
21
22# we are shipping the full contents of src in the data subpackage, which
23# contains binary-like things (ELF data for tests, etc)
24%global _binaries_in_noarch_packages_terminate_build 0
25
26# Do not check any files in doc or src for requires
27#global __requires_exclude_from ^(%{_datadir}|/usr/lib)/%{name}/(doc|src)/.*$
28
29# Don't alter timestamps of especially the .a files (or else go will rebuild later)
30# Actually, don't strip at all since we are not even building debug packages and this corrupts the dwarf testdata
31%global __strip /bin/true
32
33# rpmbuild magic to keep from having meta dependency on libc.so.6
34%global __requires_exclude_from ^.*$
35%global __spec_install_post /usr/lib/rpm/check-rpaths \
36  /usr/lib/rpm/check-buildroot \
37  /usr/lib/rpm/brp-compress
38
39# Golang build options.
40
41# Buid golang using external/internal(close to cgo disabled) linking.
42%global external_linker 1
43
44# Build golang with cgo enabled/disabled(later equals more or less to internal linking).
45%global cgo_enabled 1
46
47# Use golang/gcc-go as bootstrap compiler
48%global golang_bootstrap 1
49
50# boostrap(with internal linking) using gcc-go fails due to bug in tests(https://github.com/golang/go/issues/12629)
51# make check not to fail due to it
52
53# Controls what ever we fail on failed tests
54%if %{with ignore_tests}
55%global fail_on_tests 0
56%else
57%global fail_on_tests 1
58%endif
59
60# TODO get more support for shared objects
61# Build golang shared objects for stdlib
62%ifarch x86_64
63%global shared 1
64%else
65%global shared 0
66%endif
67
68# Fedora GOROOT
69%global goroot          /usr/lib/%{name}
70
71%ifarch x86_64
72%global gohostarch  amd64
73%endif
74%ifarch %{ix86}
75%global gohostarch  386
76%endif
77
78%global go_api 1.10
79%global go_version 1.10.3
80
81Name:           golang
82Version:        %{go_version}
83Release:        1%{?_dist_release}
84Summary:        The Go Programming Language
85Summary(ja):    プログラミング言語 Go
86# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
87License:        BSD and Public Domain
88Group:          Development/Languages
89URL:            http://golang.org/
90
91# pre-processed by source.sh to make Mark.Twain-Tom.Sawyer.txt free again
92Source0:        https://storage.googleapis.com/golang/go%{go_version}.src.tar.gz
93
94
95# The compiler is written in Go. Needs go(1.4+) compiler for build.
96BuildRequires:  golang > 1.4
97BuildRequires:  net-tools
98
99# for tests
100BuildRequires:  pcre-devel, glibc-static
101
102Provides:       go = %{version}-%{release}
103Requires:       %{name}-bin
104Requires:       %{name}-src = %{version}-%{release}
105
106# These are the only RHEL/Fedora architectures that we compile this package for
107ExclusiveArch:  %{golang_arches}
108
109Source100:      golang-gdbinit
110Source101:      golang-prelink.conf
111Source102:      macros.golang
112
113%description
114%{summary}.
115
116%package       docs
117Summary:       Golang compiler docs
118Requires:      %{name} = %{version}-%{release}
119#BuildArch:     noarch
120Obsoletes:     %{name}-docs < 1.1-4
121
122%description   docs
123%{summary}.
124
125%package       misc
126Summary:       Golang compiler miscellaneous sources
127Requires:      %{name} = %{version}-%{release}
128#BuildArch:     noarch
129
130%description   misc
131%{summary}.
132
133%package       tests
134Summary:       Golang compiler tests for stdlib
135Requires:      %{name} = %{version}-%{release}
136#BuildArch:     noarch
137
138%description   tests
139%{summary}.
140
141%package        src
142Summary:        Golang compiler source tree
143#BuildArch:      noarch
144%description    src
145%{summary}
146
147%package        bin
148Summary:        Golang core compiler tools
149Requires:       go = %{version}-%{release}
150Requires(post): %{_sbindir}/update-alternatives
151Requires(postun): %{_sbindir}/update-alternatives
152
153# We strip the meta dependency, but go does require glibc.
154# This is an odd issue, still looking for a better fix.
155Requires:       glibc
156Requires:       gcc
157%description    bin
158%{summary}
159
160# Workaround old RPM bug of symlink-replaced-with-dir failure
161%pretrans -p <lua>
162for _,d in pairs({"api", "doc", "include", "lib", "src"}) do
163  path = "%{goroot}/" .. d
164  if posix.stat(path, "type") == "link" then
165    os.remove(path)
166    posix.mkdir(path)
167  end
168end
169
170%if %{shared}
171%package        shared
172Summary:        Golang shared object libraries
173
174%description    shared
175%{summary}.
176%endif
177
178%prep
179%setup -q -n go
180
181%build
182# bootstrap compiler GOROOT
183%if !%{golang_bootstrap}
184export GOROOT_BOOTSTRAP=/
185%else
186export GOROOT_BOOTSTRAP=%{goroot}
187%endif
188
189# set up final install location
190export GOROOT_FINAL=%{goroot}
191
192export GOHOSTOS=linux
193export GOHOSTARCH=%{gohostarch}
194
195pushd src
196# use our gcc options for this build, but store gcc as default for compiler
197export CFLAGS="$RPM_OPT_FLAGS"
198export LDFLAGS="$RPM_LD_FLAGS"
199export CC="gcc"
200export CC_FOR_TARGET="gcc"
201export GOOS=linux
202export GOARCH=%{gohostarch}
203%if !%{external_linker}
204export GO_LDFLAGS="-linkmode internal"
205%endif
206%if !%{cgo_enabled}
207export CGO_ENABLED=0
208%endif
209./make.bash --no-clean
210popd
211
212# build shared std lib
213%if %{shared}
214GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
215%endif
216
217%install
218rm -rf $RPM_BUILD_ROOT
219
220# create the top level directories
221mkdir -p $RPM_BUILD_ROOT%{_bindir}
222mkdir -p $RPM_BUILD_ROOT%{goroot}
223
224# install everything into libdir (until symlink problems are fixed)
225# https://code.google.com/p/go/issues/detail?id=5830
226cp -apv api bin doc favicon.ico lib pkg robots.txt src misc test VERSION \
227   $RPM_BUILD_ROOT%{goroot}
228
229# bz1099206
230find $RPM_BUILD_ROOT%{goroot}/src -exec touch -r $RPM_BUILD_ROOT%{goroot}/VERSION "{}" \;
231# and level out all the built archives
232touch $RPM_BUILD_ROOT%{goroot}/pkg
233find $RPM_BUILD_ROOT%{goroot}/pkg -exec touch -r $RPM_BUILD_ROOT%{goroot}/pkg "{}" \;
234# generate the spec file ownership of this source tree and packages
235cwd=$(pwd)
236src_list=$cwd/go-src.list
237pkg_list=$cwd/go-pkg.list
238shared_list=$cwd/go-shared.list
239misc_list=$cwd/go-misc.list
240docs_list=$cwd/go-docs.list
241tests_list=$cwd/go-tests.list
242rm -f $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
243touch $src_list $pkg_list $docs_list $misc_list $tests_list $shared_list
244pushd $RPM_BUILD_ROOT%{goroot}
245        find src/ -type d -a \( ! -name testdata -a ! -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $src_list
246        find src/ ! -type d -a \( ! -ipath '*/testdata/*' -a ! -name '*_test*.go' \) -printf '%{goroot}/%p\n' >> $src_list
247
248        find bin/ pkg/ -type d -a ! -path '*_dynlink/*' -printf '%%%dir %{goroot}/%p\n' >> $pkg_list
249        find bin/ pkg/ ! -type d -a ! -path '*_dynlink/*' -printf '%{goroot}/%p\n' >> $pkg_list
250
251        find doc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $docs_list
252        find doc/ ! -type d -printf '%{goroot}/%p\n' >> $docs_list
253
254        find misc/ -type d -printf '%%%dir %{goroot}/%p\n' >> $misc_list
255        find misc/ ! -type d -printf '%{goroot}/%p\n' >> $misc_list
256
257%if %{shared}
258        find pkg/*_dynlink/ -type d -printf '%%%dir %{goroot}/%p\n' >> $shared_list
259        find pkg/*_dynlink/ ! -type d -printf '%{goroot}/%p\n' >> $shared_list
260%endif
261
262        find test/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
263        find test/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
264        find src/ -type d -a \( -name testdata -o -ipath '*/testdata/*' \) -printf '%%%dir %{goroot}/%p\n' >> $tests_list
265        find src/ ! -type d -a \( -ipath '*/testdata/*' -o -name '*_test*.go' \)  -printf '%{goroot}/%p\n' >> $tests_list
266        # this is only the zoneinfo.zip
267        find lib/ -type d -printf '%%%dir %{goroot}/%p\n' >> $tests_list
268        find lib/ ! -type d -printf '%{goroot}/%p\n' >> $tests_list
269popd
270
271# remove the doc Makefile
272rm -rfv $RPM_BUILD_ROOT%{goroot}/doc/Makefile
273
274# put binaries to bindir, linked to the arch we're building,
275# leave the arch independent pieces in %{goroot}
276mkdir -p $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}
277ln -sf %{goroot}/bin/go $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/go
278ln -sf %{goroot}/bin/gofmt $RPM_BUILD_ROOT%{goroot}/bin/linux_%{gohostarch}/gofmt
279
280# ensure these exist and are owned
281mkdir -p $RPM_BUILD_ROOT%{gopath}/src/github.com
282mkdir -p $RPM_BUILD_ROOT%{gopath}/src/bitbucket.org
283mkdir -p $RPM_BUILD_ROOT%{gopath}/src/code.google.com/p
284mkdir -p $RPM_BUILD_ROOT%{gopath}/src/golang.org/x
285
286# make sure these files exist and point to alternatives
287rm -f $RPM_BUILD_ROOT%{_bindir}/go
288ln -sf /etc/alternatives/go $RPM_BUILD_ROOT%{_bindir}/go
289rm -f $RPM_BUILD_ROOT%{_bindir}/gofmt
290ln -sf /etc/alternatives/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
291
292# gdbinit
293mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d
294cp -av %{SOURCE100} $RPM_BUILD_ROOT%{_sysconfdir}/gdbinit.d/golang.gdb
295
296# prelink blacklist
297mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d
298cp -av %{SOURCE101} $RPM_BUILD_ROOT%{_sysconfdir}/prelink.conf.d/golang.conf
299
300# rpm macros
301mkdir -p %{buildroot}
302mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/rpm
303cp -av %{SOURCE102} $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.golang
304
305
306%check
307export GOROOT=$(pwd -P)
308export PATH="$GOROOT"/bin:"$PATH"
309cd src
310
311export CC="gcc"
312export CFLAGS="$RPM_OPT_FLAGS"
313export LDFLAGS="$RPM_LD_FLAGS"
314%if !%{external_linker}
315export GO_LDFLAGS="-linkmode internal"
316%endif
317%if !%{cgo_enabled} || !%{external_linker}
318export CGO_ENABLED=0
319%endif
320
321# make sure to not timeout
322export GO_TEST_TIMEOUT_SCALE=2
323
324%if %{fail_on_tests}
325./run.bash --no-rebuild -v -v -v -k
326%else
327./run.bash --no-rebuild -v -v -v -k || :
328%endif
329cd ..
330
331
332%post bin
333%{_sbindir}/update-alternatives --install %{_bindir}/go \
334        go %{goroot}/bin/go 90 \
335        --slave %{_bindir}/gofmt gofmt %{goroot}/bin/gofmt
336
337%preun bin
338if [ $1 = 0 ]; then
339        %{_sbindir}/update-alternatives --remove go %{goroot}/bin/go
340fi
341
342
343%files
344%doc AUTHORS CONTRIBUTORS LICENSE PATENTS
345# VERSION has to be present in the GOROOT, for `go install std` to work
346%doc %{goroot}/VERSION
347%dir %{goroot}/doc
348%doc %{goroot}/doc/*
349
350# go files
351%dir %{goroot}
352%exclude %{goroot}/bin/
353%exclude %{goroot}/pkg/
354%exclude %{goroot}/src/
355%exclude %{goroot}/doc/
356%exclude %{goroot}/misc/
357%{goroot}/*
358
359# ensure directory ownership, so they are cleaned up if empty
360%dir %{gopath}
361%dir %{gopath}/src
362%dir %{gopath}/src/github.com/
363%dir %{gopath}/src/bitbucket.org/
364%dir %{gopath}/src/code.google.com/
365%dir %{gopath}/src/code.google.com/p/
366%dir %{gopath}/src/golang.org
367%dir %{gopath}/src/golang.org/x
368
369
370# gdbinit (for gdb debugging)
371%{_sysconfdir}/gdbinit.d
372
373# prelink blacklist
374%{_sysconfdir}/prelink.conf.d
375
376%{_sysconfdir}/rpm/macros.golang
377
378%files -f go-src.list src
379
380%files -f go-docs.list docs
381
382%files -f go-misc.list misc
383
384%files -f go-tests.list tests
385
386%files -f go-pkg.list bin
387%{_bindir}/go
388%{_bindir}/gofmt
389
390%if %{shared}
391%files -f go-shared.list shared
392%endif
393
394%changelog
395* Tue Jun 26 2018 IWAI, Masaharu <iwaim.sub@gmail.com> 1.10.3-1
396- update to 1.10.3
397- drop patches (Patch0, 212, 215)
398- export 'GO_TEST_TIMEOUT_SCALE=2' in %%check
399- add bcond for tests
400
401* Tue Jun 06 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 1.8.3-1
402- update to 1.8.3
403
404* Mon Jun  5 2017 IWAI, Masaharu <iwaim.sub@gmail.com> 1.8.1-1
405- update to 1.8.1
406- remove BuildArch tags
407- drop Source1
408- drop patches
409 - remove ECC p224 patch (Patch1)
410 - X.509 patch (Patch2): upstream merged
411 - disable TestGdbPython patch (Patch213)
412 - disable TestCloneNEWUSERAndRemapNoRootDisableSetgroups patch (Patch214)
413 - drop Patch216: upstream fixed
414- update bootstrap binary path patch (Patch212)
415
416* Mon Dec 21 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.5.2-1
417- new upstream release.
418
419* Sun Mar  8 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 1.4.2-1
420- new upstream release.
421
422* Mon Dec 15 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.2-2
423- added Group tag
424
425* Sat Feb  1 2014 IWAI, Masaharu <iwaim.sub@gmail.com> 1.2
426- initial build for Vine Linux
427- drop emacs and vim package
428
429* Fri Jan 24 2014 Vincent Batts <vbatts@redhat.com> 1.2-4
430- skip a flaky test that is sporadically failing on the build server
431
432* Thu Jan 16 2014 Vincent Batts <vbatts@redhat.com> 1.2-3
433- remove golang-godoc dependency. cyclic dependency on compiling godoc
434
435* Wed Dec 18 2013 Vincent Batts <vbatts@redhat.com> - 1.2-2
436- removing P224 ECC curve
437
438* Mon Dec 2 2013 Vincent Batts <vbatts@fedoraproject.org> - 1.2-1
439- Update to upstream 1.2 release
440- remove the pax tar patches
441
442* Tue Nov 26 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-8
443- fix the rpmspec conditional for rhel and fedora
444
445* Thu Nov 21 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-7
446- patch tests for testing on rawhide
447- let the same spec work for rhel and fedora
448
449* Wed Nov 20 2013 Vincent Batts <vbatts@redhat.com> - 1.1.2-6
450- don't symlink /usr/bin out to ../lib..., move the file
451- seperate out godoc, to accomodate the go.tools godoc
452
453* Fri Sep 20 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-5
454- Pull upstream patches for BZ#1010271
455- Add glibc requirement that got dropped because of meta dep fix
456
457* Fri Aug 30 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-4
458- fix the libc meta dependency (thanks to vbatts [at] redhat.com for the fix)
459
460* Tue Aug 27 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-3
461- Revert incorrect merged changelog
462
463* Tue Aug 27 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-2
464- This was reverted, just a placeholder changelog entry for bad merge
465
466* Tue Aug 20 2013 Adam Miller <maxamillion@fedoraproject.org> - 1.1.2-1
467- Update to latest upstream
468
469* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1-7
470- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
471
472* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 1.1.1-6
473- Perl 5.18 rebuild
474
475* Wed Jul 10 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-5
476- Blacklist testdata files from prelink
477- Again try to fix #973842
478
479* Fri Jul  5 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-4
480- Move src to libdir for now (#973842) (upstream issue https://code.google.com/p/go/issues/detail?id=5830)
481- Eliminate noarch data package to work around RPM bug (#975909)
482- Try to add runtime-gdb.py to the gdb safe-path (#981356)
483
484* Wed Jun 19 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-3
485- Use lua for pretrans (http://fedoraproject.org/wiki/Packaging:Guidelines#The_.25pretrans_scriptlet)
486
487* Mon Jun 17 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-2
488- Hopefully really fix #973842
489- Fix update from pre-1.1.1 (#974840)
490
491* Thu Jun 13 2013 Adam Goode <adam@spicenitz.org> - 1.1.1-1
492- Update to 1.1.1
493- Fix basically useless package (#973842)
494
495* Sat May 25 2013 Dan Horák <dan[at]danny.cz> - 1.1-3
496- set ExclusiveArch
497
498* Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-2
499- Fix noarch package discrepancies
500
501* Fri May 24 2013 Adam Goode <adam@spicenitz.org> - 1.1-1
502- Initial Fedora release.
503- Update to 1.1
504
505* Thu May  9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.3.rc3
506- Update to rc3
507
508* Thu Apr 11 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.2.beta2
509- Update to beta2
510
511* Tue Apr  9 2013 Adam Goode <adam@spicenitz.org> - 1.1-0.1.beta1
512- Initial packaging.
Note: See TracBrowser for help on using the repository browser.