]> git.pld-linux.org Git - packages/cargo.git/blame - cargo.spec
- release 2 (by relup.sh)
[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
e1a2b912 12Version: 0.22.0
146558fb 13Release: 2
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
e1a2b912
JR
17# Source0-md5: 3a781687f7ac248d83efc4cfa642a260
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!
fd992278 27Source4: %{name}-%{version}-vendor.tar.xz
e1a2b912 28# Source4-md5: 0e0595ee6ced6164052633df6a8a9eab
3cb37687 29URL: https://crates.io/
fd992278 30%{!?with_bootstrap:BuildRequires: %{name} >= 0.13.0}
3cb37687
JR
31BuildRequires: cmake
32BuildRequires: gcc
33BuildRequires: rust
34# Indirect dependencies for vendored -sys crates above
35BuildRequires: curl-devel
36BuildRequires: libgit2-devel >= 0.24
37BuildRequires: libssh2-devel
38BuildRequires: openssl-devel
39BuildRequires: pkgconfig
40BuildRequires: zlib-devel
41Requires: rust
fd992278 42ExclusiveArch: %{x8664} %{ix86}
7f7cc5c5 43BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
3cb37687 44
8e5324db 45%define rust_triple %{_target_cpu}-unknown-linux-gnu
3cb37687 46
fd992278
JR
47%if %{with bootstrap}
48%define bootstrap_root cargo-%{cargo_bootstrap}-%{rust_triple}
49%define local_cargo %{_builddir}/%{name}-%{version}/%{bootstrap_root}/cargo/bin/cargo
50%else
51%define local_cargo %{_bindir}/%{name}
52%endif
53
54# This should eventually migrate to distro policy
55# Enable optimization, debuginfo, and link hardening.
56%define rustflags -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now
57
3cb37687
JR
58%description
59Cargo is a tool that allows Rust projects to declare their various
60dependencies and ensure that you'll always get a repeatable build.
61
8e5324db
JB
62%description -l pl.UTF-8
63Cargo to narzędzie pozwalające projektom w języku Rust deklarować ich
64zależności i zapewniające powtarzalność procesu budowania.
65
66%package -n bash-completion-cargo
67Summary: Bash completion for cargo command
68Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia cargo
69Group: Applications/Shells
70Requires: %{name} = %{version}-%{release}
71Requires: bash-completion
72
73%description -n bash-completion-cargo
74Bash completion for cargo command.
75
76%description -n bash-completion-cargo -l pl.UTF-8
77Bashowe dopełnianie parametrów polecenia cargo.
78
79%package -n zsh-completion-cargo
80Summary: Zsh completion for cargo command
81Summary(pl.UTF-8): Dopełnianie parametrów polecenia cargo w powłoce Zsh
82Group: Applications/Shells
83Requires: %{name} = %{version}-%{release}
84Requires: bash-completion
85
86%description -n zsh-completion-cargo
87Zsh completion for cargo command.
88
89%description -n zsh-completion-cargo -l pl.UTF-8
90Dopełnianie parametrów polecenia cargo w powłoce Zsh.
91
3cb37687 92%prep
e1a2b912 93%setup -q -n %{name}-%{cargo_version} -a4
fd992278
JR
94%if %{with bootstrap}
95%ifarch %{x8664}
96tar xf %{SOURCE2}
97%endif
98%ifarch %{ix86}
99tar xf %{SOURCE3}
100%endif
3cb37687
JR
101test -f '%{local_cargo}'
102%endif
3cb37687 103
8e5324db 104# use our offline registry
fd992278 105export CARGO_HOME="`pwd`/.cargo"
fd992278
JR
106
107mkdir -p "$CARGO_HOME"
3cb37687
JR
108cat >.cargo/config <<EOF
109[source.crates-io]
110registry = 'https://github.com/rust-lang/crates.io-index'
111replace-with = 'vendored-sources'
112
113[source.vendored-sources]
fd992278 114directory = '$PWD/vendor'
3cb37687
JR
115EOF
116
3cb37687 117%build
8e5324db
JB
118# use our offline registry and custom rustc flags
119export CARGO_HOME="`pwd`/.cargo"
120export RUSTFLAGS="%{rustflags}"
121
3cb37687
JR
122# convince libgit2-sys to use the distro libgit2
123export LIBGIT2_SYS_USE_PKG_CONFIG=1
124
e1a2b912 125%{local_cargo} build --release
3cb37687
JR
126
127%install
128rm -rf $RPM_BUILD_ROOT
fd992278 129export CARGO_HOME="`pwd`/.cargo"
3cb37687
JR
130export RUSTFLAGS="%{rustflags}"
131
e1a2b912
JR
132%{local_cargo} install --root $RPM_BUILD_ROOT%{_prefix}
133rm $RPM_BUILD_ROOT%{_prefix}/.crates.toml
3cb37687 134
e1a2b912
JR
135install -d $RPM_BUILD_ROOT%{_mandir}/man1
136install -p src%{_sysconfdir}/man/cargo*.1 $RPM_BUILD_ROOT%{_mandir}/man1
3cb37687 137
e1a2b912
JR
138install -p src%{_sysconfdir}/cargo.bashcomp.sh \
139 -D $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/cargo
3cb37687 140
e1a2b912
JR
141install -p src%{_sysconfdir}/_cargo \
142 -D $RPM_BUILD_ROOT%{zsh_compdir}/_cargo
3cb37687
JR
143
144# Create the path for crate-devel packages
145install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
146
147%clean
148rm -rf $RPM_BUILD_ROOT
149
150%files
151%defattr(644,root,root,755)
8e5324db 152%doc LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY README.md
3cb37687
JR
153%attr(755,root,root) %{_bindir}/cargo
154%{_mandir}/man1/cargo*.1*
3cb37687
JR
155%dir %{_datadir}/cargo
156%dir %{_datadir}/cargo/registry
8e5324db
JB
157
158%files -n bash-completion-cargo
159%defattr(644,root,root,755)
160%{_sysconfdir}/bash_completion.d/cargo
161
162%files -n zsh-completion-cargo
163%defattr(644,root,root,755)
164%{zsh_compdir}/_cargo
This page took 0.121758 seconds and 4 git commands to generate.