commit 90d6d73c73222730aa563a96413ee3d17fd3707f
Author: Elan Ruusamäe <[email protected]>
Date:   Wed Mar 17 16:08:02 2021 +0200

    Add rust template with crate vendoring example

 rust.spec | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
---
diff --git a/rust.spec b/rust.spec
new file mode 100644
index 0000000..cbaecb8
--- /dev/null
+++ b/rust.spec
@@ -0,0 +1,58 @@
+Summary:       Template to show how to vendor crates
+Name:          rust-crate-template
+Version:       1.0
+Release:       0.1
+License:       Apache v2.0
+Group:         Applications
+Source0:       
https://github.com/NAME/NAME/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5: 959298871877c4a50e8e2789d23530c7
+# cd NAME-%{version}
+# cargo vendor
+# cd ..
+# tar cJf NAME-crates-%{version}.tar.xz NAME-%{version}/{vendor,Cargo.lock}
+Source1:       %{name}-crates-%{version}.tar.xz
+# Source1-md5: -
+URL:           -
+BuildRequires: cargo
+BuildRequires: rust
+BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+
+%prep
+%setup -q
+
+# Use our offline registry
+export CARGO_HOME="$(pwd)/.cargo"
+
+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/vendor'
+EOF
+
+%build
+export CARGO_HOME="$(pwd)/.cargo"
+
+cargo -v build \
+%ifarch x32
+       --target x86_64-unknown-linux-gnux32 \
+%endif
+       --release \
+       --frozen
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT%{_bindir}
+cp -p target/release/* $RPM_BUILD_ROOT%{_bindir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/*
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/template-specs.git/commitdiff/26ddd9b2e6ad734472f6aafa400d8b4ae7ffd0e6

_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to