Skip to content

Commit

Permalink
Added changes already mentioned in avast#67
Browse files Browse the repository at this point in the history
  • Loading branch information
3c7 committed Jan 2, 2024
1 parent 16b5bfc commit 6bc8d9b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions yari-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ fn link_linux() {
link_lib("z");
}

#[cfg(target_os = "macos")]
fn link_macos() {
println!("cargo:rustc-link-lib=static=yara");
link_lib("crypto");
link_lib("magic");
link_lib("jansson");
link_lib("z");
}

fn main() {
let ignored_macros = IgnoreMacros(
vec![
Expand All @@ -60,6 +69,9 @@ fn main() {
#[cfg(target_os = "linux")]
link_linux();

#[cfg(target_os = "macos")]
link_macos();

#[cfg(target_os = "windows")]
link_windows();

Expand Down
13 changes: 13 additions & 0 deletions yari-sys/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ pub struct SIZED_STRING {
pub c_string: __IncompleteArrayField<::std::os::raw::c_char>,
}

#[cfg(target_os = "linux")]
impl Debug for YR_SCAN_CONTEXT {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
// Basic implementation just to satisfy derive Debug
// We don't need all of the fields for now
f.debug_struct("YR_SCAN_CONTEXT")
.field("file_size", &self.file_size)
.field("entry_point", &self.entry_point)
.finish()
}
}

#[cfg(target_os = "windows")]
impl Debug for YR_SCAN_CONTEXT {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
// Basic implementation just to satisfy derive Debug
Expand Down

0 comments on commit 6bc8d9b

Please sign in to comment.