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

Revision 11104, 15.1 KB checked in by iwaim, 7 years ago (diff)

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