]> git.pld-linux.org Git - packages/cargo.git/commitdiff
- cleaned up, seems building
authorJan Rękorajski <baggins@pld-linux.org>
Tue, 27 Jun 2017 18:59:29 +0000 (20:59 +0200)
committerJan Rękorajski <baggins@pld-linux.org>
Tue, 27 Jun 2017 18:59:29 +0000 (20:59 +0200)
cargo.spec
use-system-libgit2.patch [new file with mode: 0644]

index 80bbaf2e87cb23d0185261cb35612f45ef676495..81e346e23baac993804571a2d34c97c399e41bee 100644 (file)
@@ -1,9 +1,7 @@
-# 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}
+#
+# Conditional build:
+%bcond_with    bootstrap
+%bcond_without tests           # build without tests
 
 %define cargo_version %{version}
 %define cargo_bootstrap 0.18.0
@@ -13,27 +11,27 @@ Name:               cargo
 Version:       0.19.0
 Release:       0.1
 License:       ASL 2.0 or MIT
+Group:         Development/Libraries
 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
+# Source2-md5: d2cbab6378c1f60b483efa0f076a8f81
+Source3:       https://static.rust-lang.org/dist/cargo-%{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
 # 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
-
+Source4:       %{name}-%{version}-vendor.tar.xz
+# Source4-md5: c8025d6ba2aa668c0bafc468ec354630
+Patch0:                use-system-libgit2.patch
 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
-
+%{!?with_bootstrap:BuildRequires:      %{name} >= 0.13.0}
 BuildRequires: cmake
 BuildRequires: gcc
 BuildRequires: rust
@@ -45,55 +43,59 @@ BuildRequires:      openssl-devel
 BuildRequires: pkgconfig
 BuildRequires: zlib-devel
 Requires:      rust
-ExclusiveArch: %{rust_arches}
+ExclusiveArch: %{x8664} %{ix86}
 
 %define rust_triple %{_target_cpu}-unknown-linux-gnu
 
+%if %{with bootstrap}
+%define                bootstrap_root  cargo-%{cargo_bootstrap}-%{rust_triple}
+%define                local_cargo     %{_builddir}/%{name}-%{version}/%{bootstrap_root}/cargo/bin/cargo
+%else
+%define                local_cargo     %{_bindir}/%{name}
+%endif
+
+# This should eventually migrate to distro policy
+# Enable optimization, debuginfo, and link hardening.
+%define                rustflags       -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now
+
 %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}
+%setup -q -n %{name}-%{cargo_version} -a1 -a4
+%if %{with bootstrap}
+%ifarch %{x8664}
+tar xf %{SOURCE2}
+%endif
+%ifarch %{ix86}
+tar xf %{SOURCE3}
+%endif
 test -f '%{local_cargo}'
 %endif
+%patch0 -p1
 
-# 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}
+# use our offline registry and custom rustc flags
+export CARGO_HOME="`pwd`/.cargo"
+export RUSTFLAGS="%{rustflags}"
+
+mkdir -p "$CARGO_HOME"
 cat >.cargo/config <<EOF
 [source.crates-io]
 registry = 'https://github.com/rust-lang/crates.io-index'
 replace-with = 'vendored-sources'
 
 [source.vendored-sources]
-directory = '$PWD/../%{name}-%{version}-vendor'
+directory = '$PWD/vendor'
 EOF
 
-# This should eventually migrate to distro policy
-# Enable optimization, debuginfo, and link hardening.
-%define rustflags -Copt-level=3 -Cdebuginfo=2 -Clink-arg=-Wl,-z,relro,-z,now
-
 %build
 # convince libgit2-sys to use the distro libgit2
 export LIBGIT2_SYS_USE_PKG_CONFIG=1
 
-# use our offline registry and custom rustc flags
-export CARGO_HOME="%{cargo_home}"
-export RUSTFLAGS="%{rustflags}"
-
 %configure \
        --disable-option-checking \
        --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
@@ -106,7 +108,7 @@ export RUSTFLAGS="%{rustflags}"
 
 %install
 rm -rf $RPM_BUILD_ROOT
-export CARGO_HOME="%{cargo_home}"
+export CARGO_HOME="`pwd`/.cargo"
 export RUSTFLAGS="%{rustflags}"
 
 %{__make} install \
@@ -119,7 +121,7 @@ rm -rv $RPM_BUILD_ROOT%{_prefix}/lib/
 mv -v $RPM_BUILD_ROOT%{_prefix}/%{_sysconfdir} $RPM_BUILD_ROOT%{_sysconfdir}
 
 # Remove unwanted documentation files (we already package them)
-rm -rf $RPM_BUILD_ROOT%{_docdir}/%{name}/
+rm -r $RPM_BUILD_ROOT%{_docdir}/%{name}/
 
 # Create the path for crate-devel packages
 install -d $RPM_BUILD_ROOT%{_datadir}/cargo/registry
diff --git a/use-system-libgit2.patch b/use-system-libgit2.patch
new file mode 100644 (file)
index 0000000..89d18b9
--- /dev/null
@@ -0,0 +1,26 @@
+Description: Always use system libgit2
+Author: Ximin Luo <infinity0@debian.org>
+Forwarded: not-needed
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- a/vendor/libgit2-sys-0.6.7/build.rs
++++ b/vendor/libgit2-sys-0.6.7/build.rs
+@@ -31,10 +31,8 @@
+     }
+     let has_pkgconfig = Command::new("pkg-config").output().is_ok();
+-    if env::var("LIBGIT2_SYS_USE_PKG_CONFIG").is_ok() {
+-        if pkg_config::find_library("libgit2").is_ok() {
+-            return
+-        }
++    if pkg_config::find_library("libgit2").is_ok() {
++        return
+     }
+     if !Path::new("libgit2/.git").exists() {
+--- a/vendor/libgit2-sys-0.6.7/.cargo-checksum.json
++++ b/vendor/libgit2-sys-0.6.7/.cargo-checksum.json
+@@ -1 +1 @@
+-{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"c318824e037626c1e2574afbe8d33d6a31ad9a7c9179dd81ac06ce4b16a1de98","build.rs":"32f1614473508047c68a95977074c32a41fafb7f08b26f9d5dd937576ecc594f","lib.rs":"427ae51eeab835af5bd1fc26f9b2eaad1f9fd58671ec080eb9def921dcfe2420"},"package":"d951fd5eccae07c74e8c2c1075b05ea1e43be7f8952245af8c2840d1480b1d95"}
+\ No newline at end of file
++{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"c318824e037626c1e2574afbe8d33d6a31ad9a7c9179dd81ac06ce4b16a1de98","build.rs":"7006deca0e11974227326174088500df8f7d1708839378edfd242a11ed7f18c9","lib.rs":"427ae51eeab835af5bd1fc26f9b2eaad1f9fd58671ec080eb9def921dcfe2420"},"package":"d951fd5eccae07c74e8c2c1075b05ea1e43be7f8952245af8c2840d1480b1d95"}
This page took 0.133976 seconds and 4 git commands to generate.