+# NOTE: for versions >= 0.29 see rust.spec
#
# Conditional build:
-%bcond_with bootstrap
+%bcond_with bootstrap # bootstrap using precompiled binaries
%bcond_without tests # build without tests
-%define cargo_version %{version}
-%define cargo_bootstrap 0.18.0
+%define cargo_version %{version}
+%define cargo_bootstrap 0.18.0
Summary: Rust's package manager and build tool
+Summary(pl.UTF-8): Zarządca pakietów i narzędzie do budowania
Name: cargo
-Version: 0.19.0
-Release: 1
-License: ASL 2.0 or MIT
-Group: Development/Libraries
+Version: 0.26.0
+Release: 3.1
+License: Apache v2.0 or MIT
+Group: Development/Tools
Source0: https://github.com/rust-lang/cargo/archive/%{cargo_version}/%{name}-%{cargo_version}.tar.gz
-# Source0-md5: e46e9f565df765b63f641c0d933297d7
-# submodule, bundled for local installation only, not distributed
-%define rust_installer 4f994850808a572e2cc8d43f968893c8e942e9bf
-Source1: https://github.com/rust-lang/rust-installer/archive/%{rust_installer}/rust-installer-%{rust_installer}.tar.gz
-# Source1-md5: a222edd3ab08779f527aafe862207027
-Source2: https://static.rust-lang.org/dist/cargo-%{cargo_bootstrap}-x86_64-unknown-linux-gnu.tar.gz
+# Source0-md5: 9929f01186583c5c9f01b587356a7c92
+Source2: https://static.rust-lang.org/dist/%{name}-%{cargo_bootstrap}-x86_64-unknown-linux-gnu.tar.gz
# Source2-md5: d2cbab6378c1f60b483efa0f076a8f81
-Source3: https://static.rust-lang.org/dist/cargo-%{cargo_bootstrap}-i686-unknown-linux-gnu.tar.gz
+Source3: https://static.rust-lang.org/dist/%{name}-%{cargo_bootstrap}-i686-unknown-linux-gnu.tar.gz
# Source3-md5: 1ad24c241a2f5e3c4bf83855766fab35
# Use vendored crate dependencies so we can build offline.
-# Created using https://github.com/alexcrichton/cargo-vendor/ 0.1.7
+# Created using https://github.com/alexcrichton/cargo-vendor/ 0.1.13
# It's so big because some of the -sys crates include the C library source they
# want to link to. With our -devel buildreqs in place, they'll be used instead.
# FIXME: These should all eventually be packaged on their own!
-Source4: %{name}-%{version}-vendor.tar.xz
-# Source4-md5: c8025d6ba2aa668c0bafc468ec354630
-Patch0: use-system-libgit2.patch
+# PLD: using sources vendored by Fedora
+Source4: https://src.fedoraproject.org/repo/pkgs/cargo/%{name}-%{version}-vendor.tar.xz/sha512/6ed2a1644c9b18fc24ddad5350d41b6c36cd5b62de4cf0b748a57b589f4f0ac12f91461989158d58d0892bf6fc2c1626cf574e7e2b9da4b0e35f72dfd88f9048/%{name}-%{version}-vendor.tar.xz
+# Source4-md5: bf5dd065f46ece6a0d30dbd3216508a0
+Patch0: x32.patch
+Patch1: build_fix.patch
+Patch2: %{name}-url-buildfix.patch
URL: https://crates.io/
%{!?with_bootstrap:BuildRequires: %{name} >= 0.13.0}
BuildRequires: cmake
BuildRequires: pkgconfig
BuildRequires: zlib-devel
Requires: rust
-ExclusiveArch: %{x8664} %{ix86}
+ExclusiveArch: %{x8664} %{ix86} x32
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define rust_triple %{_target_cpu}-unknown-linux-gnu
+%ifarch x32
+%define rust_triple x86_64-unknown-linux-gnux32
+%else
+%define rust_triple %{_target_cpu}-unknown-linux-gnu
+%endif
%if %{with bootstrap}
%define bootstrap_root cargo-%{cargo_bootstrap}-%{rust_triple}
Cargo is a tool that allows Rust projects to declare their various
dependencies and ensure that you'll always get a repeatable build.
+%description -l pl.UTF-8
+Cargo to narzędzie pozwalające projektom w języku Rust deklarować ich
+zależności i zapewniające powtarzalność procesu budowania.
+
+%package -n bash-completion-cargo
+Summary: Bash completion for cargo command
+Summary(pl.UTF-8): Bashowe dopełnianie parametrów polecenia cargo
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: bash-completion
+
+%description -n bash-completion-cargo
+Bash completion for cargo command.
+
+%description -n bash-completion-cargo -l pl.UTF-8
+Bashowe dopełnianie parametrów polecenia cargo.
+
+%package -n zsh-completion-cargo
+Summary: Zsh completion for cargo command
+Summary(pl.UTF-8): Dopełnianie parametrów polecenia cargo w powłoce Zsh
+Group: Applications/Shells
+Requires: %{name} = %{version}-%{release}
+Requires: bash-completion
+
+%description -n zsh-completion-cargo
+Zsh completion for cargo command.
+
+%description -n zsh-completion-cargo -l pl.UTF-8
+Dopełnianie parametrów polecenia cargo w powłoce Zsh.
+
%prep
-%setup -q -n %{name}-%{cargo_version} -a1 -a4
+%setup -q -n %{name}-%{cargo_version} -a4
+%ifarch x32
+%patch0 -p1
+%endif
+
+%patch1 -p1
+%patch2 -p1
+
%if %{with bootstrap}
%ifarch %{x8664}
tar xf %{SOURCE2}
%endif
test -f '%{local_cargo}'
%endif
-%patch0 -p1
-rmdir src/rust-installer
-mv rust-installer-%{rust_installer} src/rust-installer
-
-# use our offline registry and custom rustc flags
+# use our offline registry
export CARGO_HOME="`pwd`/.cargo"
-export RUSTFLAGS="%{rustflags}"
mkdir -p "$CARGO_HOME"
cat >.cargo/config <<EOF
EOF
%build
+# use our offline registry and custom rustc flags
+export CARGO_HOME="`pwd`/.cargo"
+export RUSTFLAGS="%{rustflags}"
+
# convince libgit2-sys to use the distro libgit2
export LIBGIT2_SYS_USE_PKG_CONFIG=1
-%configure \
- --disable-option-checking \
- --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
- --rustc=%{_bindir}/rustc --rustdoc=%{_bindir}/rustdoc \
- --cargo=%{local_cargo} \
- --release-channel=stable \
- --disable-cross-tests
-
-%{__make}
+%{local_cargo} build --release
%install
rm -rf $RPM_BUILD_ROOT
export CARGO_HOME="`pwd`/.cargo"
export RUSTFLAGS="%{rustflags}"
-%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT
+%{local_cargo} install --root $RPM_BUILD_ROOT%{_prefix}
+rm $RPM_BUILD_ROOT%{_prefix}/.crates.toml
-# Remove installer artifacts (manifests, uninstall scripts, etc.)
-rm -rv $RPM_BUILD_ROOT%{_prefix}/lib/
+install -d $RPM_BUILD_ROOT%{_mandir}/man1
+install -p src%{_sysconfdir}/man/cargo*.1 $RPM_BUILD_ROOT%{_mandir}/man1
-# Fix the etc/ location
-mv -v $RPM_BUILD_ROOT%{_prefix}/%{_sysconfdir} $RPM_BUILD_ROOT%{_sysconfdir}
+install -p src%{_sysconfdir}/cargo.bashcomp.sh \
+ -D $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d/cargo
-# Remove unwanted documentation files (we already package them)
-rm -r $RPM_BUILD_ROOT%{_docdir}/%{name}/
+install -p src%{_sysconfdir}/_cargo \
+ -D $RPM_BUILD_ROOT%{zsh_compdir}/_cargo
# Create the path for crate-devel packages
install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
%files
%defattr(644,root,root,755)
-%doc LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY
-%doc README.md
+%doc LICENSE-APACHE LICENSE-MIT LICENSE-THIRD-PARTY README.md
%attr(755,root,root) %{_bindir}/cargo
%{_mandir}/man1/cargo*.1*
-%{_sysconfdir}/bash_completion.d/cargo
-#%{zsh_compdir}/_cargo
%dir %{_datadir}/cargo
%dir %{_datadir}/cargo/registry
+
+%files -n bash-completion-cargo
+%defattr(644,root,root,755)
+%{_sysconfdir}/bash_completion.d/cargo
+
+%files -n zsh-completion-cargo
+%defattr(644,root,root,755)
+%{zsh_compdir}/_cargo