[vlc-devel] [PATCHv4 06/12] contrib: cargo: use cargo/vendored-openssl if needed

Thomas Guillem thomas at gllm.fr
Tue Sep 8 14:13:35 CEST 2020


---
 contrib/src/cargo/rules.mak | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/contrib/src/cargo/rules.mak b/contrib/src/cargo/rules.mak
index f634ae60eb9..c25e3a25441 100644
--- a/contrib/src/cargo/rules.mak
+++ b/contrib/src/cargo/rules.mak
@@ -15,6 +15,16 @@ rustup: rustup-$(RUSTUP_VERSION).tar.gz .sum-cargo
 	$(UNPACK)
 	$(MOVE)
 
+# Test if we can use the host libssl library
+ifeq ($(shell unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH; \
+	pkg-config "openssl >= 1.0.1" 2>/dev/null || \
+	pkg-config "libssl >= 2.5" 2>/dev/null || echo FAIL),)
+CARGOC_FEATURES=
+else
+# Otherwise, let cargo build and statically link its own openssl
+CARGOC_FEATURES="--features=cargo/vendored-openssl"
+endif
+
 # When needed (when we have a Rust dependency not using cargo-c), the cargo-c
 # installation should go in a different package
 .cargo: rustup
@@ -24,5 +34,5 @@ rustup: rustup-$(RUSTUP_VERSION).tar.gz .sum-cargo
 	$(RUSTUP) default stable
 	$(RUSTUP) target add $(RUST_TARGET)
 	unset PKG_CONFIG_LIBDIR PKG_CONFIG_PATH CFLAGS CPPFLAGS LDFLAGS; \
-		$(CARGO) install cargo-c
+		$(CARGO) install $(CARGOC_FEATURES) cargo-c
 	touch $@
-- 
2.28.0



More information about the vlc-devel mailing list