source: projects/specs/trunk/c/cargo/cargo-vl.spec @ 11321

Revision 11321, 9.4 KB checked in by tomop, 6 years ago (diff)

rust-1.23.0-1, cargo-0.24.0-1

Line 
1%bcond_with bootstrap
2
3# Only x86_64 and i686 are Tier 1 platforms at this time.
4# https://forge.rust-lang.org/platform-support.html
5%global rust_arches x86_64 i686
6
7# Only the specified arches will use bootstrap binaries.
8%if %{with bootstrap}
9%global bootstrap_arches %%{rust_arches}
10%endif
11
12%bcond_with bundled_libgit2
13
14Name:           cargo
15Version:        0.24.0
16Release:        1%{?_dist_release}
17Summary:        Rust's package manager and build tool
18License:        ASL 2.0 or MIT
19URL:            https://crates.io/
20ExclusiveArch:  %{rust_arches}
21
22%global cargo_version %{version}
23%global cargo_bootstrap 0.23.0
24
25Source0:        https://github.com/rust-lang/%{name}/archive/%{cargo_version}/%{name}-%{cargo_version}.tar.gz
26
27Patch1:         cargo-0.23.0-disable-mdbook.patch
28
29# Get the Rust triple for any arch.
30%{lua: function rust_triple(arch)
31  local abi = "gnu"
32  if arch == "armv7hl" then
33    arch = "armv7"
34    abi = "gnueabihf"
35  elseif arch == "ppc64" then
36    arch = "powerpc64"
37  elseif arch == "ppc64le" then
38    arch = "powerpc64le"
39  end
40  return arch.."-unknown-linux-"..abi
41end}
42
43%global rust_triple %{lua: print(rust_triple(rpm.expand("%{_target_cpu}")))}
44
45%if %defined bootstrap_arches
46# For each bootstrap arch, add an additional binary Source.
47# Also define bootstrap_source just for the current target.
48%{lua: do
49  local bootstrap_arches = {}
50  for arch in string.gmatch(rpm.expand("%{bootstrap_arches}"), "%S+") do
51    table.insert(bootstrap_arches, arch)
52  end
53  local base = rpm.expand("https://static.rust-lang.org/dist/cargo-%{cargo_bootstrap}")
54  local target_arch = rpm.expand("%{_target_cpu}")
55  for i, arch in ipairs(bootstrap_arches) do
56    i = i + 10
57    print(string.format("Source%d: %s-%s.tar.gz\n",
58                        i, base, rust_triple(arch)))
59    if arch == target_arch then
60      rpm.define("bootstrap_source "..i)
61    end
62  end
63end}
64%endif
65
66# Use vendored crate dependencies so we can build offline.
67# Created using https://github.com/alexcrichton/cargo-vendor/ 0.1.13
68# It's so big because some of the -sys crates include the C library source they
69# want to link to.  With our -devel buildreqs in place, they'll be used instead.
70# FIXME: These should all eventually be packaged on their own!
71Source100:      %{name}-%{version}-vendor.tar.xz
72
73BuildRequires:  rust
74BuildRequires:  make
75BuildRequires:  cmake
76BuildRequires:  gcc
77
78%ifarch %{bootstrap_arches}
79%global bootstrap_root cargo-%{cargo_bootstrap}-%{rust_triple}
80%global local_cargo %{_builddir}/%{bootstrap_root}/cargo/bin/cargo
81Provides:       bundled(%{name}-bootstrap) = %{cargo_bootstrap}
82%else
83BuildRequires:  %{name} >= 0.13.0
84%global local_cargo %{_bindir}/%{name}
85%endif
86
87# Indirect dependencies for vendored -sys crates above
88BuildRequires:  curl-devel
89BuildRequires:  libssh2-devel
90BuildRequires:  openssl-devel
91BuildRequires:  zlib-devel
92BuildRequires:  pkgconfig
93
94%if %with bundled_libgit2
95Provides:       bundled(libgit2) = 0.25.0
96%else
97BuildRequires:  libgit2-devel >= 0.24
98%endif
99
100# Cargo is not much use without Rust
101Requires:       rust
102
103%description
104Cargo is a tool that allows Rust projects to declare their various dependencies
105and ensure that you'll always get a repeatable build.
106
107
108%package doc
109Summary:        Documentation for Cargo
110BuildArch:      noarch
111
112%description doc
113This package includes HTML documentation for Cargo.
114
115
116%prep
117
118%ifarch %{bootstrap_arches}
119%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source}
120test -f '%{local_cargo}'
121%endif
122
123# cargo sources
124%setup -q -n %{name}-%{cargo_version}
125
126# vendored crates
127%setup -q -n %{name}-%{cargo_version} -T -D -a 100
128
129%autopatch -p1
130
131# define the offline registry
132%global cargo_home $PWD/.cargo
133mkdir -p %{cargo_home}
134cat >.cargo/config <<EOF
135[source.crates-io]
136registry = 'https://github.com/rust-lang/crates.io-index'
137replace-with = 'vendored-sources'
138
139[source.vendored-sources]
140directory = '$PWD/vendor'
141EOF
142
143# This should eventually migrate to distro policy
144# Enable optimization, debuginfo, and link hardening.
145%global rustflags -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now
146
147%build
148
149%if %without bundled_libgit2
150# convince libgit2-sys to use the distro libgit2
151export LIBGIT2_SYS_USE_PKG_CONFIG=1
152%endif
153
154# use our offline registry and custom rustc flags
155export CARGO_HOME="%{cargo_home}"
156export RUSTFLAGS="%{rustflags}"
157
158# cargo no longer uses a configure script, but we still want to use
159# CFLAGS in case of the odd C file in vendored dependencies.
160%{?__global_cflags:export CFLAGS="%{__global_cflags}"}
161%{!?__global_cflags:%{?optflags:export CFLAGS="%{optflags}"}}
162%{?__global_ldflags:export LDFLAGS="%{__global_ldflags}"}
163
164%{local_cargo} build --release
165sh src/ci/dox.sh
166
167
168%install
169export CARGO_HOME="%{cargo_home}"
170export RUSTFLAGS="%{rustflags}"
171
172%{local_cargo} install --root %{buildroot}%{_prefix}
173rm %{buildroot}%{_prefix}/.crates.toml
174
175mkdir -p %{buildroot}%{_mandir}/man1
176%{__install} -p -m644 src/etc/man/cargo*.1 \
177  -t %{buildroot}%{_mandir}/man1
178
179%{__install} -p -m644 src/etc/cargo.bashcomp.sh \
180  -D %{buildroot}%{_sysconfdir}/bash_completion.d/cargo
181
182%{__install} -p -m644 src/etc/_cargo \
183  -D %{buildroot}%{_datadir}/zsh/site-functions/_cargo
184
185# Create the path for crate-devel packages
186mkdir -p %{buildroot}%{_datadir}/cargo/registry
187
188mkdir -p %{buildroot}%{_docdir}/cargo
189cp -a target/doc %{buildroot}%{_docdir}/cargo/html
190
191
192%check
193export CARGO_HOME="%{cargo_home}"
194export RUSTFLAGS="%{rustflags}"
195
196# some tests are known to fail exact output due to libgit2 differences
197CFG_DISABLE_CROSS_TESTS=1 %{local_cargo} test --no-fail-fast || :
198
199
200%files
201%license LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY
202%doc README.md
203%{_bindir}/cargo
204%{_mandir}/man1/cargo*.1*
205%{_sysconfdir}/bash_completion.d/cargo
206%{_datadir}/zsh/site-functions/_cargo
207%dir %{_datadir}/cargo
208%dir %{_datadir}/cargo/registry
209
210%files doc
211%{_docdir}/cargo/html
212
213
214%changelog
215* Fri Jan 05 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.24.0-1
216- Updated to 0.24.0.
217
218* Tue Jan 02 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> - 0.23.0-2
219- initial build for Vine Linux.
220- built a bootstrap rpm.
221
222* Wed Nov 29 2017 Josh Stone <jistone@redhat.com> - 0.23.0-1
223- Update to 0.23.0.
224
225* Mon Oct 16 2017 Josh Stone <jistone@redhat.com> - 0.22.0-1
226- Update to 0.22.0.
227
228* Mon Sep 11 2017 Josh Stone <jistone@redhat.com> - 0.21.1-1
229- Update to 0.21.1.
230
231* Thu Aug 31 2017 Josh Stone <jistone@redhat.com> - 0.21.0-1
232- Update to 0.21.0.
233
234* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.0-3
235- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
236
237* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.20.0-2
238- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
239
240* Fri Jul 21 2017 Josh Stone <jistone@redhat.com> - 0.20.0-1
241- Update to 0.20.0.
242- Add a cargo-doc subpackage.
243
244* Sat Jul 08 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.19.0-4
245- Disable bootstrap
246
247* Sat Jul 08 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.19.0-3
248- Rebuild for libgit2 0.26.x
249
250* Tue Jun 20 2017 Josh Stone <jistone@redhat.com> - 0.19.0-2
251- Create /usr/share/cargo/registry for crate-devel packages
252
253* Fri Jun 09 2017 Josh Stone <jistone@redhat.com> - 0.19.0-1
254- Update to 0.19.0.
255
256* Thu Apr 27 2017 Josh Stone <jistone@redhat.com> - 0.18.0-1
257- Update to 0.18.0.
258
259* Thu Mar 16 2017 Josh Stone <jistone@redhat.com> - 0.17.0-1
260- Update to 0.17.0.
261
262* Tue Feb 14 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.16.0-2
263- Backport patch to expose description in cargo metadata
264
265* Thu Feb 09 2017 Josh Stone <jistone@redhat.com> - 0.16.0-1
266- Update to 0.16.0.
267- Start using the current upstream release for bootstrap.
268- Merge and clean up conditionals for epel7.
269
270* Tue Feb 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.15.0-4
271- Disable bootstrap
272
273* Tue Feb 07 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.15.0-3
274- Rebuild for libgit2-0.25.x
275
276* Tue Jan 03 2017 Josh Stone <jistone@redhat.com> - 0.15.0-2
277- Rebuild without bootstrap binaries.
278
279* Tue Jan 03 2017 Josh Stone <jistone@redhat.com> - 0.15.0-1
280- Update to 0.15.0.
281- Rewrite bootstrap logic to target specific arches.
282- Bootstrap ppc64, ppc64le, s390x.
283
284* Sun Nov 13 2016 Josh Stone <jistone@redhat.com> - 0.14.0-2
285- Fix CFG_RELEASE_NUM
286
287* Thu Nov 10 2016 Josh Stone <jistone@redhat.com> - 0.14.0-1
288- Update to 0.14.0.
289- Use hardening flags for linking.
290
291* Thu Oct 20 2016 Josh Stone <jistone@redhat.com> - 0.13.0-4
292- Rebuild with Rust 1.12.1 and enabled MIR.
293
294* Fri Oct 07 2016 Josh Stone <jistone@redhat.com> - 0.13.0-3
295- Rebuild without bootstrap binaries.
296
297* Thu Oct 06 2016 Josh Stone <jistone@redhat.com> - 0.13.0-2
298- Bootstrap aarch64.
299- Use jemalloc's MALLOC_CONF to work around #36944.
300
301* Fri Sep 30 2016 Josh Stone <jistone@redhat.com> - 0.13.0-1
302- Update to 0.13.0.
303- Always use --local-cargo, even for bootstrap binaries.
304- Disable MIR until rust#36774 is resolved.
305
306* Sat Sep 03 2016 Josh Stone <jistone@redhat.com> - 0.12.0-3
307- Rebuild without bootstrap binaries.
308
309* Fri Sep 02 2016 Josh Stone <jistone@redhat.com> - 0.12.0-2
310- Bootstrap armv7hl.
311- Patch dl-snapshot.py to ignore hashes on unknown archs.
312
313* Wed Aug 24 2016 Josh Stone <jistone@redhat.com> - 0.12.0-1
314- Update to 0.12.0.
315
316* Mon Aug 22 2016 Josh Stone <jistone@redhat.com> 0.11.0-3
317- Rebuild without bootstrap binaries.
318- Add a runtime requirement on rust.
319
320* Mon Aug 22 2016 Josh Stone <jistone@redhat.com> - 0.11.0-2
321- Initial import into Fedora (#1357749), bootstrapped
322
323* Sun Jul 17 2016 Josh Stone <jistone@fedoraproject.org> - 0.11.0-1
324- Initial package, bootstrapped
Note: See TracBrowser for help on using the repository browser.