Skip to content

Commit 70faa78

Browse files
committed
Adding option for static linking and updating wrapper for arm64 architecture
1 parent 890d756 commit 70faa78

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

Cargo.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "libnfs-sys"
33
description = "libnfs bindings allow you to create nfs mounts in memory/userspace"
4-
version = "0.2.3"
4+
version = "0.2.4"
55
authors = ["Chris Holcombe <[email protected]>"]
66
homepage = "https://github.com/cholcombe973/libnfs-sys"
77
repository = "https://github.com/cholcombe973/libnfs-sys"
@@ -11,7 +11,10 @@ readme = "README.md"
1111
keywords = ["nfs"]
1212
categories = ["api-bindings", "network-programming", "filesystem", "external-ffi-bindings"]
1313

14+
[lib]
15+
crate-type = ["rlib"]
16+
1417
[build-dependencies]
15-
bindgen = "0.69.4"
18+
bindgen = "~0.70.1"
1619

1720
[dependencies]

build.rs

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,30 @@
11
extern crate bindgen;
22

33
use std::env;
4-
use std::path::PathBuf;
4+
use std::path::{Path, PathBuf};
55

66
fn main() {
7-
println!("cargo:rustc-link-lib=nfs");
8-
7+
let link_static_env_if_any = env::var("LIBNFS_LINK_STATIC");
8+
match link_static_env_if_any {
9+
Ok(link_static) => {
10+
if link_static == "true" {
11+
println!("cargo:rustc-link-lib=static=nfs");
12+
} else {
13+
println!("cargo:rustc-link-lib=nfs");
14+
}
15+
},
16+
Err(_) => {
17+
println!("cargo:rustc-link-lib=nfs");
18+
},
19+
}
20+
let libnfs_lib_path_if_any = env::var("LIBNFS_LIB_PATH");
21+
match libnfs_lib_path_if_any {
22+
Ok(lib_dir) => {
23+
let lib_dir = Path::new(&lib_dir);
24+
println!("cargo:rustc-link-search=native={}", lib_dir.display());
25+
},
26+
Err(_) => {},
27+
}
928
// The bindgen::Builder is the main entry point
1029
// to bindgen, and lets you build up options for
1130
// the resulting bindings.

wrapper.h

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#if defined(__aarch64__) && !defined(__arm64__)
2+
#define __arm64__ 1
3+
#endif
14
#include <sys/statvfs.h>
25
#include <sys/time.h>
36
#include <nfsc/libnfs.h>

0 commit comments

Comments
 (0)