]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
24e69ca7c39c089832e0b23e634e7a767018acca
[packages/golang.git] / golang.spec
1 # TODO
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
8 # Conditional build:
9 %bcond_without  tests   # build without tests
10 %bcond_without  verbose # verbose build (V=1)
11
12 Summary:        Go compiler and tools
13 Summary(pl.UTF-8):      Kompilator języka Go i narzędzia
14 Name:           golang
15 Version:        1.1.2
16 Release:        1
17 License:        BSD
18 Group:          Development/Languages
19 #Source0Download: https://code.google.com/p/go/downloads/list
20 Source0:        https://go.googlecode.com/files/go%{version}.src.tar.gz
21 # Source0-md5:  705feb2246c8ddaf820d7e171f1430c5
22 Patch0:         ca-certs.patch
23 URL:            http://golang.org/
24 BuildRequires:  bash
25 BuildRequires:  rpm-pythonprov
26 %if %{with tests}
27 BuildRequires:  hostname
28 BuildRequires:  tzdata
29 %endif
30 Requires:       ca-certificates
31 ExclusiveArch:  %{ix86} %{x8664} %{arm}
32 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
33
34 %define _enable_debug_packages 0
35 %define no_install_post_strip 1
36 %define no_install_post_chrpath 1
37 %define _noautoreqfiles %{_libdir}/%{name}/src
38
39 %define         _vimdatadir     %{_datadir}/vim
40
41 %ifarch %{ix86}
42 %define GOARCH 386
43 %endif
44 %ifarch %{x8664}
45 %define GOARCH amd64
46 %endif
47
48 %description
49 Go is an open source programming environment that makes it easy to
50 build simple, reliable, and efficient software.
51
52 %description -l pl.UTF-8
53 Go to mające otwarte źródła środowisko do programowania, pozwalające
54 na łatwe tworzenie prostych, pewnych i wydajnych programów.
55
56 %package source
57 Summary:        Source code of go
58 Summary(pl.UTF-8):      Kod źródłowy go
59 Group:          Documentation
60 %if "%{_rpmversion}" >= "5"
61 BuildArch:      noarch
62 %endif
63
64 %description source
65 Source code of go.
66
67 %description source -l pl.UTF-8
68 Kod źródłowy go.
69
70 %package doc
71 Summary:        Manual for go
72 Summary(fr.UTF-8):      Documentation pour go
73 Summary(it.UTF-8):      Documentazione di go
74 Summary(pl.UTF-8):      Podręcznik dla go
75 Group:          Documentation
76 %if "%{_rpmversion}" >= "5"
77 BuildArch:      noarch
78 %endif
79
80 %description doc
81 Documentation for go.
82
83 %description doc -l fr.UTF-8
84 Documentation pour go.
85
86 %description doc -l it.UTF-8
87 Documentazione di go.
88
89 %description doc -l pl.UTF-8
90 Dokumentacja do go.
91
92 %package -n vim-syntax-%{name}
93 Summary:        Go syntax files for Vim
94 Summary(pl.UTF-8):      Pliki składni Go dla Vima
95 Group:          Applications/Editors
96 Requires:       vim-rt >= 4:7.2.170
97 %if "%{_rpmversion}" >= "5"
98 BuildArch:      noarch
99 %endif
100
101 %description -n vim-syntax-%{name}
102 Go syntax files for vim.
103
104 %description -n vim-syntax-%{name} -l pl.UTF-8
105 Pliki składni Go dla Vima.
106
107 %package -n emacs-%{name}
108 Summary:        Go mode for Emacs
109 Summary(pl.UTF-8):      Tryb Go dla Emacsa
110 Group:          Applications/Editors
111 %if "%{_rpmversion}" >= "5"
112 BuildArch:      noarch
113 %endif
114
115 %description -n emacs-%{name}
116 Go mode for Emacs.
117
118 %description -n emacs-%{name} -l pl.UTF-8
119 Tryb Go dla Emacsa.
120
121 %prep
122 %setup -qc
123 mv go/* .
124 %patch0 -p1
125
126 %{__sed} -i -e 's,/usr/bin/awk,/bin/awk,' src/cmd/gc/bisonerrors
127
128 # broken tests
129 %{__rm} src/pkg/net/multicast_test.go
130
131 cat > env.sh <<'EOF'
132 export GOROOT=$(pwd)
133 export GOROOT_FINAL=%{_libdir}/%{name}
134
135 export GOOS=linux
136 export GOBIN=$GOROOT/bin
137 export GOARCH=%{GOARCH}
138 export GOROOT_FINAL
139 export MAKE="%{__make}"
140 CC="%{__cc}"
141 export CC="${CC#ccache }"
142
143 export PATH="$PATH:$GOBIN"
144 EOF
145
146 install -d bin
147
148 # optflags for go tools build
149 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
150 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
151 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
152
153
154 %build
155 . ./env.sh
156
157 cd src
158 ./all.bash
159
160 %install
161 rm -rf $RPM_BUILD_ROOT
162 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
163
164 install -d $RPM_BUILD_ROOT{%{_bindir},%{_usrsrc}/%{name}-%{version}} \
165         $GOROOT/{misc,lib}
166
167 cp -a pkg include lib bin $GOROOT
168 cp -a src/pkg src/cmd $RPM_BUILD_ROOT%{_usrsrc}/%{name}-%{version}
169 cp -a misc/cgo $GOROOT/misc
170
171 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
172 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
173 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
174
175 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
176 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
177
178 %ifarch %{ix86}
179 tools="8a 8c 8g 8l"
180 %endif
181 %ifarch %{x8664}
182 tools="6a 6c 6g 6l"
183 %endif
184 %ifarch %{arm}
185 tools="5a 5c 5g 5l"
186 %endif
187 for tool in $tools; do
188         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
189 done
190
191 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
192 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
193
194 VIMFILES="syntax/go.vim ftdetect/gofiletype.vim ftplugin/go/fmt.vim ftplugin/go/import.vim indent/go.vim"
195 for i in $VIMFILES; do
196         install -Dp misc/vim/$i $RPM_BUILD_ROOT%{_vimdatadir}/$i
197 done
198
199 %clean
200 rm -rf $RPM_BUILD_ROOT
201
202 %files
203 %defattr(644,root,root,755)
204 %doc AUTHORS CONTRIBUTORS LICENSE README
205 %ifarch %{arm}
206 %attr(755,root,root) %{_bindir}/5a
207 %attr(755,root,root) %{_bindir}/5c
208 %attr(755,root,root) %{_bindir}/5g
209 %attr(755,root,root) %{_bindir}/5l
210 %endif
211 %ifarch %{x8664}
212 %attr(755,root,root) %{_bindir}/6a
213 %attr(755,root,root) %{_bindir}/6c
214 %attr(755,root,root) %{_bindir}/6g
215 %attr(755,root,root) %{_bindir}/6l
216 %endif
217 %ifarch %{ix86}
218 %attr(755,root,root) %{_bindir}/8a
219 %attr(755,root,root) %{_bindir}/8c
220 %attr(755,root,root) %{_bindir}/8g
221 %attr(755,root,root) %{_bindir}/8l
222 %endif
223 %attr(755,root,root) %{_bindir}/cgo
224 %attr(755,root,root) %{_bindir}/ebnflint
225 %attr(755,root,root) %{_bindir}/go
226 %attr(755,root,root) %{_bindir}/godoc
227 %attr(755,root,root) %{_bindir}/gofmt
228 %dir %{_libdir}/%{name}
229 %dir %{_libdir}/%{name}/bin
230 %attr(755,root,root) %{_libdir}/%{name}/bin/*
231
232 %{_libdir}/%{name}/include
233 %{_libdir}/%{name}/lib
234 %{_libdir}/%{name}/misc
235 %dir %{_libdir}/%{name}/pkg
236 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
237 %{_libdir}/%{name}/pkg/obj
238 %dir %{_libdir}/%{name}/pkg/tool
239 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
240 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
241
242 %ifarch %{x8664}
243 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
244 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
245 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
246 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
247 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
248 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
249 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
250 %endif
251
252 %files source
253 %defattr(644,root,root,755)
254 %{_usrsrc}/%{name}-%{version}
255
256 %files doc
257 %defattr(644,root,root,755)
258 %doc doc/*
259
260 %files -n vim-syntax-%{name}
261 %defattr(644,root,root,755)
262 %{_vimdatadir}/ftdetect/gofiletype.vim
263 %{_vimdatadir}/ftplugin/go
264 %{_vimdatadir}/indent/go.vim
265 %{_vimdatadir}/syntax/go.vim
266
267 %files -n emacs-%{name}
268 %defattr(644,root,root,755)
269 %{_datadir}/emacs/site-lisp/go-mode*.el
This page took 0.077716 seconds and 2 git commands to generate.