From: Jan Rękorajski Date: Mon, 26 Jun 2017 20:31:33 +0000 (+0200) Subject: - imported from fedora, needs a lot of love X-Git-Tag: auto/th/cargo-0.19.0-0.1~2 X-Git-Url: http://git.pld-linux.org/?p=packages%2Fcargo.git;a=commitdiff_plain;h=3cb37687273a6cde6adda1032e2b5969c356ab82 - imported from fedora, needs a lot of love --- 3cb37687273a6cde6adda1032e2b5969c356ab82 diff --git a/cargo.spec b/cargo.spec new file mode 100644 index 0000000..80bbaf2 --- /dev/null +++ b/cargo.spec @@ -0,0 +1,139 @@ +# Only x86_64 and i686 are Tier 1 platforms at this time. +# https://forge.rust-lang.org/platform-support.html +%define rust_arches x86_64 i686 armv7hl aarch64 ppc64 ppc64le s390x + +# Only the specified arches will use bootstrap binaries. +#define bootstrap_arches %%{rust_arches} + +%define cargo_version %{version} +%define cargo_bootstrap 0.18.0 + +Summary: Rust's package manager and build tool +Name: cargo +Version: 0.19.0 +Release: 0.1 +License: ASL 2.0 or MIT +Source0: https://github.com/rust-lang/cargo/archive/%{cargo_version}/%{name}-%{cargo_version}.tar.gz +# 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 + +# Use vendored crate dependencies so we can build offline. +# Created using https://github.com/alexcrichton/cargo-vendor/ 0.1.7 +# 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! +Source100: %{name}-%{version}-vendor.tar.xz + +URL: https://crates.io/ +%ifarch %{bootstrap_arches} +%define bootstrap_root cargo-%{cargo_bootstrap}-%{rust_triple} +%define local_cargo %{_builddir}/%{bootstrap_root}/cargo/bin/cargo +%else +BuildRequires: %{name} >= 0.13.0 +%define local_cargo %{_bindir}/%{name} +%endif + +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: rust +# Indirect dependencies for vendored -sys crates above +BuildRequires: curl-devel +BuildRequires: libgit2-devel >= 0.24 +BuildRequires: libssh2-devel +BuildRequires: openssl-devel +BuildRequires: pkgconfig +BuildRequires: zlib-devel +Requires: rust +ExclusiveArch: %{rust_arches} + +%define rust_triple %{_target_cpu}-unknown-linux-gnu + +%description +Cargo is a tool that allows Rust projects to declare their various +dependencies and ensure that you'll always get a repeatable build. + +%prep +%ifarch %{bootstrap_arches} +%setup -q -n %{bootstrap_root} -T -b %{bootstrap_source} +test -f '%{local_cargo}' +%endif + +# vendored crates +%setup -q -n %{name}-%{version}-vendor -T -b 100 + +# cargo sources +%setup -q -n %{name}-%{cargo_version} + +# rust-installer +%setup -q -n %{name}-%{cargo_version} -T -D -a 1 +rmdir src/rust-installer +mv rust-installer-%{rust_installer} src/rust-installer + +# define the offline registry +%define cargo_home $PWD/.cargo +mkdir -p %{cargo_home} +cat >.cargo/config <