build.rs: add negentropy dependency and cmdCount cmdLine dependencies

This commit is contained in:
Ivan Folgueira Bande 2024-10-28 14:05:24 +01:00
parent 897c4a3080
commit 0cf27d112c
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7
3 changed files with 38 additions and 1 deletions

View File

@ -36,4 +36,4 @@ crate-type = ["rlib"]
[build-dependencies]
bindgen = "0.64"
cc = "1.0"
cc = "1.0.73"

View File

@ -38,6 +38,7 @@ fn generate_bindgen_code(project_dir: &Path) {
vendor_path.join("build").display()
);
println!("cargo:rustc-link-lib=static=waku");
println!(
"cargo:rustc-link-search={}",
vendor_path
@ -45,6 +46,7 @@ fn generate_bindgen_code(project_dir: &Path) {
.display()
);
println!("cargo:rustc-link-lib=static=miniupnpc");
println!(
"cargo:rustc-link-search={}",
vendor_path
@ -52,8 +54,10 @@ fn generate_bindgen_code(project_dir: &Path) {
.display()
);
println!("cargo:rustc-link-lib=static=natpmp");
println!("cargo:rustc-link-lib=dl");
println!("cargo:rustc-link-lib=m");
println!(
"cargo:rustc-link-search=native={}",
vendor_path
@ -62,7 +66,27 @@ fn generate_bindgen_code(project_dir: &Path) {
);
println!("cargo:rustc-link-lib=static=backtrace");
println!("cargo:rustc-link-lib=stdc++");
println!(
"cargo:rustc-link-search={}",
vendor_path
.join("vendor/negentropy/cpp")
.display()
);
println!("cargo:rustc-link-lib=static=negentropy");
println!("cargo:rustc-link-lib=ssl");
println!("cargo:rustc-link-lib=crypto");
cc::Build::new()
.file("src/cmd.c") // Compile the C file
.compile("cmditems"); // Compile it as a library
println!("cargo:rustc-link-lib=static=cmditems");
// TODO: Determine if pthread is automatically included
println!("cargo:rustc-link-lib=pthread");
// TODO: Test in other architectures
// Generate waku bindings with bindgen

13
waku-sys/src/cmd.c Normal file
View File

@ -0,0 +1,13 @@
/*
This file is needed to avoid errors like the following when linking the waku-sys lib crate:
<<undefined reference to `cmdCount'>>
and
<<undefined reference to `cmdLine'>>
*/
#include <stdio.h>
int cmdCount = 0;
char** cmdLine = NULL;