liminix/pkgs/swconfig/default.nix

34 lines
1,015 B
Nix
Raw Permalink Normal View History

2023-03-05 23:32:56 +01:00
{ stdenv, buildPackages, libnl, ...} :
let switchDotH = buildPackages.fetchurl {
url = "https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob_plain;f=target/linux/generic/files/include/uapi/linux/switch.h;hb=99a188828713d6ff9c541590b08d4e63ef52f6d7";
sha256 = "15kmhhcpd84y4f45rf8zai98c61jyvkc37p90pcxirna01x33wi8";
name="switch.h";
};
in stdenv.mkDerivation {
src = buildPackages.fetchFromGitHub {
owner = "jekader";
repo = "swconfig";
rev = "66c760893ecdd1d603a7231fea9209daac57b610";
sha256 = "0hi2rj1a1fbvr5n1090q1zzigjyxmn643jzrwngw4ij0g82za3al";
};
name = "swconfig";
2023-09-21 13:25:35 +02:00
buildInputs = [ buildPackages.pkg-config ];
2023-03-05 23:32:56 +01:00
nativeBuildInputs = [ libnl ];
CFLAGS="-O2 -Ifrom_kernel -I${libnl.dev}/include/libnl3";
LDFLAGS="-L${libnl.out}/lib";
patchPhase = ''
mkdir -p from_kernel/linux
cp ${switchDotH} from_kernel/linux/switch.h
'';
buildPhase = ''
make swconfig
$STRIP swconfig
'';
installPhase = ''
mkdir -p $out/bin
cp swconfig $out/bin
'';
}