Merge pull request #244670 from thillux/frr-cross-options
This commit is contained in:
commit
a7ad0beffb
2 changed files with 162 additions and 5 deletions
59
pkgs/servers/frr/clippy-helper.nix
Normal file
59
pkgs/servers/frr/clippy-helper.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, frrSource
|
||||
, frrVersion
|
||||
|
||||
# build time
|
||||
, autoreconfHook
|
||||
, flex
|
||||
, bison
|
||||
, pkg-config
|
||||
, libelf
|
||||
, perl
|
||||
, python3
|
||||
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "frr-clippy-helper";
|
||||
version = frrVersion;
|
||||
|
||||
src = frrSource;
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoreconfHook
|
||||
bison
|
||||
flex
|
||||
perl
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
libelf
|
||||
python3
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
"--enable-clippy-only"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp lib/clippy $out/bin
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://frrouting.org/";
|
||||
description = "FRR routing daemon suite: CLI helper tool clippy";
|
||||
longDescription = ''
|
||||
This small tool is used to support generating CLI code for FRR. It is split out here,
|
||||
to support cross-compiling, because it needs to be compiled with the build system toolchain
|
||||
and not the target host one.
|
||||
'';
|
||||
license = with licenses; [ gpl2Plus lgpl21Plus ];
|
||||
maintainers = with maintainers; [ thillux ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
|
@ -9,6 +9,7 @@
|
|||
, perl
|
||||
, pkg-config
|
||||
, texinfo
|
||||
, buildPackages
|
||||
|
||||
# runtime
|
||||
, c-ares
|
||||
|
@ -28,8 +29,58 @@
|
|||
# tests
|
||||
, nettools
|
||||
, nixosTests
|
||||
|
||||
# FRR's configure.ac gets SNMP options by executing net-snmp-config on the build host
|
||||
# This leads to compilation errors when cross compiling.
|
||||
# E.g. net-snmp-config for x86_64 does not return the ARM64 paths.
|
||||
#
|
||||
# SNMP_LIBS="`${NETSNMP_CONFIG} --agent-libs`"
|
||||
# SNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
|
||||
, snmpSupport ? stdenv.buildPlatform.canExecute stdenv.hostPlatform
|
||||
|
||||
# other general options besides snmp support
|
||||
, rpkiSupport ? true
|
||||
, numMultipath ? 64
|
||||
, watchfrrSupport ? true
|
||||
, cumulusSupport ? false
|
||||
, datacenterSupport ? true
|
||||
, rtadvSupport ? true
|
||||
, irdpSupport ? true
|
||||
, routeReplacementSupport ? true
|
||||
|
||||
# routing daemon options
|
||||
, bgpdSupport ? true
|
||||
, ripdSupport ? true
|
||||
, ripngdSupport ? true
|
||||
, ospfdSupport ? true
|
||||
, ospf6dSupport ? true
|
||||
, ldpdSupport ? true
|
||||
, nhrpdSupport ? true
|
||||
, eigrpdSupport ? true
|
||||
, babeldSupport ? true
|
||||
, isisdSupport ? true
|
||||
, pimdSupport ? true
|
||||
, pim6dSupport ? true
|
||||
, sharpdSupport ? true
|
||||
, fabricdSupport ? true
|
||||
, vrrpdSupport ? true
|
||||
, pathdSupport ? true
|
||||
, bfddSupport ? true
|
||||
, pbrdSupport ? true
|
||||
, staticdSupport ? true
|
||||
|
||||
# BGP options
|
||||
, bgpAnnounce ? true
|
||||
, bgpBmp ? true
|
||||
, bgpVnc ? true
|
||||
|
||||
# OSPF options
|
||||
, ospfApi ? true
|
||||
}:
|
||||
|
||||
lib.warnIf (!(stdenv.buildPlatform.canExecute stdenv.hostPlatform))
|
||||
"cannot enable SNMP support due to cross-compilation issues with net-snmp-config"
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "frr";
|
||||
version = "8.5.2";
|
||||
|
@ -57,7 +108,6 @@ stdenv.mkDerivation rec {
|
|||
libelf
|
||||
libunwind
|
||||
libyang
|
||||
net-snmp
|
||||
openssl
|
||||
pam
|
||||
pcre2
|
||||
|
@ -66,21 +116,69 @@ stdenv.mkDerivation rec {
|
|||
rtrlib
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
libcap
|
||||
] ++ lib.optionals snmpSupport [
|
||||
net-snmp
|
||||
];
|
||||
|
||||
# otherwise in cross-compilation: "configure: error: no working python version found"
|
||||
depsBuildBuild = [
|
||||
buildPackages.python3
|
||||
];
|
||||
|
||||
# cross-compiling: clippy is compiled with the build host toolchain, split it out to ease
|
||||
# navigation in dependency hell
|
||||
clippy-helper = buildPackages.callPackage ./clippy-helper.nix { frrVersion = version; frrSource = src; };
|
||||
|
||||
configureFlags = [
|
||||
"--disable-silent-rules"
|
||||
"--disable-exampledir"
|
||||
"--enable-configfile-mask=0640"
|
||||
"--enable-group=frr"
|
||||
"--enable-logfile-mask=0640"
|
||||
"--enable-multipath=64"
|
||||
"--enable-snmp"
|
||||
"--enable-multipath=${toString numMultipath}"
|
||||
"--enable-user=frr"
|
||||
"--enable-vty-group=frrvty"
|
||||
"--localstatedir=/run/frr"
|
||||
"--sbindir=$(out)/libexec/frr"
|
||||
"--sysconfdir=/etc/frr"
|
||||
"--enable-rpki"
|
||||
"--with-clippy=${clippy-helper}/bin/clippy"
|
||||
# general options
|
||||
(lib.strings.enableFeature snmpSupport "snmp")
|
||||
(lib.strings.enableFeature rpkiSupport "rpki")
|
||||
(lib.strings.enableFeature watchfrrSupport "watchfrr")
|
||||
(lib.strings.enableFeature rtadvSupport "rtadv")
|
||||
(lib.strings.enableFeature irdpSupport "irdp")
|
||||
(lib.strings.enableFeature routeReplacementSupport "rr-semantics")
|
||||
# routing protocols
|
||||
(lib.strings.enableFeature bgpdSupport "bgpd")
|
||||
(lib.strings.enableFeature ripdSupport "ripd")
|
||||
(lib.strings.enableFeature ripngdSupport "ripngd")
|
||||
(lib.strings.enableFeature ospfdSupport "ospfd")
|
||||
(lib.strings.enableFeature ospf6dSupport "ospf6d")
|
||||
(lib.strings.enableFeature ldpdSupport "ldpd")
|
||||
(lib.strings.enableFeature nhrpdSupport "nhrpd")
|
||||
(lib.strings.enableFeature eigrpdSupport "eigrpd")
|
||||
(lib.strings.enableFeature babeldSupport "babeld")
|
||||
(lib.strings.enableFeature isisdSupport "isisd")
|
||||
(lib.strings.enableFeature pimdSupport "pimd")
|
||||
(lib.strings.enableFeature pim6dSupport "pim6d")
|
||||
(lib.strings.enableFeature sharpdSupport "sharpd")
|
||||
(lib.strings.enableFeature fabricdSupport "fabricd")
|
||||
(lib.strings.enableFeature vrrpdSupport "vrrpd")
|
||||
(lib.strings.enableFeature pathdSupport "pathd")
|
||||
(lib.strings.enableFeature bfddSupport "bfdd")
|
||||
(lib.strings.enableFeature pbrdSupport "pbrd")
|
||||
(lib.strings.enableFeature staticdSupport "staticd")
|
||||
# BGP options
|
||||
(lib.strings.enableFeature bgpAnnounce "bgp-announce")
|
||||
(lib.strings.enableFeature bgpBmp "bgp-bmp")
|
||||
(lib.strings.enableFeature bgpVnc "bgp-vnc")
|
||||
# OSPF options
|
||||
(lib.strings.enableFeature ospfApi "ospfapi")
|
||||
# Cumulus options
|
||||
(lib.strings.enableFeature cumulusSupport "cumulus")
|
||||
# Datacenter options
|
||||
(lib.strings.enableFeature datacenterSupport "datacenter")
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
|
@ -123,7 +221,7 @@ stdenv.mkDerivation rec {
|
|||
private clouds.
|
||||
'';
|
||||
license = with licenses; [ gpl2Plus lgpl21Plus ];
|
||||
maintainers = with maintainers; [ woffs ];
|
||||
maintainers = with maintainers; [ woffs thillux ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue