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

Revision 9887, 15.7 KB checked in by tomop, 8 years ago (diff)

golang-1.5.2-1

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