|
@@ -1,8 +1,6 @@
|
|
|
use std::{
|
|
|
- ffi::OsString,
|
|
|
fs::{File, create_dir_all},
|
|
|
path::{Path, PathBuf},
|
|
|
- process::Command,
|
|
|
};
|
|
|
|
|
|
use anyhow::{Context as _, Result};
|
|
@@ -10,13 +8,11 @@ use aya_tool::bindgen;
|
|
|
use proc_macro2::TokenStream;
|
|
|
use quote::ToTokens as _;
|
|
|
use syn::{Item, parse_str};
|
|
|
+use xtask::install_libbpf_headers;
|
|
|
|
|
|
-use crate::{
|
|
|
- codegen::{
|
|
|
- Architecture, SysrootOptions,
|
|
|
- helpers::{expand_helpers, extract_helpers},
|
|
|
- },
|
|
|
- exec,
|
|
|
+use crate::codegen::{
|
|
|
+ Architecture, SysrootOptions,
|
|
|
+ helpers::{expand_helpers, extract_helpers},
|
|
|
};
|
|
|
|
|
|
pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
|
|
@@ -34,17 +30,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<()> {
|
|
|
let tmp_dir = tempfile::tempdir().context("tempdir failed")?;
|
|
|
let libbpf_headers_dir = tmp_dir.path().join("libbpf_headers");
|
|
|
|
|
|
- let mut includedir = OsString::new();
|
|
|
- includedir.push("INCLUDEDIR=");
|
|
|
- includedir.push(&libbpf_headers_dir);
|
|
|
-
|
|
|
- exec(
|
|
|
- Command::new("make")
|
|
|
- .arg("-C")
|
|
|
- .arg(libbpf_dir.join("src"))
|
|
|
- .arg(includedir)
|
|
|
- .arg("install_headers"),
|
|
|
- )?;
|
|
|
+ install_libbpf_headers(libbpf_dir, &libbpf_headers_dir)?;
|
|
|
|
|
|
let dir = PathBuf::from("ebpf/aya-ebpf-bindings");
|
|
|
|