2022-08-12 12:06:08 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
2024-09-19 14:19:46 +00:00
|
|
|
, llvmPackages_19
|
2022-08-12 12:06:08 +00:00
|
|
|
, zlib
|
|
|
|
, ncurses
|
|
|
|
, libxml2
|
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "bpf-linker";
|
2024-09-19 14:19:46 +00:00
|
|
|
version = "0.9.13";
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "aya-rs";
|
|
|
|
repo = pname;
|
2024-09-19 14:19:46 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-CRYp1ktmmY4OS23+LNKOBQJUMkd+GXptBp5LPfbyZAc=";
|
2022-08-12 12:06:08 +00:00
|
|
|
};
|
|
|
|
|
2024-07-27 06:49:29 +00:00
|
|
|
cargoLock = {
|
|
|
|
lockFile = ./Cargo.lock;
|
|
|
|
outputHashes = {
|
2024-09-19 14:19:46 +00:00
|
|
|
"compiletest_rs-0.10.2" = "sha256-JTfVfMW0bCbFjQxeAFu3Aex9QmGnx0wp6weGrNlQieA=";
|
2024-07-27 06:49:29 +00:00
|
|
|
};
|
|
|
|
};
|
2022-08-12 12:06:08 +00:00
|
|
|
|
|
|
|
buildNoDefaultFeatures = true;
|
|
|
|
|
2024-09-19 14:19:46 +00:00
|
|
|
nativeBuildInputs = [ llvmPackages_19.llvm ];
|
2022-08-12 12:06:08 +00:00
|
|
|
buildInputs = [ zlib ncurses libxml2 ];
|
|
|
|
|
|
|
|
# fails with: couldn't find crate `core` with expected target triple bpfel-unknown-none
|
|
|
|
# rust-src and `-Z build-std=core` are required to properly run the tests
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Simple BPF static linker";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "bpf-linker";
|
2022-08-12 12:06:08 +00:00
|
|
|
homepage = "https://github.com/aya-rs/bpf-linker";
|
|
|
|
license = with licenses; [ asl20 mit ];
|
|
|
|
maintainers = with maintainers; [ nickcao ];
|
|
|
|
# llvm-sys crate locates llvm by calling llvm-config
|
|
|
|
# which is not available when cross compiling
|
|
|
|
broken = stdenv.buildPlatform != stdenv.hostPlatform;
|
|
|
|
};
|
|
|
|
}
|