]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
- updated to 1.8
[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.8
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:  7743960c968760437b6e39093cfe6f67
35 Patch0:         ca-certs.patch
36 Patch2:         %{name}-1.2-verbose-build.patch
37 Patch5:         go1.5-zoneinfo_testing_only.patch
38 URL:            http://golang.org/
39 BuildRequires:  bash
40 BuildRequires:  rpm-pythonprov
41 # The compiler is written in Go. Needs go(1.4+) compiler for build.
42 %if %{with bootstrap}
43 BuildRequires:  gcc-go >= 6:5
44 %else
45 BuildRequires:  golang >= 1.4
46 %endif
47 %if %{with tests}
48 BuildRequires:  glibc-static
49 BuildRequires:  hostname
50 BuildRequires:  pcre-devel
51 BuildRequires:  tzdata
52 %endif
53 Requires:       ca-certificates
54 Conflicts:      gcc-go
55 ExclusiveArch:  %{ix86} %{x8664} %{arm} aarch64 mips64 mips64le ppc64 ppc64le s390x
56 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
57
58 %define         no_install_post_strip   1
59 %define         no_install_post_chrpath 1
60 %define         _enable_debug_packages  0
61 %define         _noautoreqfiles         %{_libdir}/%{name}/src
62
63 %define goroot %{_libdir}/%{name}
64
65 %ifarch %{ix86}
66 %define GOARCH 386
67 %endif
68 %ifarch %{x8664}
69 %define GOARCH amd64
70 %endif
71 %ifarch %{arm}
72 %define GOARCH arm
73 %endif
74 %ifarch aarch64
75 %define GOARCH arm64
76 %endif
77 %ifarch mips64
78 %define GOARCH mips64x
79 %endif
80 %ifarch ppc64 ppc64le s390x
81 %define GOARCH %{_arch}
82 %endif
83
84 %description
85 Go is an open source programming environment that makes it easy to
86 build simple, reliable, and efficient software.
87
88 %description -l pl.UTF-8
89 Go to mające otwarte źródła środowisko do programowania, pozwalające
90 na łatwe tworzenie prostych, pewnych i wydajnych programów.
91
92 %package shared
93 Summary:        Golang shared object libraries
94 Summary(pl.UTF-8):      Biblioteki obiektów współdzielonych dla języka Go
95 Group:          Libraries
96 Requires:       %{name} = %{version}-%{release}
97
98 %description shared
99 Golang shared object libraries.
100
101 %description shared -l pl.UTF-8
102 Biblioteki obiektów współdzielonych dla języka Go.
103
104 %package doc
105 Summary:        Documentation for Go language
106 Summary(fr.UTF-8):      Documentation pour Go
107 Summary(it.UTF-8):      Documentazione di Go
108 Summary(pl.UTF-8):      Dokumentacja do języka Go
109 Group:          Documentation
110 %if "%{_rpmversion}" >= "5"
111 BuildArch:      noarch
112 %endif
113
114 %description doc
115 Documentation for Go language.
116
117 %description doc -l fr.UTF-8
118 Documentation pour Go.
119
120 %description doc -l it.UTF-8
121 Documentazione di Go.
122
123 %description doc -l pl.UTF-8
124 Dokumentacja do języka Go.
125
126 %prep
127 %setup -qc
128 %{__mv} go/* .
129 %patch0 -p1
130 %patch2 -p1
131 %patch5 -p1
132
133 # clean patch backups
134 find . -name '*.orig' | xargs -r %{__rm}
135
136 cat > env.sh <<'EOF'
137 # bootstrap compiler GOROOT
138 %if %{with bootstrap}
139 export GOROOT_BOOTSTRAP=%{_prefix}
140 %else
141 export GOROOT_BOOTSTRAP=%{goroot}
142 %endif
143 export GOROOT_FINAL=%{goroot}
144
145 export GOHOSTOS=linux
146 export GOHOSTARCH=%{GOARCH}
147
148 export GOOS=linux
149 export GOARCH=%{GOARCH}
150 %if %{without external_linker}
151 export GO_LDFLAGS="-linkmode internal"
152 %endif
153 %if %{with cgo}
154 export CGO_ENABLED=1
155 %else
156 export CGO_ENABLED=0
157 %endif
158
159 # use our gcc options for this build, but store gcc as default for compiler
160 export CFLAGS="%{rpmcflags}"
161 export LDFLAGS="%{rpmldflags}"
162
163 CC="%{__cc}"
164 export CC="${CC#ccache }"
165 export CC_FOR_TARGET="$CC"
166 EOF
167
168 %if 0
169 # optflags for go tools build
170 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
171 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
172 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
173 %endif
174
175 %build
176 . ./env.sh
177 cd src
178 ./make.bash --no-clean
179 cd ..
180
181 # build shared std lib
182 %if %{with shared}
183 GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
184 %endif
185
186 %install
187 rm -rf $RPM_BUILD_ROOT
188 GOROOT=$RPM_BUILD_ROOT%{goroot}
189
190 install -d $GOROOT/{misc,lib,src}
191 install -d $RPM_BUILD_ROOT%{_bindir}
192
193 cp -a pkg lib bin src VERSION $GOROOT
194 cp -a misc/cgo $GOROOT/misc
195
196 # kill Win32 and Plan9 scripts
197 find $GOROOT -name '*.bat' -o -name '*.rc' | xargs %{__rm}
198
199 # https://github.com/golang/go/issues/4749
200 find $GOROOT/src | xargs touch -r $GOROOT/VERSION
201 # and level out all the built archives
202 touch $GOROOT/pkg
203 find $GOROOT/pkg | xargs touch -r $GOROOT/pkg
204
205 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
206 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
207 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
208
209 # FIXME: do we need whole sources, including build scripts?
210 # for now, remove only non-Linux stuff
211 %{__rm} $RPM_BUILD_ROOT%{_libdir}/%{name}/src/androidtest.bash \
212         $RPM_BUILD_ROOT%{_libdir}/%{name}/src/syscall/{mksyscall_solaris,mksysctl_openbsd,mksysnum_{darwin,dragonfly,freebsd,netbsd,openbsd}}.pl
213 # ...and tests
214 %{__rm} -r $RPM_BUILD_ROOT%{_libdir}/%{name}/src/internal/trace \
215            $RPM_BUILD_ROOT%{_libdir}/%{name}/misc/cgo/{errors,fortran,test*}
216
217 # unenvize remaining scripts
218 %{__sed} -i -e '1s,/usr/bin/env bash,/bin/bash,' $RPM_BUILD_ROOT%{_libdir}/%{name}/src/*.bash
219 %{__sed} -i -e '1s,/usr/bin/env bash,/bin/bash,' $RPM_BUILD_ROOT%{_libdir}/%{name}/src/syscall/*.sh
220 %{__sed} -i -e '1s,/usr/bin/env perl,/usr/bin/perl,' $RPM_BUILD_ROOT%{_libdir}/%{name}/src/syscall/*.pl
221
222 %clean
223 rm -rf $RPM_BUILD_ROOT
224
225 %files
226 %defattr(644,root,root,755)
227 %doc AUTHORS CONTRIBUTORS LICENSE
228 %attr(755,root,root) %{_bindir}/cgo
229 %attr(755,root,root) %{_bindir}/go
230 %attr(755,root,root) %{_bindir}/gofmt
231 %dir %{_libdir}/%{name}
232 %{_libdir}/%{name}/VERSION
233 %dir %{_libdir}/%{name}/bin
234 %attr(755,root,root) %{_libdir}/%{name}/bin/go
235 %attr(755,root,root) %{_libdir}/%{name}/bin/gofmt
236
237 %{_libdir}/%{name}/lib
238 %{_libdir}/%{name}/misc
239 %{_libdir}/%{name}/src
240 %dir %{_libdir}/%{name}/pkg
241 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
242 %{_libdir}/%{name}/pkg/obj
243 %dir %{_libdir}/%{name}/pkg/tool
244 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
245 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/addr2line
246 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/api
247 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/asm
248 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo
249 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/compile
250 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cover
251 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/dist
252 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/doc
253 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/fix
254 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/link
255 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/nm
256 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/objdump
257 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/pack
258 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/pprof
259 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/trace
260 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/vet
261
262 %dir %{_libdir}/%{name}/pkg/bootstrap
263 %dir %{_libdir}/%{name}/pkg/bootstrap/bin
264 %attr(755,root,root) %{_libdir}/%{name}/pkg/bootstrap/bin/asm
265 %attr(755,root,root) %{_libdir}/%{name}/pkg/bootstrap/bin/compile
266 %attr(755,root,root) %{_libdir}/%{name}/pkg/bootstrap/bin/link
267 %{_libdir}/%{name}/pkg/bootstrap/pkg
268 %{_libdir}/%{name}/pkg/bootstrap/src
269 %{_libdir}/%{name}/pkg/include
270
271 %if %{with shared}
272 %files shared
273 %defattr(644,root,root,755)
274 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_dynlink
275 %endif
276
277 %files doc
278 %defattr(644,root,root,755)
279 %doc doc/*
This page took 0.064852 seconds and 4 git commands to generate.