]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
- up to 1.3.3
[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.3.3
16 Release:        1
17 License:        BSD
18 Group:          Development/Languages
19 #Source0Download: https://code.google.com/p/go/downloads/list
20 Source0:        https://storage.googleapis.com/golang/go%{version}.src.tar.gz
21 # Source0-md5:  2cdbad6baefcf1007f3cf54a5bc878b7
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 no_install_post_strip 1
35 %define no_install_post_chrpath 1
36 %define _enable_debug_packages 0
37 %define _noautoreqfiles %{_libdir}/%{name}/src
38
39 %ifarch %{ix86}
40 %define GOARCH 386
41 %endif
42 %ifarch %{x8664}
43 %define GOARCH amd64
44 %endif
45
46 %define         _vimdatadir     %{_datadir}/vim
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 doc
57 Summary:        Manual for go
58 Summary(fr.UTF-8):      Documentation pour go
59 Summary(it.UTF-8):      Documentazione di go
60 Summary(pl.UTF-8):      Podręcznik dla go
61 Group:          Documentation
62 %if "%{_rpmversion}" >= "5"
63 BuildArch:      noarch
64 %endif
65
66 %description doc
67 Documentation for go.
68
69 %description doc -l fr.UTF-8
70 Documentation pour go.
71
72 %description doc -l it.UTF-8
73 Documentazione di go.
74
75 %description doc -l pl.UTF-8
76 Dokumentacja do go.
77
78 %package -n vim-syntax-%{name}
79 Summary:        Go syntax files for Vim
80 Summary(pl.UTF-8):      Pliki składni Go dla Vima
81 Group:          Applications/Editors
82 Requires:       vim-rt >= 4:7.2.170
83 %if "%{_rpmversion}" >= "5"
84 BuildArch:      noarch
85 %endif
86
87 %description -n vim-syntax-%{name}
88 Go syntax files for vim.
89
90 %description -n vim-syntax-%{name} -l pl.UTF-8
91 Pliki składni Go dla Vima.
92
93 %package -n emacs-%{name}
94 Summary:        Go mode for Emacs
95 Summary(pl.UTF-8):      Tryb Go dla Emacsa
96 Group:          Applications/Editors
97 %if "%{_rpmversion}" >= "5"
98 BuildArch:      noarch
99 %endif
100
101 %description -n emacs-%{name}
102 Go mode for Emacs.
103
104 %description -n emacs-%{name} -l pl.UTF-8
105 Tryb Go dla Emacsa.
106
107 %prep
108 %setup -qc
109 mv go/* .
110 %patch0 -p1
111
112 # broken tests
113 %{__rm} src/pkg/net/multicast_test.go
114
115 cat > env.sh <<'EOF'
116 export GOROOT=$(pwd)
117 export GOROOT_FINAL=%{_libdir}/%{name}
118
119 export GOOS=linux
120 export GOBIN=$GOROOT/bin
121 export GOARCH=%{GOARCH}
122 export GOROOT_FINAL
123 export MAKE="%{__make}"
124 CC="%{__cc}"
125 export CC="${CC#ccache }"
126
127 export PATH="$PATH:$GOBIN"
128 EOF
129
130 install -d bin
131
132 # optflags for go tools build
133 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
134 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
135 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
136
137 %build
138 . ./env.sh
139
140 cd src
141 ./all.bash
142
143 %install
144 rm -rf $RPM_BUILD_ROOT
145 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
146
147 install -d $GOROOT/{misc,lib,src}
148 install -d $RPM_BUILD_ROOT%{_bindir}
149
150 cp -a pkg include lib bin $GOROOT
151 cp -a src/pkg src/cmd $GOROOT/src
152 cp -a misc/cgo $GOROOT/misc
153
154 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
155 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
156 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
157
158 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
159 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
160
161 %ifarch %{ix86}
162 tools="8a 8c 8g 8l"
163 %endif
164 %ifarch %{x8664}
165 tools="6a 6c 6g 6l"
166 %endif
167 %ifarch %{arm}
168 tools="5a 5c 5g 5l"
169 %endif
170 for tool in $tools; do
171         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
172 done
173
174 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
175 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
176
177 VIMFILES="syntax/go.vim ftdetect/gofiletype.vim ftplugin/go/fmt.vim ftplugin/go/import.vim indent/go.vim"
178 for i in $VIMFILES; do
179         install -Dp misc/vim/$i $RPM_BUILD_ROOT%{_vimdatadir}/$i
180 done
181
182 %clean
183 rm -rf $RPM_BUILD_ROOT
184
185 %files
186 %defattr(644,root,root,755)
187 %doc AUTHORS CONTRIBUTORS LICENSE README
188 %ifarch %{arm}
189 %attr(755,root,root) %{_bindir}/5a
190 %attr(755,root,root) %{_bindir}/5c
191 %attr(755,root,root) %{_bindir}/5g
192 %attr(755,root,root) %{_bindir}/5l
193 %endif
194 %ifarch %{x8664}
195 %attr(755,root,root) %{_bindir}/6a
196 %attr(755,root,root) %{_bindir}/6c
197 %attr(755,root,root) %{_bindir}/6g
198 %attr(755,root,root) %{_bindir}/6l
199 %endif
200 %ifarch %{ix86}
201 %attr(755,root,root) %{_bindir}/8a
202 %attr(755,root,root) %{_bindir}/8c
203 %attr(755,root,root) %{_bindir}/8g
204 %attr(755,root,root) %{_bindir}/8l
205 %endif
206 %attr(755,root,root) %{_bindir}/cgo
207 %attr(755,root,root) %{_bindir}/ebnflint
208 %attr(755,root,root) %{_bindir}/go
209 %attr(755,root,root) %{_bindir}/godoc
210 %attr(755,root,root) %{_bindir}/gofmt
211 %dir %{_libdir}/%{name}
212 %dir %{_libdir}/%{name}/bin
213 %attr(755,root,root) %{_libdir}/%{name}/bin/*
214
215 %{_libdir}/%{name}/include
216 %{_libdir}/%{name}/lib
217 %{_libdir}/%{name}/misc
218 %{_libdir}/%{name}/src
219 %dir %{_libdir}/%{name}/pkg
220 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
221 %{_libdir}/%{name}/pkg/obj
222 %dir %{_libdir}/%{name}/pkg/tool
223 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
224 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
225
226 %ifarch %{x8664}
227 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
228 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
229 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/crypto
230 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/debug
231 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/encoding
232 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/go
233 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/io
234 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/os
235 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/path
236 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
237 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
238 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
239 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
240 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
241 %endif
242
243 %files doc
244 %defattr(644,root,root,755)
245 %doc doc/*
246
247 %files -n vim-syntax-%{name}
248 %defattr(644,root,root,755)
249 %{_vimdatadir}/ftdetect/gofiletype.vim
250 %{_vimdatadir}/ftplugin/go
251 %{_vimdatadir}/indent/go.vim
252 %{_vimdatadir}/syntax/go.vim
253
254 %files -n emacs-%{name}
255 %defattr(644,root,root,755)
256 %{_datadir}/emacs/site-lisp/go-mode*.el
This page took 0.096548 seconds and 4 git commands to generate.