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?
11 %bcond_without tests # build without tests [nop actually]
12 %bcond_without verbose # verbose build (V=1)
13 %bcond_with emacs # Go mode for Emacs
14 %bcond_with vim # Go syntax files for Vim
16 Summary: Go compiler and tools
17 Summary(pl.UTF-8): Kompilator języka Go i narzędzia
22 Group: Development/Languages
23 # Source0Download: https://golang.org/dl/
24 Source0: https://storage.googleapis.com/golang/go%{version}.src.tar.gz
25 # Source0-md5: dfb604511115dd402a77a553a5923a04
26 Patch0: ca-certs.patch
27 Patch1: %{name}-binutils.patch
28 URL: http://golang.org/
30 BuildRequires: rpm-pythonprov
32 BuildRequires: hostname
35 Requires: ca-certificates
37 ExclusiveArch: %{ix86} %{x8664} %{arm}
38 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
40 %define no_install_post_strip 1
41 %define no_install_post_chrpath 1
42 %define _enable_debug_packages 0
43 %define _noautoreqfiles %{_libdir}/%{name}/src
52 %define _vimdatadir %{_datadir}/vim
55 Go is an open source programming environment that makes it easy to
56 build simple, reliable, and efficient software.
58 %description -l pl.UTF-8
59 Go to mające otwarte źródła środowisko do programowania, pozwalające
60 na łatwe tworzenie prostych, pewnych i wydajnych programów.
63 Summary: Manual for go
64 Summary(fr.UTF-8): Documentation pour go
65 Summary(it.UTF-8): Documentazione di go
66 Summary(pl.UTF-8): Podręcznik dla go
68 %if "%{_rpmversion}" >= "5"
75 %description doc -l fr.UTF-8
76 Documentation pour go.
78 %description doc -l it.UTF-8
81 %description doc -l pl.UTF-8
84 %package -n vim-syntax-%{name}
85 Summary: Go syntax files for Vim
86 Summary(pl.UTF-8): Pliki składni Go dla Vima
87 Group: Applications/Editors
88 Requires: vim-rt >= 4:7.2.170
89 %if "%{_rpmversion}" >= "5"
93 %description -n vim-syntax-%{name}
94 Go syntax files for vim.
96 %description -n vim-syntax-%{name} -l pl.UTF-8
97 Pliki składni Go dla Vima.
99 %package -n emacs-%{name}
100 Summary: Go mode for Emacs
101 Summary(pl.UTF-8): Tryb Go dla Emacsa
102 Group: Applications/Editors
103 %if "%{_rpmversion}" >= "5"
107 %description -n emacs-%{name}
110 %description -n emacs-%{name} -l pl.UTF-8
121 export GOROOT_FINAL=%{_libdir}/%{name}
124 export GOBIN=$GOROOT/bin
125 export GOARCH=%{GOARCH}
127 export MAKE="%{__make}"
129 export CC="${CC#ccache }"
131 export PATH="$PATH:$GOBIN"
136 # optflags for go tools build
137 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[ ]*//;s/[ ]*$//;s/[ ]\+/ /g' -e 's/ /\",\"/g')\""
138 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
139 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
148 rm -rf $RPM_BUILD_ROOT
149 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
151 install -d $GOROOT/{misc,lib,src}
152 install -d $RPM_BUILD_ROOT%{_bindir}
154 cp -a pkg include lib bin src $GOROOT
155 cp -a misc/cgo $GOROOT/misc
156 # kill Win32 and Plan9 scripts
157 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
159 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
160 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
161 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
163 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
164 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
175 for tool in $tools; do
176 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
180 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
181 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
185 VIMFILES="syntax/go.vim ftdetect/gofiletype.vim ftplugin/go/fmt.vim ftplugin/go/import.vim indent/go.vim"
186 for i in $VIMFILES; do
187 install -Dp misc/vim/$i $RPM_BUILD_ROOT%{_vimdatadir}/$i
192 rm -rf $RPM_BUILD_ROOT
195 %defattr(644,root,root,755)
196 %doc AUTHORS CONTRIBUTORS LICENSE README
198 %attr(755,root,root) %{_bindir}/5a
199 %attr(755,root,root) %{_bindir}/5c
200 %attr(755,root,root) %{_bindir}/5g
201 %attr(755,root,root) %{_bindir}/5l
204 %attr(755,root,root) %{_bindir}/6a
205 %attr(755,root,root) %{_bindir}/6c
206 %attr(755,root,root) %{_bindir}/6g
207 %attr(755,root,root) %{_bindir}/6l
210 %attr(755,root,root) %{_bindir}/8a
211 %attr(755,root,root) %{_bindir}/8c
212 %attr(755,root,root) %{_bindir}/8g
213 %attr(755,root,root) %{_bindir}/8l
215 %attr(755,root,root) %{_bindir}/cgo
216 %attr(755,root,root) %{_bindir}/ebnflint
217 %attr(755,root,root) %{_bindir}/go
218 %attr(755,root,root) %{_bindir}/godoc
219 %attr(755,root,root) %{_bindir}/gofmt
220 %dir %{_libdir}/%{name}
221 %dir %{_libdir}/%{name}/bin
222 %attr(755,root,root) %{_libdir}/%{name}/bin/*
224 %{_libdir}/%{name}/include
225 %{_libdir}/%{name}/lib
226 %{_libdir}/%{name}/misc
227 %{_libdir}/%{name}/src
228 %dir %{_libdir}/%{name}/pkg
229 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
230 %{_libdir}/%{name}/pkg/obj
231 %dir %{_libdir}/%{name}/pkg/tool
232 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
233 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
236 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
237 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
238 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/compress
239 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/container
240 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/crypto
241 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/debug
242 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/encoding
243 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/go
244 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/hash
245 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/internal
246 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/io
247 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/math
248 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/mime
249 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/net
250 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/os
251 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/path
252 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
253 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
254 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
255 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
256 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
260 %defattr(644,root,root,755)
264 %files -n vim-syntax-%{name}
265 %defattr(644,root,root,755)
266 %{_vimdatadir}/ftdetect/gofiletype.vim
267 %{_vimdatadir}/ftplugin/go
268 %{_vimdatadir}/indent/go.vim
269 %{_vimdatadir}/syntax/go.vim
273 %files -n emacs-%{name}
274 %defattr(644,root,root,755)
275 %{_datadir}/emacs/site-lisp/go-mode*.el