summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody P Schafer <dev@codyps.com>2021-08-04 17:04:49 -0400
committerCody P Schafer <dev@codyps.com>2021-08-04 17:05:05 -0400
commit5f3f71fdd3e9318c0bf2bdda857815dbb99187ec (patch)
tree9cbab280ed2cc0d328cb498fd3615b18b30721be
parenta94a85c91b4475096d07fcf85b974dac1290f436 (diff)
downloadrust-libzfs-5f3f71fdd3e9318c0bf2bdda857815dbb99187ec.zip
nvpair-sys: fix generation on macos
-rwxr-xr-xnvpair-sys/generate-bindings17
-rw-r--r--nvpair-sys/src/bindings.rs3
2 files changed, 17 insertions, 3 deletions
diff --git a/nvpair-sys/generate-bindings b/nvpair-sys/generate-bindings
index 6b73490..9bea7cc 100755
--- a/nvpair-sys/generate-bindings
+++ b/nvpair-sys/generate-bindings
@@ -1,4 +1,17 @@
#!/bin/sh
+
+os=$(uname -s)
+case "$os" in
+Darwin)
+ export PKG_CONFIG_PATH=/usr/local/zfs/lib/pkgconfig
+ sdkpath="$(xcrun --sdk macosx --show-sdk-path)"
+ CFLAGS=(-I "$sdkpath/usr/include/")
+ ;;
+*)
+ CFLAGS=()
+ ;;
+esac
+
d=$(dirname $0)
bindgen "$d/wrapper.h" \
-o "$d/src/bindings.rs" \
@@ -13,10 +26,10 @@ bindgen "$d/wrapper.h" \
--whitelist-type 'nvlist.*' \
--whitelist-type 'hrtime.*' \
--whitelist-type 'data_type_.*' \
- --whitelist-type 'size_t' \
--constified-enum-module '.*' \
--blacklist-type 'va_list' \
--blacklist-type '_IO_FILE' \
--blacklist-type 'FILE' \
--no-recursive-whitelist \
- -- `pkg-config libzfs_core --cflags`
+ --raw-line 'pub type size_t = ::std::os::raw::c_ulong;' \
+ -- `pkg-config libzfs_core --cflags` "${CFLAGS[@]}"
diff --git a/nvpair-sys/src/bindings.rs b/nvpair-sys/src/bindings.rs
index 2c84193..f35d691 100644
--- a/nvpair-sys/src/bindings.rs
+++ b/nvpair-sys/src/bindings.rs
@@ -1,6 +1,7 @@
-/* automatically generated by rust-bindgen 0.55.1 */
+/* automatically generated by rust-bindgen 0.59.1 */
pub type size_t = ::std::os::raw::c_ulong;
+
pub mod boolean_t {
pub type Type = ::std::os::raw::c_uint;
pub const B_FALSE: Type = 0;