aboutsummaryrefslogtreecommitdiffstats
path: root/devel/libdatadog/files/patch-builder-src-arch-freebsd.rs
blob: 8f37cf76ea6301027c7821d99c35c0c2f745e248 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
--- builder/src/arch/freebsd.rs.orig    2025-11-26 08:32:19 UTC
+++ builder/src/arch/freebsd.rs
@@ -0,0 +1,37 @@
+use std::ffi::OsStr;
+
+use std::process::Command;
+
+pub const NATIVE_LIBS: &str = " -lc -ldl -lm -lpthread -lrt -lutil";
+pub const PROF_DYNAMIC_LIB: &str = "libdatadog_profiling.so";
+pub const PROF_STATIC_LIB: &str = "libdatadog_profiling.a";
+pub const PROF_DYNAMIC_LIB_FFI: &str = "libdatadog_profiling_ffi.so";
+pub const PROF_STATIC_LIB_FFI: &str = "libdatadog_profiling_ffi.a";
+pub const REMOVE_RPATH: bool = false;
+pub const BUILD_CRASHTRACKER: bool = true;
+// pub const RUSTFLAGS: [&str; 4] = ["-C", "relocation-model=pic"];
+pub const RUSTFLAGS: [&str; 4] = ["-C", "relocation-model=pic", "-C", "link-arg=-Wl,-soname,libdatadog_profiling.so"];
+
+pub fn fix_rpath(lib_path: &str) {
+    if REMOVE_RPATH {
+        let mut patchelf = Command::new("patchelf")
+            .arg("--remove-rpath")
+            .arg(lib_path)
+            .spawn()
+            .expect("failed to spawn patchelf");
+
+        patchelf.wait().expect("failed to remove rpath");
+    }
+}
+
+pub fn strip_libraries(lib_path: &str) {
+    let mut strip = Command::new("strip")
+        .arg("-S")
+        .arg(lib_path.to_owned() + "/libdatadog_profiling.so")
+        .spawn()
+        .expect("Failed to spawn strip");
+
+    strip.wait().expect("Failed to strip library");
+}
+
+pub fn add_additional_files(_lib_path: &str, _target_path: &OsStr) {}