]> git.pld-linux.org Git - packages/cargo.git/blame - cargo.spec
up to 0.26.0
[packages/cargo.git] / cargo.spec
CommitLineData
fd992278
JR
1#
2# Conditional build:
8e5324db 3%bcond_with bootstrap # bootstrap using precompiled binaries
fd992278 4%bcond_without tests # build without tests
3cb37687 5
8e5324db
JB
6%define cargo_version %{version}
7%define cargo_bootstrap 0.18.0
3cb37687
JR
8
9Summary: Rust's package manager and build tool
8e5324db 10Summary(pl.UTF-8): Zarządca pakietów i narzędzie do budowania
3cb37687 11Name: cargo
10ea2891
JP
12Version: 0.26.0
13Release: 1
8e5324db
JB
14License: Apache v2.0 or MIT
15Group: Development/Tools
3cb37687 16Source0: https://github.com/rust-lang/cargo/archive/%{cargo_version}/%{name}-%{cargo_version}.tar.gz
10ea2891 17# Source0-md5: 9929f01186583c5c9f01b587356a7c92
e1a2b912 18Source2: https://static.rust-lang.org/dist/%{name}-%{cargo_bootstrap}-x86_64-unknown-linux-gnu.tar.gz
fd992278 19# Source2-md5: d2cbab6378c1f60b483efa0f076a8f81
e1a2b912 20Source3: https://static.rust-lang.org/dist/%{name}-%{cargo_bootstrap}-i686-unknown-linux-gnu.tar.gz
fd992278 21# Source3-md5: 1ad24c241a2f5e3c4bf83855766fab35
3cb37687 22# Use vendored crate dependencies so we can build offline.
10ae55f8 23# Created using https://github.com/alexcrichton/cargo-vendor/ 0.1.13
3cb37687
JR
24# It's so big because some of the -sys crates include the C library source they
25# want to link to. With our -devel buildreqs in place, they'll be used instead.
26# FIXME: These should all eventually be packaged on their own!
784d3965 27# PLD: using sources vendored by Fedora
10ea2891
JP
28Source4: https://src.fedoraproject.org/repo/pkgs/cargo/%{name}-%{version}-vendor.tar.xz/sha512/6ed2a1644c9b18fc24ddad5350d41b6c36cd5b62de4cf0b748a57b589f4f0ac12f91461989158d58d0892bf6fc2c1626cf574e7e2b9da4b0e35f72dfd88f9048/%{name}-%{version}-vendor.tar.xz
29# Source4-md5: bf5dd065f46ece6a0d30dbd3216508a0
416df6e1 30Patch0: x32.patch
3cb37687 31URL: https://crates.io/
fd992278 32%{!?with_bootstrap:BuildRequires: %{name} >= 0.13.0}
3cb37687
JR
33BuildRequires: cmake
34BuildRequires: gcc
35BuildRequires: rust
36# Indirect dependencies for vendored -sys crates above
37BuildRequires: curl-devel
38BuildRequires: libgit2-devel >= 0.24
39BuildRequires: libssh2-devel
40BuildRequires: openssl-devel
41BuildRequires: pkgconfig
42BuildRequires: zlib-devel
43Requires: rust
416df6e1 44ExclusiveArch: %{x8664} %{ix86} x32
7f7cc5c5 45BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
3cb37687 46
416df6e1
JR
47%ifarch x32
48%define rust_triple x86_64-unknown-linux-gnux32
49%else
8e5324db 50%define rust_triple %{_target_cpu}-unknown-linux-gnu
416df6e1 51%endif
3cb37687 52
fd992278
JR
53%if %{with bootstrap}
54%define bootstrap_root cargo-%{cargo_bootstrap}-%{rust_triple}
55%define local_cargo %{_builddir}/%{name}-%{version}/%{bootstrap_root}/cargo/bin/cargo
56%else
57%define local_cargo %{_bindir}/%{name}
58%endif
59
60# This should eventually migrate to distro policy
61# Enable optimization, debuginfo, and link hardening.
62%define rustflags -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now
63
3cb37687
JR
64%description
65Cargo is a tool that allows Rust projects to declare their various
66dependencies and ensure that you'll always get a repeatable build.
67
8e5324db
JB
68%description -l pl.UTF-8
69Cargo to narzędzie pozwalające projektom w języku Rust deklarować ich
70zależności i zapewniające powtarzalność procesu budowania.
71
72%package -n bash-completion-cargo
73Summary: Bash completion for cargo command
74Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia cargo
75Group: Applications/Shells
76Requires: %{name} = %{version}-%{release}
77Requires: bash-completion
78
79%description -n bash-completion-cargo
80Bash completion for cargo command.
81
82%description -n bash-completion-cargo -l pl.UTF-8
83Bashowe dopełnianie parametrów polecenia cargo.
84
85%package -n zsh-completion-cargo
86Summary: Zsh completion for cargo command
87Summary(pl.UTF-8): Dopełnianie parametrów polecenia cargo w powłoce Zsh
88Group: Applications/Shells
89Requires: %{name} = %{version}-%{release}
90Requires: bash-completion
91
92%description -n zsh-completion-cargo
93Zsh completion for cargo command.
94
95%description -n zsh-completion-cargo -l pl.UTF-8
96Dopełnianie parametrów polecenia cargo w powłoce Zsh.
97
3cb37687 98%prep
e1a2b912 99%setup -q -n %{name}-%{cargo_version} -a4
416df6e1
JR
100%ifarch x32
101%patch0 -p1
102%endif
103
fd992278
JR
104%if %{with bootstrap}
105%ifarch %{x8664}
106tar xf %{SOURCE2}
107%endif
108%ifarch %{ix86}
109tar xf %{SOURCE3}
110%endif
3cb37687
JR
111test -f '%{local_cargo}'
112%endif
3cb37687 113
8e5324db 114# use our offline registry
fd992278 115export CARGO_HOME="`pwd`/.cargo"
fd992278
JR
116
117mkdir -p "$CARGO_HOME"
3cb37687
JR
118cat >.cargo/config <<EOF
119[source.crates-io]
120registry = 'https://github.com/rust-lang/crates.io-index'
121replace-with = 'vendored-sources'
122
123[source.vendored-sources]
fd992278 124directory = '$PWD/vendor'
3cb37687
JR
125EOF
126
3cb37687 127%build
8e5324db
JB
128# use our offline registry and custom rustc flags
129export CARGO_HOME="`pwd`/.cargo"
130export RUSTFLAGS="%{rustflags}"
131
3cb37687
JR
132# convince libgit2-sys to use the distro libgit2
133export LIBGIT2_SYS_USE_PKG_CONFIG=1
134
e1a2b912 135%{local_cargo} build --release
3cb37687
JR
136
137%install
138rm -rf $RPM_BUILD_ROOT
fd992278 139export CARGO_HOME="`pwd`/.cargo"
3cb37687
JR
140export RUSTFLAGS="%{rustflags}"
141
e1a2b912
JR
142%{local_cargo} install --root $RPM_BUILD_ROOT%{_prefix}
143rm $RPM_BUILD_ROOT%{_prefix}/.crates.toml
3cb37687 144
e1a2b912
JR
145install -d $RPM_BUILD_ROOT%{_mandir}/man1
146install -p src%{_sysconfdir}/man/cargo*.1 $RPM_BUILD_ROOT%{_mandir}/man1
3cb37687 147
e1a2b912
JR
148install -p src%{_sysconfdir}/cargo.bashcomp.sh \
149 -D $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/cargo
3cb37687 150
e1a2b912
JR
151install -p src%{_sysconfdir}/_cargo \
152 -D $RPM_BUILD_ROOT%{zsh_compdir}/_cargo
3cb37687
JR
153
154# Create the path for crate-devel packages
155install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
156
157%clean
158rm -rf $RPM_BUILD_ROOT
159
160%files
161%defattr(644,root,root,755)
8e5324db 162%doc LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY README.md
3cb37687
JR
163%attr(755,root,root) %{_bindir}/cargo
164%{_mandir}/man1/cargo*.1*
3cb37687
JR
165%dir %{_datadir}/cargo
166%dir %{_datadir}/cargo/registry
8e5324db
JB
167
168%files -n bash-completion-cargo
169%defattr(644,root,root,755)
170%{_sysconfdir}/bash_completion.d/cargo
171
172%files -n zsh-completion-cargo
173%defattr(644,root,root,755)
174%{zsh_compdir}/_cargo
This page took 0.140848 seconds and 4 git commands to generate.