|  |  | @ -1,5 +1,8 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | use std::{ |  |  |  | use std::{ | 
			
		
	
		
		
			
				
					
					|  |  |  |     env, fs, |  |  |  |     borrow::Cow, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     env, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     ffi::{OsStr, OsString}, | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     fs, | 
			
		
	
		
		
			
				
					
					|  |  |  |     path::{Path, PathBuf}, |  |  |  |     path::{Path, PathBuf}, | 
			
		
	
		
		
			
				
					
					|  |  |  |     process::Command, |  |  |  |     process::Command, | 
			
		
	
		
		
			
				
					
					|  |  |  | }; |  |  |  | }; | 
			
		
	
	
		
		
			
				
					|  |  | @ -77,9 +80,12 @@ fn build_rust_ebpf(opts: &BuildEbpfOptions) -> anyhow::Result<()> { | 
			
		
	
		
		
			
				
					
					|  |  |  | fn get_libbpf_headers<P: AsRef<Path>>(libbpf_dir: P, include_path: P) -> anyhow::Result<()> { |  |  |  | fn get_libbpf_headers<P: AsRef<Path>>(libbpf_dir: P, include_path: P) -> anyhow::Result<()> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     let dir = include_path.as_ref(); |  |  |  |     let dir = include_path.as_ref(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     fs::create_dir_all(dir)?; |  |  |  |     fs::create_dir_all(dir)?; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     let mut includedir = OsString::new(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     includedir.push("INCLUDEDIR="); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     includedir.push(dir.as_os_str()); | 
			
		
	
		
		
			
				
					
					|  |  |  |     let status = Command::new("make") |  |  |  |     let status = Command::new("make") | 
			
		
	
		
		
			
				
					
					|  |  |  |         .current_dir(libbpf_dir.as_ref().join("src")) |  |  |  |         .current_dir(libbpf_dir.as_ref().join("src")) | 
			
		
	
		
		
			
				
					
					|  |  |  |         .arg(format!("INCLUDEDIR={}", dir.as_os_str().to_string_lossy())) |  |  |  |         .arg(includedir) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         .arg("install_headers") |  |  |  |         .arg("install_headers") | 
			
		
	
		
		
			
				
					
					|  |  |  |         .status() |  |  |  |         .status() | 
			
		
	
		
		
			
				
					
					|  |  |  |         .expect("failed to build get libbpf headers"); |  |  |  |         .expect("failed to build get libbpf headers"); | 
			
		
	
	
		
		
			
				
					|  |  | @ -119,17 +125,18 @@ fn compile_with_clang<P: Clone + AsRef<Path>>( | 
			
		
	
		
		
			
				
					
					|  |  |  |     out: P, |  |  |  |     out: P, | 
			
		
	
		
		
			
				
					
					|  |  |  |     include_path: P, |  |  |  |     include_path: P, | 
			
		
	
		
		
			
				
					
					|  |  |  | ) -> anyhow::Result<()> { |  |  |  | ) -> anyhow::Result<()> { | 
			
		
	
		
		
			
				
					
					|  |  |  |     let clang = match env::var("CLANG") { |  |  |  |     let clang: Cow<'_, _> = match env::var_os("CLANG") { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         Ok(val) => val, |  |  |  |         Some(val) => val.into(), | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         Err(_) => String::from("/usr/bin/clang"), |  |  |  |         None => OsStr::new("/usr/bin/clang").into(), | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     }; |  |  |  |     }; | 
			
		
	
		
		
			
				
					
					|  |  |  |     let arch = match std::env::consts::ARCH { |  |  |  |     let arch = match env::consts::ARCH { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         "x86_64" => "x86", |  |  |  |         "x86_64" => "x86", | 
			
		
	
		
		
			
				
					
					|  |  |  |         "aarch64" => "arm64", |  |  |  |         "aarch64" => "arm64", | 
			
		
	
		
		
			
				
					
					|  |  |  |         _ => std::env::consts::ARCH, |  |  |  |         arch => arch, | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     }; |  |  |  |     }; | 
			
		
	
		
		
			
				
					
					|  |  |  |     let mut cmd = Command::new(clang); |  |  |  |     let mut cmd = Command::new(clang); | 
			
		
	
		
		
			
				
					
					|  |  |  |     cmd.arg(format!("-I{}", include_path.as_ref().to_string_lossy())) |  |  |  |     cmd.arg("-I") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         .arg(include_path.as_ref()) | 
			
		
	
		
		
			
				
					
					|  |  |  |         .arg("-g") |  |  |  |         .arg("-g") | 
			
		
	
		
		
			
				
					
					|  |  |  |         .arg("-O2") |  |  |  |         .arg("-O2") | 
			
		
	
		
		
			
				
					
					|  |  |  |         .arg("-target") |  |  |  |         .arg("-target") | 
			
		
	
	
		
		
			
				
					|  |  | 
 |