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