diff options
author | Robin Krahl <robin.krahl@ireas.org> | 2018-12-31 19:14:59 +0000 |
---|---|---|
committer | Robin Krahl <robin.krahl@ireas.org> | 2018-12-31 20:20:11 +0100 |
commit | a47058981611bacae464ed6deac39c6686357f3a (patch) | |
tree | 706d79dceed453fb3e7b86072b6d806c676615ef | |
parent | b529221df29450412b01d8514df93a059fec8104 (diff) | |
download | nitrokey-sys-rs-a47058981611bacae464ed6deac39c6686357f3a.tar.gz nitrokey-sys-rs-a47058981611bacae464ed6deac39c6686357f3a.tar.bz2 |
Link to hidapi on non-Linux systems
According to the hidapi README [0], only Linux provides two different
hidapi backends. Therefore this patch changes the build script to
default to linking to hidapi on non-Linux systems.
This patch fixes the macOS build issue reported by Philippe Normand and
is based on the patch proposed by Philippe Normand at [1].
[0] https://github.com/signal11/hidapi/blob/master/README.txt
[1] https://github.com/d-e-s-o/nitrocli/pull/42
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | build.rs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 492afa0..26f88a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Unreleased - Use the -std=c++14 compiler flag. +- Change the build script to link to `-lhidapi` on non-Linux operating systems + (while still using `-lhidapi-libusb` on Linux). # v3.4.1 (2018-12-10) @@ -101,5 +101,10 @@ fn main() { .file(version_source) .compile("libnitrokey.a"); - println!("cargo:rustc-link-lib=hidapi-libusb"); + let hidapi_library_name = if cfg!(target_os = "linux") { + "hidapi-libusb" + } else { + "hidapi" + }; + println!("cargo:rustc-link-lib={}", hidapi_library_name); } |