criu: support cross-compile for armv7l and aarch64
This fixes the `criu` package to support cross-compilation to armv7l and aarch64 architectures (tested on an x86 build host). `criu` requires some additional flags to be passed to its Makefile infrastructure to hint at the target architecture. It further requires a few dependencies to be executed on the build host, hence moving them to `depsBuildBuild`. Signed-off-by: Leon Schuermann <leon@is.currently.online>
This commit is contained in:
parent
1c906ccc36
commit
f9a1d83cdb
1 changed files with 53 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
|||
{ stdenv, lib, fetchFromGitHub, fetchpatch, protobuf, protobufc, asciidoc, iptables
|
||||
, xmlto, docbook_xsl, libpaper, libnl, libcap, libnet, pkg-config, iproute2
|
||||
, which, python3, makeWrapper, docbook_xml_dtd_45, perl, nftables, libbsd }:
|
||||
, which, python3, makeWrapper, docbook_xml_dtd_45, perl, nftables, libbsd
|
||||
, buildPackages
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "criu";
|
||||
|
@ -22,9 +24,34 @@ stdenv.mkDerivation rec {
|
|||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
nativeBuildInputs = [ pkg-config docbook_xsl which makeWrapper docbook_xml_dtd_45 python3 python3.pkgs.wrapPython perl ];
|
||||
buildInputs = [ protobuf asciidoc xmlto libpaper libnl libcap libnet nftables libbsd ];
|
||||
propagatedBuildInputs = [ protobufc ] ++ (with python3.pkgs; [ python python3.pkgs.protobuf ]);
|
||||
depsBuildBuild = [ protobufc buildPackages.stdenv.cc ];
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
asciidoc
|
||||
xmlto
|
||||
libpaper
|
||||
docbook_xsl
|
||||
which
|
||||
makeWrapper
|
||||
docbook_xml_dtd_45
|
||||
python3
|
||||
python3.pkgs.wrapPython
|
||||
perl
|
||||
];
|
||||
buildInputs = [
|
||||
protobuf
|
||||
libnl
|
||||
libcap
|
||||
libnet
|
||||
nftables
|
||||
libbsd
|
||||
];
|
||||
propagatedBuildInputs = [
|
||||
protobufc
|
||||
] ++ (with python3.pkgs; [
|
||||
python
|
||||
python3.pkgs.protobuf
|
||||
]);
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace ./Documentation/Makefile \
|
||||
|
@ -34,7 +61,27 @@ stdenv.mkDerivation rec {
|
|||
ln -sf ${protobuf}/include/google/protobuf/descriptor.proto ./images/google/protobuf/descriptor.proto
|
||||
'';
|
||||
|
||||
makeFlags = [ "PREFIX=$(out)" "ASCIIDOC=${asciidoc}/bin/asciidoc" "XMLTO=${xmlto}/bin/xmlto" ];
|
||||
makeFlags = let
|
||||
# criu's Makefile infrastructure expects to be passed a target architecture
|
||||
# which neither matches the config-tuple's first part, nor the
|
||||
# targetPlatform.linuxArch attribute. Thus we take the latter and map it
|
||||
# onto the expected string:
|
||||
linuxArchMapping = {
|
||||
"x86_64" = "x86";
|
||||
"arm" = "arm";
|
||||
"arm64" = "aarch64";
|
||||
"powerpc" = "ppc64";
|
||||
"s390" = "s390";
|
||||
"mips" = "mips";
|
||||
};
|
||||
in [
|
||||
"PREFIX=$(out)"
|
||||
"ASCIIDOC=${buildPackages.asciidoc}/bin/asciidoc"
|
||||
"XMLTO=${buildPackages.xmlto}/bin/xmlto"
|
||||
] ++ (lib.optionals (stdenv.buildPlatform != stdenv.targetPlatform) [
|
||||
"ARCH=${linuxArchMapping."${stdenv.targetPlatform.linuxArch}"}"
|
||||
"CROSS_COMPILE=${stdenv.targetPlatform.config}-"
|
||||
]);
|
||||
|
||||
outputs = [ "out" "dev" "man" ];
|
||||
|
||||
|
@ -58,7 +105,7 @@ stdenv.mkDerivation rec {
|
|||
description = "Userspace checkpoint/restore for Linux";
|
||||
homepage = "https://criu.org";
|
||||
license = licenses.gpl2;
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
|
||||
maintainers = [ maintainers.thoughtpolice ];
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue