]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
- up to 1.7.5
[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 #   or choose only useful crosscompilers?
9 # - subpackage -src files?
10
11 # Conditional build:
12 %bcond_without  verbose         # verbose build (V=1)
13 %bcond_without  tests           # build without tests [nop actually]
14 %bcond_without  shared          # Build golang shared objects for stdlib
15 %bcond_without  ext_linker      # Build golang using external/internal (close to cgo disabled) linking
16 %bcond_without  cgo             # cgo (importing C libraries) support
17
18 %ifnarch %{ix86} %{x8664} %{arm} aarch64 mips64 mips64le ppc64le
19 %undefine       with_shared
20 %undefine       with_ext_linker
21 %undefine       with_cgo
22 %endif
23
24 Summary:        Go compiler and tools
25 Summary(pl.UTF-8):      Kompilator języka Go i narzędzia
26 Name:           golang
27 Version:        1.7.5
28 Release:        1
29 # source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
30 License:        BSD and Public Domain
31 Group:          Development/Languages
32 # Source0Download: https://golang.org/dl/
33 Source0:        https://storage.googleapis.com/golang/go%{version}.src.tar.gz
34 # Source0-md5:  506de2d870409e9003e1440bcfeb3a65
35 Patch0:         ca-certs.patch
36 Patch2:         %{name}-1.2-verbose-build.patch
37 Patch4:         go1.5beta1-disable-TestGdbPython.patch
38 Patch5:         go1.5-zoneinfo_testing_only.patch
39 URL:            http://golang.org/
40 BuildRequires:  bash
41 BuildRequires:  rpm-pythonprov
42 # The compiler is written in Go. Needs go(1.4+) compiler for build.
43 %if %{with bootstrap}
44 BuildRequires:  gcc-go >= 6:5
45 %else
46 BuildRequires:  golang >= 1.4
47 %endif
48 %if %{with tests}
49 BuildRequires:  glibc-static
50 BuildRequires:  hostname
51 BuildRequires:  pcre-devel
52 BuildRequires:  tzdata
53 %endif
54 Requires:       ca-certificates
55 Conflicts:      gcc-go
56 ExclusiveArch:  %{ix86} %{x8664} %{arm} aarch64 mips64 mips64le ppc64 ppc64le s390x
57 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
58
59 %define         no_install_post_strip   1
60 %define         no_install_post_chrpath 1
61 %define         _enable_debug_packages  0
62 %define         _noautoreqfiles         %{_libdir}/%{name}/src
63
64 %define goroot %{_libdir}/%{name}
65
66 %ifarch %{ix86}
67 %define GOARCH 386
68 %endif
69 %ifarch %{x8664}
70 %define GOARCH amd64
71 %endif
72 %ifarch %{arm}
73 %define GOARCH arm
74 %endif
75 %ifarch aarch64
76 %define GOARCH arm64
77 %endif
78 %ifarch mips64
79 %define GOARCH mips64x
80 %endif
81 %ifarch ppc64 ppc64le s390x
82 %define GOARCH %{_arch}
83 %endif
84
85 %description
86 Go is an open source programming environment that makes it easy to
87 build simple, reliable, and efficient software.
88
89 %description -l pl.UTF-8
90 Go to mające otwarte źródła środowisko do programowania, pozwalające
91 na łatwe tworzenie prostych, pewnych i wydajnych programów.
92
93 %package shared
94 Summary:        Golang shared object libraries
95 Summary(pl.UTF-8):      Biblioteki obiektów współdzielonych dla języka Go
96 Group:          Libraries
97 Requires:       %{name} = %{version}-%{release}
98
99 %description shared
100 Golang shared object libraries.
101
102 %description shared -l pl.UTF-8
103 Biblioteki obiektów współdzielonych dla języka Go.
104
105 %package doc
106 Summary:        Documentation for Go language
107 Summary(fr.UTF-8):      Documentation pour Go
108 Summary(it.UTF-8):      Documentazione di Go
109 Summary(pl.UTF-8):      Dokumentacja do języka Go
110 Group:          Documentation
111 %if "%{_rpmversion}" >= "5"
112 BuildArch:      noarch
113 %endif
114
115 %description doc
116 Documentation for Go language.
117
118 %description doc -l fr.UTF-8
119 Documentation pour Go.
120
121 %description doc -l it.UTF-8
122 Documentazione di Go.
123
124 %description doc -l pl.UTF-8
125 Dokumentacja do języka Go.
126
127 %prep
128 %setup -qc
129 %{__mv} go/* .
130 %patch0 -p1
131 %patch2 -p1
132 %patch4 -p1
133 %patch5 -p1
134
135 cat > env.sh <<'EOF'
136 # bootstrap compiler GOROOT
137 %if %{with bootstrap}
138 export GOROOT_BOOTSTRAP=%{_prefix}
139 %else
140 export GOROOT_BOOTSTRAP=%{goroot}
141 %endif
142 export GOROOT_FINAL=%{goroot}
143
144 export GOHOSTOS=linux
145 export GOHOSTARCH=%{GOARCH}
146
147 export GOOS=linux
148 export GOARCH=%{GOARCH}
149 %if %{without external_linker}
150 export GO_LDFLAGS="-linkmode internal"
151 %endif
152 %if %{with cgo}
153 export CGO_ENABLED=1
154 %else
155 export CGO_ENABLED=0
156 %endif
157
158 # use our gcc options for this build, but store gcc as default for compiler
159 export CFLAGS="%{rpmcflags}"
160 export LDFLAGS="%{rpmldflags}"
161
162 CC="%{__cc}"
163 export CC="${CC#ccache }"
164 export CC_FOR_TARGET="$CC"
165 EOF
166
167 %if 0
168 # optflags for go tools build
169 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
170 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
171 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
172 %endif
173
174 %build
175 . ./env.sh
176 cd src
177 ./make.bash --no-clean
178 cd ..
179
180 # build shared std lib
181 %if %{with shared}
182 GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
183 %endif
184
185 %install
186 rm -rf $RPM_BUILD_ROOT
187 GOROOT=$RPM_BUILD_ROOT%{goroot}
188
189 install -d $GOROOT/{misc,lib,src}
190 install -d $RPM_BUILD_ROOT%{_bindir}
191
192 cp -a pkg lib bin src VERSION $GOROOT
193 cp -a misc/cgo $GOROOT/misc
194
195 # kill Win32 and Plan9 scripts
196 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
197
198 # https://github.com/golang/go/issues/4749
199 find $GOROOT/src | xargs touch -r $GOROOT/VERSION
200 # and level out all the built archives
201 touch $GOROOT/pkg
202 find $GOROOT/pkg | xargs touch -r $GOROOT/pkg
203
204 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
205 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
206 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
207
208 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
209 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
210
211 %ifarch %{ix86}
212 tools="8a 8c 8g 8l"
213 %endif
214 %ifarch %{x8664}
215 tools="6a 6c 6g 6l"
216 %endif
217 %ifarch %{arm}
218 tools="5a 5c 5g 5l"
219 %endif
220 for tool in $tools; do
221         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
222 done
223
224 %clean
225 rm -rf $RPM_BUILD_ROOT
226
227 %files
228 %defattr(644,root,root,755)
229 %doc AUTHORS CONTRIBUTORS LICENSE
230 %ifarch %{arm}
231 %attr(755,root,root) %{_bindir}/5a
232 %attr(755,root,root) %{_bindir}/5c
233 %attr(755,root,root) %{_bindir}/5g
234 %attr(755,root,root) %{_bindir}/5l
235 %endif
236 %ifarch %{x8664}
237 %attr(755,root,root) %{_bindir}/6a
238 %attr(755,root,root) %{_bindir}/6c
239 %attr(755,root,root) %{_bindir}/6g
240 %attr(755,root,root) %{_bindir}/6l
241 %endif
242 %ifarch %{ix86}
243 %attr(755,root,root) %{_bindir}/8a
244 %attr(755,root,root) %{_bindir}/8c
245 %attr(755,root,root) %{_bindir}/8g
246 %attr(755,root,root) %{_bindir}/8l
247 %endif
248 %attr(755,root,root) %{_bindir}/cgo
249 %attr(755,root,root) %{_bindir}/ebnflint
250 %attr(755,root,root) %{_bindir}/go
251 %attr(755,root,root) %{_bindir}/godoc
252 %attr(755,root,root) %{_bindir}/gofmt
253 %dir %{_libdir}/%{name}
254 %{_libdir}/%{name}/VERSION
255 %dir %{_libdir}/%{name}/bin
256 %attr(755,root,root) %{_libdir}/%{name}/bin/*
257
258 %{_libdir}/%{name}/lib
259 %{_libdir}/%{name}/misc
260 %{_libdir}/%{name}/src
261 %dir %{_libdir}/%{name}/pkg
262 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
263 %{_libdir}/%{name}/pkg/obj
264 %dir %{_libdir}/%{name}/pkg/tool
265 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
266 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
267
268 %{_libdir}/%{name}/pkg/bootstrap
269 %{_libdir}/%{name}/pkg/include
270
271 %if 0
272 #ifarch %{x8664}
273 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
274 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
275 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/compress
276 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/container
277 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/crypto
278 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/debug
279 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/encoding
280 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/go
281 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/hash
282 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/internal
283 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/io
284 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/math
285 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/mime
286 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/net
287 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/os
288 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/path
289 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
290 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
291 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
292 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
293 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
294 %endif
295
296 %if %{with shared}
297 %files shared
298 %defattr(644,root,root,755)
299 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_dynlink
300 %endif
301
302 %files doc
303 %defattr(644,root,root,755)
304 %doc doc/*
This page took 0.074027 seconds and 4 git commands to generate.