Skip to content

Commit 0522557

Browse files
committed
Update bindgen + cleanup binding generation
1 parent bcab002 commit 0522557

File tree

3 files changed

+31
-125
lines changed

3 files changed

+31
-125
lines changed

Cargo.lock

Lines changed: 15 additions & 92 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ledger_secure_sdk_sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repository.workspace = true
88
description = "Bindings to Ledger C SDK"
99

1010
[build-dependencies]
11-
bindgen = "0.65.1"
11+
bindgen = "0.72.0"
1212
cc = "1.0.73"
1313
glob = "0.3.1"
1414

ledger_secure_sdk_sys/build.rs

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,8 @@ impl SDKBuilder<'_> {
491491
&[
492492
"lib_cxng/include/libcxng.h", /* cxlib */
493493
"include/os.h", /* syscalls */
494-
"include/os_screen.h",
495494
"include/syscalls.h",
496495
"include/os_ux.h",
497-
"include/ox.h", /* crypto-related syscalls */
498496
"lib_standard_app/swap_lib_calls.h",
499497
],
500498
);
@@ -541,45 +539,30 @@ impl SDKBuilder<'_> {
541539
format!("-I{bsdk}/lib_nbgl/include/").as_str(),
542540
format!("-I{bsdk}/lib_ux_nbgl/").as_str(),
543541
]);
544-
bindings = bindings
545-
.header(
546-
self.device
547-
.c_sdk
548-
.join("lib_nbgl/include/nbgl_use_case.h")
549-
.to_str()
550-
.unwrap(),
551-
)
552-
.header(
553-
self.device
554-
.c_sdk
555-
.join("lib_ux_nbgl/ux_nbgl.h")
556-
.to_str()
557-
.unwrap(),
558-
);
542+
bindings = bindings.header(
543+
self.device
544+
.c_sdk
545+
.join("lib_nbgl/include/nbgl_use_case.h")
546+
.to_str()
547+
.unwrap(),
548+
);
549+
if self.device.name == DeviceName::NanoSPlus || self.device.name == DeviceName::NanoX {
550+
bindings = bindings.clang_args([
551+
"-DHAVE_NBGL",
552+
"-DNBGL_STEP",
553+
"-DNBGL_USE_CASE",
554+
]);
555+
}
559556
} else {
560557
bindings = bindings.clang_arg("-DHAVE_UX_FLOW");
561558
}
562559

563-
// BLE bindings
564-
match self.device.name {
565-
DeviceName::NanoX | DeviceName::Flex | DeviceName::Stax | DeviceName::ApexP => {
566-
bindings = bindings.header(
567-
self.device
568-
.c_sdk
569-
.join("lib_blewbxx_impl/include/ledger_ble.h")
570-
.to_str()
571-
.unwrap(),
572-
)
573-
}
574-
_ => (),
575-
}
576-
577560
for define in &self.cxdefines {
578561
bindings = bindings.clang_arg(format!("-D{define}"));
579562
}
580563

581564
let bindings = bindings
582-
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
565+
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
583566
.generate()
584567
.expect("Unable to generate bindings");
585568

0 commit comments

Comments
 (0)