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