From 696ff53abe9e9c7f7913c4052c4edbf650e72b33 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Thu, 13 Apr 2023 21:40:40 +0200 Subject: [PATCH] Fix rpm-sequoia.pc generation - Don't fix the dependency to `nettle`. The required libraries depend on the configured backend. Substitute the appropriate dependencies based on the configured backend at build time. - Fixes #36. --- build.rs | 16 ++++++++++++++++ rpm-sequoia.pc.in | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 3a2c092..13c3ab9 100644 --- a/build.rs +++ b/build.rs @@ -29,6 +29,22 @@ impl PkgConfigTemplate { ("DESCRIPTION".to_string(), env!("CARGO_PKG_DESCRIPTION").to_string()), ("VERSION".to_string(), env!("CARGO_PKG_VERSION").to_string()), ("HOMEPAGE".to_string(), env!("CARGO_PKG_HOMEPAGE").to_string()), + ("REQUIRES".to_string(), + if cfg!(feature = "crypto-botan") { + "botan-2" + } else if cfg!(feature = "crypto-nettle") { + "nettle" + } else if cfg!(feature = "crypto-openssl") { + "libssl" + } else if cfg!(feature = "crypto-cng") { + "" + } else if cfg!(feature = "crypto-rust") { + "" + } else { + panic!("No cryptographic backend selected. Try: \ + \"cargo build --no-default-features \ + --features crypto-openssl\"") + }.to_string()), ]); Ok(PkgConfigTemplate { diff --git a/rpm-sequoia.pc.in b/rpm-sequoia.pc.in index 64f7b93..28fe3dd 100644 --- a/rpm-sequoia.pc.in +++ b/rpm-sequoia.pc.in @@ -5,6 +5,6 @@ Name: @NAME@ Description: @DESCRIPTION@ URL: @HOMEPAGE@ Version: @VERSION@ -Requires.private: nettle +Requires.private: @REQUIRES@ Cflags: Libs: -L${libdir} -lrpm_sequoia