-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adapt aya-rs/aya@3d463a3 and subsequent work to the template. This has worked very well for us in the main project, and our users should get the same hotness.
- Loading branch information
Showing
16 changed files
with
238 additions
and
244 deletions.
There are no files selected for viewing
This file was deleted.
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 was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pub const AYA_BUILD_EBPF: &str = "AYA_BUILD_EBPF"; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use std::env; | ||
|
||
use which::which; | ||
use xtask::AYA_BUILD_EBPF; | ||
|
||
/// Building this crate has an undeclared dependency on the `bpf-linker` binary. This would be | ||
/// better expressed by [artifact-dependencies][bindeps] but issues such as | ||
/// https://github.com/rust-lang/cargo/issues/12385 make their use impractical for the time being. | ||
/// | ||
/// This file implements an imperfect solution: it causes cargo to rebuild the crate whenever the | ||
/// mtime of `which bpf-linker` changes. Note that possibility that a new bpf-linker is added to | ||
/// $PATH ahead of the one used as the cache key still exists. Solving this in the general case | ||
/// would require rebuild-if-changed-env=PATH *and* rebuild-if-changed={every-directory-in-PATH} | ||
/// which would likely mean far too much cache invalidation. | ||
/// | ||
/// [bindeps]: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html?highlight=feature#artifact-dependencies | ||
fn main() { | ||
println!("cargo:rerun-if-env-changed={}", AYA_BUILD_EBPF); | ||
|
||
let build_ebpf = env::var(AYA_BUILD_EBPF) | ||
.as_deref() | ||
.map(str::parse) | ||
.map(Result::unwrap) | ||
.unwrap_or_default(); | ||
|
||
if build_ebpf { | ||
let bpf_linker = which("bpf-linker").unwrap(); | ||
println!("cargo:rerun-if-changed={}", bpf_linker.to_str().unwrap()); | ||
} | ||
} |
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,3 @@ | ||
#![no_std] | ||
|
||
// This file exists to enable the library target. |
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
Oops, something went wrong.