mirror of
https://github.com/samba-team/samba.git
synced 2025-01-08 21:18:16 +03:00
Add build config for proper TDB build linkage
The tdb build needs to know whether Samba is building with TDB bundled or not, otherwise linking will fail. Signed-off-by: David Mulder <dmulder@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
parent
dc445490cc
commit
35b34e8e42
@ -7,7 +7,7 @@ version = "4.21.0"
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"chelps", "dbg", "himmelblaud", "idmap",
|
||||
"chelps", "config", "dbg", "himmelblaud", "idmap",
|
||||
"nss", "ntstatus_gen", "pam",
|
||||
"param", "sock", "tdb", "version",
|
||||
]
|
||||
@ -21,3 +21,4 @@ ntstatus_gen = { path = "ntstatus_gen" }
|
||||
tdb = { path = "tdb" }
|
||||
idmap = { path = "idmap" }
|
||||
libc = "0.2.155"
|
||||
config = { path = "config" }
|
||||
|
12
rust/config/Cargo.toml
Normal file
12
rust/config/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "config"
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
libc.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.69.4"
|
4
rust/config/additions.h
Normal file
4
rust/config/additions.h
Normal file
@ -0,0 +1,4 @@
|
||||
#include "../../bin/default/include/config.h"
|
||||
#ifndef USING_SYSTEM_TDB
|
||||
#define USING_SYSTEM_TDB 0
|
||||
#endif
|
20
rust/config/build.rs
Normal file
20
rust/config/build.rs
Normal file
@ -0,0 +1,20 @@
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
|
||||
fn main() {
|
||||
let header = "../../bin/default/include/config.h";
|
||||
println!("cargo:rerun-if-changed={}", header);
|
||||
let additions_header = "./additions.h";
|
||||
println!("cargo:rerun-if-changed={}", additions_header);
|
||||
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header(additions_header)
|
||||
.header(header)
|
||||
.generate()
|
||||
.expect("Failed generating config bindings!");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
27
rust/config/src/lib.rs
Normal file
27
rust/config/src/lib.rs
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
Unix SMB/CIFS implementation.
|
||||
|
||||
Samba config imported into Rust
|
||||
|
||||
Copyright (C) David Mulder 2024
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
#![allow(dead_code)]
|
||||
#![allow(clippy::upper_case_acronyms)]
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
@ -13,6 +13,7 @@ fn main() {
|
||||
.clang_arg("-Dbool=int")
|
||||
.clang_arg("-Doffset_t=loff_t")
|
||||
.clang_arg("-I../../bin/default")
|
||||
.clang_arg("-I../../lib/talloc")
|
||||
.clang_arg("-includestdint.h")
|
||||
.header("../../lib/param/param.h")
|
||||
.header("../../lib/param/loadparm.h")
|
||||
|
@ -13,3 +13,4 @@ ntstatus_gen.workspace = true
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.69.4"
|
||||
config.workspace = true
|
||||
|
@ -23,7 +23,11 @@ fn main() {
|
||||
|
||||
let mut src_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
src_dir.push("../../bin/default/lib/tdb");
|
||||
println!("cargo:rustc-link-lib=tdb");
|
||||
if config::USING_SYSTEM_TDB == 1 {
|
||||
println!("cargo:rustc-link-lib=tdb");
|
||||
} else {
|
||||
println!("cargo:rustc-link-lib=tdb-private-samba");
|
||||
}
|
||||
println!(
|
||||
"cargo:rustc-link-search=native={}",
|
||||
src_dir.to_str().unwrap()
|
||||
|
Loading…
Reference in New Issue
Block a user