[vlc-devel] [PATCHv3 4/7] contrib: add cargo
Thomas Guillem
thomas at gllm.fr
Thu Aug 27 16:44:18 CEST 2020
From: Kartik Ohri <kartikohri13 at gmail.com>
This will install rustup, cargo, and cargo-c into contrib/bin/.cargo
This installation will be used by default for all rust contrib builds.
The correct cargo target will be automatically installed when needed.
---
contrib/src/cargo/SHA512SUMS | 1 +
contrib/src/cargo/rules.mak | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+)
create mode 100644 contrib/src/cargo/SHA512SUMS
create mode 100644 contrib/src/cargo/rules.mak
diff --git a/contrib/src/cargo/SHA512SUMS b/contrib/src/cargo/SHA512SUMS
new file mode 100644
index 00000000000..6101c68ba6c
--- /dev/null
+++ b/contrib/src/cargo/SHA512SUMS
@@ -0,0 +1 @@
+14a978a3cf699956722d8443070b9f8a043f1252cc1a7ed300b14637a0e6d654f34088d4403790c676500cbab327e30fdb7f81be0b9bde29e552143f26912ac7 rustup-1.22.1.tar.gz
diff --git a/contrib/src/cargo/rules.mak b/contrib/src/cargo/rules.mak
new file mode 100644
index 00000000000..00060356a22
--- /dev/null
+++ b/contrib/src/cargo/rules.mak
@@ -0,0 +1,26 @@
+# cargo/cargo-c installation via rustup
+
+RUSTUP_VERSION=1.22.1
+RUSTUP_URL=https://github.com/rust-lang/rustup/archive/$(RUSTUP_VERSION).tar.gz
+
+RUSTUP = RUSTUP_HOME=$(CARGO_HOME) $(CARGO_HOME)/bin/rustup
+
+$(TARBALLS)/rustup-$(RUSTUP_VERSION).tar.gz:
+ $(call download_pkg,$(RUSTUP_URL),rustup)
+
+.sum-cargo: rustup-$(RUSTUP_VERSION).tar.gz
+
+rustup: rustup-$(RUSTUP_VERSION).tar.gz .sum-cargo
+ $(UNPACK)
+ $(MOVE)
+
+# When needed (when we have a Rust dependency not using cargo-c), the cargo-c
+# installation should go in a different package
+.cargo: rustup
+ cd $< && RUSTUP_INIT_SKIP_PATH_CHECK=yes \
+ RUSTUP_HOME=$(CARGO_HOME) CARGO_HOME=$(CARGO_HOME) \
+ ./rustup-init.sh --no-modify-path -y
+ $(RUSTUP) target add $(RUST_TARGET)
+ $(RUSTUP) default stable
+ $(CARGO) install cargo-c
+ touch $@
--
2.28.0
More information about the vlc-devel
mailing list