[vlc-commits] contrib: add cargo

Kartik Ohri git at videolan.org
Thu Sep 10 12:43:21 CEST 2020


vlc | branch: master | Kartik Ohri <kartikohri13 at gmail.com> | Tue Aug 25 15:09:28 2020 +0200| [de0c1fb1c94d8a60142f397e1c6250a2eb142109] | committer: Thomas Guillem

contrib: add cargo

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.

Co-Authored-By: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=de0c1fb1c94d8a60142f397e1c6250a2eb142109
---

 contrib/src/cargo/SHA512SUMS |  1 +
 contrib/src/cargo/rules.mak  | 28 ++++++++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/contrib/src/cargo/SHA512SUMS b/contrib/src/cargo/SHA512SUMS
new file mode 100644
index 0000000000..6101c68ba6
--- /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 0000000000..f634ae60eb
--- /dev/null
+++ b/contrib/src/cargo/rules.mak
@@ -0,0 +1,28 @@
+# 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 = . $(CARGO_HOME)/env && \
+	RUSTUP_HOME=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) 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=$(RUSTUP_HOME) CARGO_HOME=$(CARGO_HOME) \
+	  ./rustup-init.sh --no-modify-path -y
+	$(RUSTUP) default stable
+	$(RUSTUP) target add $(RUST_TARGET)
+	unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH CFLAGS CPPFLAGS LDFLAGS; \
+		$(CARGO) install cargo-c
+	touch $@



More information about the vlc-commits mailing list