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

Revision 11772, 9.4 KB checked in by ara_t, 6 years ago (diff)

cargo: rebuild with libgit2-0.27.4

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