[package]
name = "sighook"
version = "0.9.0"
edition = "2024"
rust-version = "1.85"
authors = ["YinMo19 <me@yinmo19.top>"]
description = "An Apple/Linux/Android runtime instrumentation and inline hooking crate for aarch64 and x86_64."
readme = "README.md"
license = "LGPL-2.1-only"
repository = "https://github.com/YinMo19/sighook"
homepage = "https://blog.yinmo19.top"
documentation = "https://docs.rs/sighook"
keywords = ["ios", "android", "aarch64", "x86_64", "hook"]

[package.metadata.docs.rs]
default-target = "aarch64-apple-darwin"
targets = [
    "aarch64-apple-darwin",
    "x86_64-apple-darwin",
    "aarch64-apple-ios",
    "aarch64-unknown-linux-gnu",
    "aarch64-linux-android",
    "x86_64-unknown-linux-gnu",
]
rustdoc-args = ["--cfg", "docsrs"]

[lib]
name = "sighook"
crate-type = ["rlib", "cdylib"]

[features]
default = []
patch_asm = ["dep:keystone-engine"]

[[example]]
name = "patchcode_add_to_mul"
path = "examples/patchcode_add_to_mul/main.rs"
crate-type = ["cdylib"]

[[example]]
name = "patch_asm_add_to_mul"
path = "examples/patch_asm_add_to_mul/main.rs"
crate-type = ["cdylib"]
required-features = ["patch_asm"]

[[example]]
name = "instrument_with_original"
path = "examples/instrument_with_original/main.rs"
crate-type = ["cdylib"]

[[example]]
name = "instrument_no_original"
path = "examples/instrument_no_original/main.rs"
crate-type = ["cdylib"]

[[example]]
name = "instrument_adrp_no_original"
path = "examples/instrument_adrp_no_original/main.rs"
crate-type = ["cdylib"]

[[example]]
name = "instrument_unhook_restore"
path = "examples/instrument_unhook_restore/main.rs"
crate-type = ["cdylib"]

[[example]]
name = "inline_hook_far"
path = "examples/inline_hook_far/main.rs"
crate-type = ["cdylib"]

[[example]]
name = "inline_hook_signal"
path = "examples/inline_hook_signal/main.rs"
crate-type = ["cdylib"]

[dependencies]
libc = "0.2"

[target.'cfg(all(target_arch = "x86_64", any(target_os = "linux", target_os = "macos")))'.dependencies]
iced-x86 = "1.21"

[target.'cfg(any(all(target_os = "macos", target_arch = "aarch64"), all(target_os = "macos", target_arch = "x86_64"), all(target_os = "linux", target_arch = "aarch64"), all(target_os = "linux", target_arch = "x86_64")))'.dependencies]
keystone-engine = { version = "0.1.0", optional = true, default-features = false, features = ["build-from-src"] }
