]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
up to 1.4.2, vim and emacs seem dropped
[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 # - build all target archs, subpackage them: http://golang.org/doc/install/source#environment
8 # - subpackage -src files?
9
10 # Conditional build:
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
15
16 Summary:        Go compiler and tools
17 Summary(pl.UTF-8):      Kompilator języka Go i narzędzia
18 Name:           golang
19 Version:        1.4.2
20 Release:        0.1
21 License:        BSD
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/
28 BuildRequires:  bash
29 BuildRequires:  rpm-pythonprov
30 %if %{with tests}
31 BuildRequires:  hostname
32 BuildRequires:  tzdata
33 %endif
34 Requires:       ca-certificates
35 ExclusiveArch:  %{ix86} %{x8664} %{arm}
36 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
37
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
42
43 %ifarch %{ix86}
44 %define GOARCH 386
45 %endif
46 %ifarch %{x8664}
47 %define GOARCH amd64
48 %endif
49
50 %define         _vimdatadir     %{_datadir}/vim
51
52 %description
53 Go is an open source programming environment that makes it easy to
54 build simple, reliable, and efficient software.
55
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.
59
60 %package doc
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
65 Group:          Documentation
66 %if "%{_rpmversion}" >= "5"
67 BuildArch:      noarch
68 %endif
69
70 %description doc
71 Documentation for go.
72
73 %description doc -l fr.UTF-8
74 Documentation pour go.
75
76 %description doc -l it.UTF-8
77 Documentazione di go.
78
79 %description doc -l pl.UTF-8
80 Dokumentacja do go.
81
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"
88 BuildArch:      noarch
89 %endif
90
91 %description -n vim-syntax-%{name}
92 Go syntax files for vim.
93
94 %description -n vim-syntax-%{name} -l pl.UTF-8
95 Pliki składni Go dla Vima.
96
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"
102 BuildArch:      noarch
103 %endif
104
105 %description -n emacs-%{name}
106 Go mode for Emacs.
107
108 %description -n emacs-%{name} -l pl.UTF-8
109 Tryb Go dla Emacsa.
110
111 %prep
112 %setup -qc
113 mv go/* .
114 %patch0 -p1
115
116 cat > env.sh <<'EOF'
117 export GOROOT=$(pwd)
118 export GOROOT_FINAL=%{_libdir}/%{name}
119
120 export GOOS=linux
121 export GOBIN=$GOROOT/bin
122 export GOARCH=%{GOARCH}
123 export GOROOT_FINAL
124 export MAKE="%{__make}"
125 CC="%{__cc}"
126 export CC="${CC#ccache }"
127
128 export PATH="$PATH:$GOBIN"
129 EOF
130
131 install -d bin
132
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
137
138 %build
139 . ./env.sh
140
141 cd src
142 ./all.bash
143
144 %install
145 rm -rf $RPM_BUILD_ROOT
146 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
147
148 install -d $GOROOT/{misc,lib,src}
149 install -d $RPM_BUILD_ROOT%{_bindir}
150
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}
155
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
159
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
162
163 %ifarch %{ix86}
164 tools="8a 8c 8g 8l"
165 %endif
166 %ifarch %{x8664}
167 tools="6a 6c 6g 6l"
168 %endif
169 %ifarch %{arm}
170 tools="5a 5c 5g 5l"
171 %endif
172 for tool in $tools; do
173         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
174 done
175
176 %if %{with emacs}
177 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
178 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
179 %endif
180
181 %if %{with vim}
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
185 done
186 %endif
187
188 %clean
189 rm -rf $RPM_BUILD_ROOT
190
191 %files
192 %defattr(644,root,root,755)
193 %doc AUTHORS CONTRIBUTORS LICENSE README
194 %ifarch %{arm}
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
199 %endif
200 %ifarch %{x8664}
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
205 %endif
206 %ifarch %{ix86}
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
211 %endif
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/*
220
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}/*
231
232 %ifarch %{x8664}
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
254 %endif
255
256 %files doc
257 %defattr(644,root,root,755)
258 %doc doc/*
259
260 %if %{with vim}
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 %endif
268
269 %if %{with emacs}
270 %files -n emacs-%{name}
271 %defattr(644,root,root,755)
272 %{_datadir}/emacs/site-lisp/go-mode*.el
273 %endif
This page took 0.051681 seconds and 4 git commands to generate.