Skip to content

Commit 5ba8d69

Browse files
d-e-s-odanielocfb
authored andcommitted
Adjust remaining examples to produce skeleton in src/bpf/ directory
Do what commit 545c59c ("Adjust tcp_ca example to produce skeleton in example directory") started for all the remaining example and have the skeletons created in the respective src/bpf/ directory to make them easier discoverable. Signed-off-by: Daniel Müller <[email protected]>
1 parent ce0a109 commit 5ba8d69

File tree

8 files changed

+28
-16
lines changed

8 files changed

+28
-16
lines changed

examples/capable/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use libbpf_cargo::SkeletonBuilder;
77
const SRC: &str = "src/bpf/capable.bpf.c";
88

99
fn main() {
10-
let mut out =
11-
PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR must be set in build script"));
12-
out.push("capable.skel.rs");
10+
let out = PathBuf::from(
11+
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set in build script"),
12+
)
13+
.join("src")
14+
.join("bpf")
15+
.join("capable.skel.rs");
1316

1417
let arch = env::var("CARGO_CFG_TARGET_ARCH")
1518
.expect("CARGO_CFG_TARGET_ARCH must be set in build script");

examples/capable/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use time::macros::format_description;
1919
use time::OffsetDateTime;
2020

2121
mod capable {
22-
include!(concat!(env!("OUT_DIR"), "/capable.skel.rs"));
22+
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bpf/capable.skel.rs"));
2323
}
2424

2525
use capable::capable_types::uniqueness;

examples/runqslower/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use libbpf_cargo::SkeletonBuilder;
77
const SRC: &str = "src/bpf/runqslower.bpf.c";
88

99
fn main() {
10-
let mut out =
11-
PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR must be set in build script"));
12-
out.push("runqslower.skel.rs");
10+
let out = PathBuf::from(
11+
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set in build script"),
12+
)
13+
.join("src")
14+
.join("bpf")
15+
.join("runqslower.skel.rs");
1316

1417
let arch = env::var("CARGO_CFG_TARGET_ARCH")
1518
.expect("CARGO_CFG_TARGET_ARCH must be set in build script");

examples/runqslower/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use time::macros::format_description;
1414
use time::OffsetDateTime;
1515

1616
mod runqslower {
17-
include!(concat!(env!("OUT_DIR"), "/runqslower.skel.rs"));
17+
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bpf/runqslower.skel.rs"));
1818
}
1919

2020
use runqslower::*;

examples/tc_port_whitelist/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use libbpf_cargo::SkeletonBuilder;
77
const SRC: &str = "src/bpf/tc.bpf.c";
88

99
fn main() {
10-
let mut out =
11-
PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR must be set in build script"));
12-
out.push("tc.skel.rs");
10+
let out = PathBuf::from(
11+
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set in build script"),
12+
)
13+
.join("src")
14+
.join("bpf")
15+
.join("tc.skel.rs");
1316

1417
let arch = env::var("CARGO_CFG_TARGET_ARCH")
1518
.expect("CARGO_CFG_TARGET_ARCH must be set in build script");

examples/tc_port_whitelist/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use libbpf_rs::TC_H_MIN_INGRESS;
1919
use libbpf_rs::TC_INGRESS;
2020

2121
mod tc {
22-
include!(concat!(env!("OUT_DIR"), "/tc.skel.rs"));
22+
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bpf/tc.skel.rs"));
2323
}
2424
use tc::*;
2525

examples/tproxy/build.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ use libbpf_cargo::SkeletonBuilder;
77
const SRC: &str = "src/bpf/tproxy.bpf.c";
88

99
fn main() {
10-
let mut out =
11-
PathBuf::from(env::var_os("OUT_DIR").expect("OUT_DIR must be set in build script"));
12-
out.push("tproxy.skel.rs");
10+
let out = PathBuf::from(
11+
env::var_os("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR must be set in build script"),
12+
)
13+
.join("src")
14+
.join("bpf")
15+
.join("tproxy.skel.rs");
1316

1417
let arch = env::var("CARGO_CFG_TARGET_ARCH")
1518
.expect("CARGO_CFG_TARGET_ARCH must be set in build script");

examples/tproxy/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use libbpf_rs::TcHookBuilder;
1616
use libbpf_rs::TC_INGRESS;
1717

1818
mod tproxy {
19-
include!(concat!(env!("OUT_DIR"), "/tproxy.skel.rs"));
19+
include!(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bpf/tproxy.skel.rs"));
2020
}
2121

2222
use tproxy::*;

0 commit comments

Comments
 (0)