diff options
author | Artturi <Artturin@artturin.com> | 2023-01-31 14:12:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-31 14:12:40 +0200 |
commit | d289affac300cee2ff1567eec8b763e4f3944a0e (patch) | |
tree | e63a596e97068513026f6c48bd12d7ea4801e043 /pkgs/os-specific | |
parent | 856e4d87269a2e2c52f414f04070fcecbbae4118 (diff) | |
parent | f9a1d83cdbf4154b71bf2eb817c94060b304929b (diff) |
Merge pull request #213609 from lschuermann/dev/criu-cross-compile
Diffstat (limited to 'pkgs/os-specific')
-rw-r--r-- | pkgs/os-specific/linux/criu/default.nix | 59 |
1 files changed, 53 insertions, 6 deletions
diff --git a/pkgs/os-specific/linux/criu/default.nix b/pkgs/os-specific/linux/criu/default.nix index 5475a565b09ba..71bde6220a02d 100644 --- a/pkgs/os-specific/linux/criu/default.nix +++ b/pkgs/os-specific/linux/criu/default.nix @@ -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 ]; }; } |