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
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: 907f85c8fa765d31f7f955836fec4049
26 Patch0: ca-certs.patch
27 URL: http://golang.org/
29 BuildRequires: rpm-pythonprov
31 BuildRequires: hostname
34 Requires: ca-certificates
35 ExclusiveArch: %{ix86} %{x8664} %{arm}
36 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38 %define no_install_post_strip 1
39 %define no_install_post_chrpath 1
40 %define _enable_debug_packages 0
41 %define _noautoreqfiles %{_libdir}/%{name}/src
50 %define _vimdatadir %{_datadir}/vim
53 Go is an open source programming environment that makes it easy to
54 build simple, reliable, and efficient software.
56 %description -l pl.UTF-8
57 Go to mające otwarte źródła środowisko do programowania, pozwalające
58 na łatwe tworzenie prostych, pewnych i wydajnych programów.
61 Summary: Manual for go
62 Summary(fr.UTF-8): Documentation pour go
63 Summary(it.UTF-8): Documentazione di go
64 Summary(pl.UTF-8): Podręcznik dla go
66 %if "%{_rpmversion}" >= "5"
73 %description doc -l fr.UTF-8
74 Documentation pour go.
76 %description doc -l it.UTF-8
79 %description doc -l pl.UTF-8
82 %package -n vim-syntax-%{name}
83 Summary: Go syntax files for Vim
84 Summary(pl.UTF-8): Pliki składni Go dla Vima
85 Group: Applications/Editors
86 Requires: vim-rt >= 4:7.2.170
87 %if "%{_rpmversion}" >= "5"
91 %description -n vim-syntax-%{name}
92 Go syntax files for vim.
94 %description -n vim-syntax-%{name} -l pl.UTF-8
95 Pliki składni Go dla Vima.
97 %package -n emacs-%{name}
98 Summary: Go mode for Emacs
99 Summary(pl.UTF-8): Tryb Go dla Emacsa
100 Group: Applications/Editors
101 %if "%{_rpmversion}" >= "5"
105 %description -n emacs-%{name}
108 %description -n emacs-%{name} -l pl.UTF-8
118 export GOROOT_FINAL=%{_libdir}/%{name}
121 export GOBIN=$GOROOT/bin
122 export GOARCH=%{GOARCH}
124 export MAKE="%{__make}"
126 export CC="${CC#ccache }"
128 export PATH="$PATH:$GOBIN"
133 # optflags for go tools build
134 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[ ]*//;s/[ ]*$//;s/[ ]\+/ /g' -e 's/ /\",\"/g')\""
135 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
136 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
145 rm -rf $RPM_BUILD_ROOT
146 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
148 install -d $GOROOT/{misc,lib,src}
149 install -d $RPM_BUILD_ROOT%{_bindir}
151 cp -a pkg include lib bin src $GOROOT
152 cp -a misc/cgo $GOROOT/misc
153 # kill Win32 and Plan9 scripts
154 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
156 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
157 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
158 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
160 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
161 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
172 for tool in $tools; do
173 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
177 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
178 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
182 VIMFILES="syntax/go.vim ftdetect/gofiletype.vim ftplugin/go/fmt.vim ftplugin/go/import.vim indent/go.vim"
183 for i in $VIMFILES; do
184 install -Dp misc/vim/$i $RPM_BUILD_ROOT%{_vimdatadir}/$i
189 rm -rf $RPM_BUILD_ROOT
192 %defattr(644,root,root,755)
193 %doc AUTHORS CONTRIBUTORS LICENSE README
195 %attr(755,root,root) %{_bindir}/5a
196 %attr(755,root,root) %{_bindir}/5c
197 %attr(755,root,root) %{_bindir}/5g
198 %attr(755,root,root) %{_bindir}/5l
201 %attr(755,root,root) %{_bindir}/6a
202 %attr(755,root,root) %{_bindir}/6c
203 %attr(755,root,root) %{_bindir}/6g
204 %attr(755,root,root) %{_bindir}/6l
207 %attr(755,root,root) %{_bindir}/8a
208 %attr(755,root,root) %{_bindir}/8c
209 %attr(755,root,root) %{_bindir}/8g
210 %attr(755,root,root) %{_bindir}/8l
212 %attr(755,root,root) %{_bindir}/cgo
213 %attr(755,root,root) %{_bindir}/ebnflint
214 %attr(755,root,root) %{_bindir}/go
215 %attr(755,root,root) %{_bindir}/godoc
216 %attr(755,root,root) %{_bindir}/gofmt
217 %dir %{_libdir}/%{name}
218 %dir %{_libdir}/%{name}/bin
219 %attr(755,root,root) %{_libdir}/%{name}/bin/*
221 %{_libdir}/%{name}/include
222 %{_libdir}/%{name}/lib
223 %{_libdir}/%{name}/misc
224 %{_libdir}/%{name}/src
225 %dir %{_libdir}/%{name}/pkg
226 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
227 %{_libdir}/%{name}/pkg/obj
228 %dir %{_libdir}/%{name}/pkg/tool
229 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
230 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
233 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
234 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
235 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/compress
236 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/container
237 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/crypto
238 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/debug
239 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/encoding
240 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/go
241 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/hash
242 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/internal
243 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/io
244 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/math
245 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/mime
246 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/net
247 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/os
248 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/path
249 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
250 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
251 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
252 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
253 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
257 %defattr(644,root,root,755)
261 %files -n vim-syntax-%{name}
262 %defattr(644,root,root,755)
263 %{_vimdatadir}/ftdetect/gofiletype.vim
264 %{_vimdatadir}/ftplugin/go
265 %{_vimdatadir}/indent/go.vim
266 %{_vimdatadir}/syntax/go.vim
270 %files -n emacs-%{name}
271 %defattr(644,root,root,755)
272 %{_datadir}/emacs/site-lisp/go-mode*.el