]> git.pld-linux.org Git - packages/golang.git/blob - golang.spec
- race detector is available only on x86_64
[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
7 # Conditional build:
8 %bcond_without  tests   # build without tests
9 %bcond_without  verbose # verbose build (V=1)
10
11 Summary:        Go compiler and tools
12 Summary(pl.UTF-8):      Kompilator języka Go i narzędzia
13 Name:           golang
14 Version:        1.1.2
15 Release:        0.1
16 License:        BSD
17 Group:          Development/Languages
18 #Source0Download: https://code.google.com/p/go/downloads/list
19 Source0:        https://go.googlecode.com/files/go%{version}.src.tar.gz
20 # Source0-md5:  705feb2246c8ddaf820d7e171f1430c5
21 URL:            http://golang.org/
22 BuildRequires:  bison
23 BuildRequires:  ed
24 BuildRequires:  rpm-pythonprov
25 %if %{with tests}
26 BuildRequires:  hostname
27 %endif
28 ExclusiveArch:  %{ix86} %{x8664} %{arm}
29 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
30
31 %define _enable_debug_packages 0
32 %define no_install_post_strip 1
33 %define no_install_post_chrpath 1
34 %define _noautoreqfiles %{_libdir}/%{name}/src
35
36 %define         _vimdatadir     %{_datadir}/vim
37
38 %ifarch %{ix86}
39 %define GOARCH 386
40 %endif
41 %ifarch %{x8664}
42 %define GOARCH amd64
43 %endif
44
45 %description
46 Go is an open source programming environment that makes it easy to
47 build simple, reliable, and efficient software.
48
49 %description -l pl.UTF-8
50 Go to mające otwarte źródła środowisko do programowania, pozwalające
51 na łatwe tworzenie prostych, pewnych i wydajnych programów.
52
53 %package -n vim-syntax-%{name}
54 Summary:        Go syntax files for Vim
55 Summary(pl.UTF-8):      Pliki składni Go dla Vima
56 Group:          Applications/Editors
57 Requires:       %{name} = %{version}-%{release}
58 Requires:       vim-rt >= 4:7.2.170
59 %if "%{_rpmversion}" >= "5"
60 BuildArch:      noarch
61 %endif
62
63 %description -n vim-syntax-%{name}
64 Go syntax files for vim.
65
66 %description -n vim-syntax-%{name} -l pl.UTF-8
67 Pliki składni Go dla Vima.
68
69 %package -n emacs-%{name}
70 Summary:        Go mode for Emacs
71 Summary(pl.UTF-8):      Tryb Go dla Emacsa
72 Group:          Applications/Editors
73 %if "%{_rpmversion}" >= "5"
74 BuildArch:      noarch
75 %endif
76
77 %description -n emacs-%{name}
78 Go mode for Emacs.
79
80 %description -n emacs-%{name} -l pl.UTF-8
81 Tryb Go dla Emacsa.
82
83 %prep
84 %setup -q -n go
85
86 # broken tests
87 %{__rm} src/pkg/net/multicast_test.go
88
89 %build
90 GOSRC=$(pwd)
91 GOROOT=$(pwd)
92 GOROOT_FINAL=%{_libdir}/%{name}
93
94 GOOS=linux
95 GOBIN=$GOROOT/bin
96 GOARCH=%{GOARCH}
97 export GOARCH GOROOT GOOS GOBIN GOROOT_FINAL
98 export MAKE="%{__make}"
99 export CC="%{__cc}"
100 CC=${CC#ccache }
101 # optflags for go tools build
102 nflags="\"$(echo '%{rpmcflags}' | sed -e 's/^[  ]*//;s/[        ]*$//;s/[       ]\+/ /g' -e 's/ /\",\"/g')\""
103 %{__sed} -i -e "s/\"-O2\"/$nflags/" src/cmd/dist/build.c
104 # NOTE: optflags used in gcc calls from go compiler are in src/cmd/go/build.go
105
106 install -d "$GOBIN"
107 cd src
108
109 LC_ALL=C PATH="$PATH:$GOBIN" ./all.bash
110
111 %install
112 rm -rf $RPM_BUILD_ROOT
113 GOROOT=$RPM_BUILD_ROOT%{_libdir}/%{name}
114
115 install -d $GOROOT/{misc,lib,src}
116 install -d $RPM_BUILD_ROOT%{_bindir}
117
118 cp -a pkg include lib bin $GOROOT
119 cp -a src/pkg src/cmd $GOROOT/src
120 cp -a misc/cgo $GOROOT/misc
121
122 ln -sf %{_libdir}/%{name}/bin/go $RPM_BUILD_ROOT%{_bindir}/go
123 ln -sf %{_libdir}/%{name}/bin/godoc $RPM_BUILD_ROOT%{_bindir}/godoc
124 ln -sf %{_libdir}/%{name}/bin/gofmt $RPM_BUILD_ROOT%{_bindir}/gofmt
125
126 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/cgo $RPM_BUILD_ROOT%{_bindir}/cgo
127 ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/ebnflint $RPM_BUILD_ROOT%{_bindir}/ebnflint
128
129 %ifarch %{ix86}
130 tools="8a 8c 8g 8l"
131 %endif
132 %ifarch %{x8664}
133 tools="6a 6c 6g 6l"
134 %endif
135 %ifarch %{arm}
136 tools="5a 5c 5g 5l"
137 %endif
138 for tool in $tools; do
139         ln -sf %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/$tool $RPM_BUILD_ROOT%{_bindir}/$tool
140 done
141
142 install -d $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp
143 cp -p misc/emacs/go*.el $RPM_BUILD_ROOT%{_datadir}/emacs/site-lisp/
144
145 VIMFILES="syntax/go.vim ftdetect/gofiletype.vim ftplugin/go/fmt.vim ftplugin/go/import.vim indent/go.vim"
146 for i in $VIMFILES; do
147         install -Dp misc/vim/$i $RPM_BUILD_ROOT%{_vimdatadir}/$i
148 done
149
150 %clean
151 rm -rf $RPM_BUILD_ROOT
152
153 %files
154 %defattr(644,root,root,755)
155 %doc AUTHORS CONTRIBUTORS LICENSE README doc/*
156 %ifarch %{arm}
157 %attr(755,root,root) %{_bindir}/5a
158 %attr(755,root,root) %{_bindir}/5c
159 %attr(755,root,root) %{_bindir}/5g
160 %attr(755,root,root) %{_bindir}/5l
161 %endif
162 %ifarch %{x8664}
163 %attr(755,root,root) %{_bindir}/6a
164 %attr(755,root,root) %{_bindir}/6c
165 %attr(755,root,root) %{_bindir}/6g
166 %attr(755,root,root) %{_bindir}/6l
167 %endif
168 %ifarch %{ix86}
169 %attr(755,root,root) %{_bindir}/8a
170 %attr(755,root,root) %{_bindir}/8c
171 %attr(755,root,root) %{_bindir}/8g
172 %attr(755,root,root) %{_bindir}/8l
173 %endif
174 %attr(755,root,root) %{_bindir}/cgo
175 %attr(755,root,root) %{_bindir}/ebnflint
176 %attr(755,root,root) %{_bindir}/go
177 %attr(755,root,root) %{_bindir}/godoc
178 %attr(755,root,root) %{_bindir}/gofmt
179 %dir %{_libdir}/%{name}
180 %dir %{_libdir}/%{name}/bin
181 %attr(755,root,root) %{_libdir}/%{name}/bin/*
182
183 %{_libdir}/%{name}/include
184 %{_libdir}/%{name}/lib
185 %{_libdir}/%{name}/misc
186 %{_libdir}/%{name}/src
187 %dir %{_libdir}/%{name}/pkg
188 %{_libdir}/%{name}/pkg/linux_%{GOARCH}
189 %{_libdir}/%{name}/pkg/obj
190 %dir %{_libdir}/%{name}/pkg/tool
191 %dir %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}
192 %attr(755,root,root) %{_libdir}/%{name}/pkg/tool/linux_%{GOARCH}/*
193 %ifarch %{x8664}
194 %dir %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race
195 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/*.a
196 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/regexp
197 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/runtime
198 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/sync
199 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/text
200 %{_libdir}/%{name}/pkg/linux_%{GOARCH}_race/unicode
201 %endif
202
203 %files -n vim-syntax-%{name}
204 %defattr(644,root,root,755)
205 %{_vimdatadir}/ftdetect/gofiletype.vim
206 %{_vimdatadir}/ftplugin/go
207 %{_vimdatadir}/indent/go.vim
208 %{_vimdatadir}/syntax/go.vim
209
210 %files -n emacs-%{name}
211 %defattr(644,root,root,755)
212 %{_datadir}/emacs/site-lisp/go-mode*.el
This page took 0.063077 seconds and 4 git commands to generate.