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