From ac208ecf02d8a623b280071f34480bcf73741bec Mon Sep 17 00:00:00 2001 From: Federico Terzi Date: Sat, 6 Nov 2021 10:02:47 +0100 Subject: [PATCH] fix(modulo): check for 'wx-config-gtk3' command as well on Linux. Fix #840 --- espanso-modulo/build.rs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/espanso-modulo/build.rs b/espanso-modulo/build.rs index 86bc21d..53a995b 100644 --- a/espanso-modulo/build.rs +++ b/espanso-modulo/build.rs @@ -420,15 +420,26 @@ fn macos_link_search_path() -> Option { #[cfg(target_os = "linux")] fn build_native() { // Make sure wxWidgets is installed - if std::process::Command::new("wx-config") + // Depending on the installation package, the 'wx-config' command might also be available as 'wx-config-gtk3', + // so we need to check for both. + // See also: https://github.com/federico-terzi/espanso/issues/840 + let wx_config_command = if std::process::Command::new("wx-config") .arg("--version") .output() - .is_err() + .is_ok() { - panic!("wxWidgets is not installed, as `wx-config` cannot be exectued") - } + "wx-config" + } else if std::process::Command::new("wx-config-gtk3") + .arg("--version") + .output() + .is_ok() + { + "wx-config-gtk3" + } else { + panic!("wxWidgets is not installed, as `wx-config` cannot be executed") + }; - let config_path = PathBuf::from("wx-config"); + let config_path = PathBuf::from(wx_config_command); let cpp_flags = get_cpp_flags(&config_path); let mut build = cc::Build::new();