]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
split source to -source package (why package it anyway?)
[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:       %{name} = %{version}-%{release}
97 Requires:       vim-rt >= 4:7.2.170
98 %if "%{_rpmversion}" >= "5"
99 BuildArch:      noarch
100 %endif
101
102 %description -n vim-syntax-%{name}
103 Go syntax files for vim.
104
105 %description -n vim-syntax-%{name} -l pl.UTF-8
106 Pliki składni Go dla Vima.
107
108 %package -n emacs-%{name}
109 Summary:        Go mode for Emacs
110 Summary(pl.UTF-8):      Tryb Go dla Emacsa
111 Group:          Applications/Editors
112 %if "%{_rpmversion}" >= "5"
113 BuildArch:      noarch
114 %endif
115
116 %description -n emacs-%{name}
117 Go mode for Emacs.
118
119 %description -n emacs-%{name} -l pl.UTF-8
120 Tryb Go dla Emacsa.
121
122 %prep
123 %setup -qc
124 mv go/* .
125 %patch0 -p1
126
127 %{__sed} -i -e 's,/usr/bin/awk,/bin/awk,' src/cmd/gc/bisonerrors
128
129 # broken tests
130 %{__rm} src/pkg/net/multicast_test.go
131
132 cat > env.sh <<'EOF'
133 export GOROOT=$(pwd)
134 export GOROOT_FINAL=%{_libdir}/%{name}
135
136 export GOOS=linux
137 export GOBIN=$GOROOT/bin
138 export GOARCH=%{GOARCH}
139 export GOROOT_FINAL
140 export MAKE="%{__make}"
141 CC="%{__cc}"
142 export CC="${CC#ccache }"
143
144 export PATH="$PATH:$GOBIN"
145 EOF
146
147 install -d bin
148
149 # optflags for go tools build
150 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
151 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
152 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
153
154
155 %build
156 . ./env.sh
157
158 cd src
159 ./all.bash
160
161 %install
162 rm -rf $RPM_BUILD_ROOT
163 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
164
165 install -d $RPM_BUILD_ROOT{%{_bindir},%{_usrsrc}/%{name}-%{version}} \
166         $GOROOT/{misc,lib}
167
168 cp -a pkg include lib bin $GOROOT
169 cp -a src/pkg src/cmd $RPM_BUILD_ROOT%{_usrsrc}/%{name}-%{version}
170 cp -a misc/cgo $GOROOT/misc
171
172 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
173 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
174 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
175
176 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
177 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
178
179 %ifarch %{ix86}
180 tools="8a 8c 8g 8l"
181 %endif
182 %ifarch %{x8664}
183 tools="6a 6c 6g 6l"
184 %endif
185 %ifarch %{arm}
186 tools="5a 5c 5g 5l"
187 %endif
188 for tool in $tools; do
189         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
190 done
191
192 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
193 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
194
195 VIMFILES="syntax/go.vim ftdetect/gofiletype.vim ftplugin/go/fmt.vim ftplugin/go/import.vim indent/go.vim"
196 for i in $VIMFILES; do
197         install -Dp misc/vim/$i $RPM_BUILD_ROOT%{_vimdatadir}/$i
198 done
199
200 %clean
201 rm -rf $RPM_BUILD_ROOT
202
203 %files
204 %defattr(644,root,root,755)
205 %doc AUTHORS CONTRIBUTORS LICENSE README
206 %ifarch %{arm}
207 %attr(755,root,root) %{_bindir}/5a
208 %attr(755,root,root) %{_bindir}/5c
209 %attr(755,root,root) %{_bindir}/5g
210 %attr(755,root,root) %{_bindir}/5l
211 %endif
212 %ifarch %{x8664}
213 %attr(755,root,root) %{_bindir}/6a
214 %attr(755,root,root) %{_bindir}/6c
215 %attr(755,root,root) %{_bindir}/6g
216 %attr(755,root,root) %{_bindir}/6l
217 %endif
218 %ifarch %{ix86}
219 %attr(755,root,root) %{_bindir}/8a
220 %attr(755,root,root) %{_bindir}/8c
221 %attr(755,root,root) %{_bindir}/8g
222 %attr(755,root,root) %{_bindir}/8l
223 %endif
224 %attr(755,root,root) %{_bindir}/cgo
225 %attr(755,root,root) %{_bindir}/ebnflint
226 %attr(755,root,root) %{_bindir}/go
227 %attr(755,root,root) %{_bindir}/godoc
228 %attr(755,root,root) %{_bindir}/gofmt
229 %dir %{_libdir}/%{name}
230 %dir %{_libdir}/%{name}/bin
231 %attr(755,root,root) %{_libdir}/%{name}/bin/*
232
233 %{_libdir}/%{name}/include
234 %{_libdir}/%{name}/lib
235 %{_libdir}/%{name}/misc
236 %dir %{_libdir}/%{name}/pkg
237 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
238 %{_libdir}/%{name}/pkg/obj
239 %dir %{_libdir}/%{name}/pkg/tool
240 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
241 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
242
243 %ifarch %{x8664}
244 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
245 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
246 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
247 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
248 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
249 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
250 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
251 %endif
252
253 %files source
254 %defattr(644,root,root,755)
255 %{_usrsrc}/%{name}-%{version}
256
257 %files doc
258 %defattr(644,root,root,755)
259 %doc doc/*
260
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
267
268 %files -n emacs-%{name}
269 %defattr(644,root,root,755)
270 %{_datadir}/emacs/site-lisp/go-mode*.el
This page took 0.640563 seconds and 4 git commands to generate.