-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build system infrastructure. (#586)
* Add document describing the new build process. * Add build system infrastructure. * Set output folder via environment variable. * Add tar generation. * Make builder work both in release and debug profiles. * Avoid deep cloning Strings by using Rc<str>. * Modify CI files to use the new build system. * Remove pofiling as default feature.
- Loading branch information
Showing
25 changed files
with
1,070 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "builder" | ||
build = "build/main.rs" | ||
rust-version.workspace = true | ||
edition.workspace = true | ||
version.workspace = true | ||
license.workspace = true | ||
|
||
[features] | ||
default = [] | ||
crashtracker = ["datadog-profiling-ffi?/crashtracker-receiver", "datadog-profiling-ffi?/crashtracker-collector"] | ||
profiling = ["dep:datadog-profiling-ffi"] | ||
telemetry = ["profiling", "datadog-profiling-ffi?/ddtelemetry-ffi"] | ||
data-pipeline = ["telemetry", "datadog-profiling-ffi?/data-pipeline-ffi"] | ||
symbolizer = ["profiling", "datadog-profiling-ffi?/symbolizer"] | ||
|
||
[build-dependencies] | ||
anyhow = { version = "1.0" } | ||
build_common = { path = "../build-common", features = ["cbindgen"] } | ||
cmake = "0.1.50" | ||
tools = { path = "../tools" } | ||
ddcommon-ffi = { path = "../ddcommon-ffi" } | ||
datadog-profiling-ffi = { path = "../profiling-ffi", optional = true, features = ["cbindgen"] } | ||
tar = "0.4.41" | ||
|
||
[[bin]] | ||
name = "dummy" | ||
test = false | ||
bench = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2024-Present Datadog, Inc. https://www.datadoghq.com/ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use std::process::Command; | ||
|
||
pub const NATIVE_LIBS: &str = | ||
" -framework Security -framework CoreFoundation -liconv -lSystem -lresolv -lc -lm -liconv"; | ||
pub const PROF_DYNAMIC_LIB: &str = "libdatadog_profiling.dylib"; | ||
pub const PROF_STATIC_LIB: &str = "libdatadog_profiling.a"; | ||
pub const PROF_DYNAMIC_LIB_FFI: &str = "libdatadog_profiling_ffi.dylib"; | ||
pub const PROF_STATIC_LIB_FFI: &str = "libdatadog_profiling_ffi.a"; | ||
pub const REMOVE_RPATH: bool = true; | ||
pub const BUILD_CRASHTRACKER: bool = true; | ||
|
||
pub fn fix_rpath(lib_path: &str) { | ||
if REMOVE_RPATH { | ||
let lib_name = lib_path.split("/").last().unwrap(); | ||
|
||
Command::new("install_name_tool") | ||
.arg("-id") | ||
.arg("@rpath/".to_string() + lib_name) | ||
.arg(lib_path) | ||
.spawn() | ||
.expect("Failed to fix rpath"); | ||
} | ||
} | ||
|
||
pub fn strip_libraries(lib_path: &str) { | ||
// objcopy is not available in macos image. Investigate llvm-objcopy | ||
let mut strip = Command::new("strip") | ||
.arg("-S") | ||
.arg(lib_path.to_owned() + "/libdatadog_profiling.dylib") | ||
.spawn() | ||
.expect("Failed to spawn strip"); | ||
|
||
strip.wait().expect("Failed to strip library"); | ||
} |
Oops, something went wrong.