frr: fix cross compilation x86-64 -> aarch64

Signed-off-by: Markus Theil <theil.markus@gmail.com>
This commit is contained in:
Markus Theil
2023-08-10 11:06:42 +02:00
parent ce5e4a6ef2
commit 93c0489bdc
2 changed files with 79 additions and 2 deletions
+59
View File
@@ -0,0 +1,59 @@
{ lib
, stdenv
, frr_source
, frr_version
# build time
, autoreconfHook
, flex
, bison
, pkg-config
, libelf
, perl
, python3
}:
stdenv.mkDerivation rec {
pname = "frr-clippy-helper";
version = frr_version;
src = frr_source;
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;
};
}
+20 -2
View File
@@ -9,6 +9,7 @@
, perl
, pkg-config
, texinfo
, buildPackages
# runtime
, c-ares
@@ -28,8 +29,13 @@
# tests
, nettools
, nixosTests
# options
, snmpSupport ? true
}:
assert snmpSupport -> stdenv.buildPlatform.canExecute stdenv.hostPlatform;
stdenv.mkDerivation rec {
pname = "frr";
version = "8.5.2";
@@ -57,7 +63,6 @@ stdenv.mkDerivation rec {
libelf
libunwind
libyang
net-snmp
openssl
pam
pcre2
@@ -66,21 +71,34 @@ 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 { frr_version = version; frr_source=src; };
configureFlags = [
"--disable-silent-rules"
"--disable-exampledir"
"--enable-configfile-mask=0640"
"--enable-group=frr"
"--enable-logfile-mask=0640"
"--enable-multipath=64"
"--enable-snmp"
(lib.strings.enableFeature snmpSupport "snmp")
"--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"
];
postPatch = ''