diff options
author | Ryan Burns <52847440+r-burns@users.noreply.github.com> | 2022-11-06 20:16:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-06 20:16:49 -0800 |
commit | 5a81fe36846b9e8f9e8aef91e9cc80900f9e3408 (patch) | |
tree | 6aea2172738518bce8d275213f4e460aff1c7d47 /pkgs/os-specific/linux/kernel-headers | |
parent | 256b838850db66a9278d4bfe1b23ea262a37d80a (diff) | |
parent | b45cf446ea501649bdccef866fb01e5b1042143c (diff) | |
download | nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.tar nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.tar.gz nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.tar.bz2 nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.tar.lz nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.tar.xz nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.tar.zst nixpkgs-5a81fe36846b9e8f9e8aef91e9cc80900f9e3408.zip |
Merge pull request #196502 from r-burns/mips-darwin-cross
linuxHeaders: fix darwin -> linux-mips cross-compilation
Diffstat (limited to 'pkgs/os-specific/linux/kernel-headers')
-rw-r--r-- | pkgs/os-specific/linux/kernel-headers/default.nix | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix index ebf20a015c0..d8bfb59bf12 100644 --- a/pkgs/os-specific/linux/kernel-headers/default.nix +++ b/pkgs/os-specific/linux/kernel-headers/default.nix @@ -1,11 +1,37 @@ { stdenvNoCC, lib, buildPackages, fetchurl, perl, elf-header , bison ? null, flex ? null, python ? null, rsync ? null +, writeTextFile }: assert stdenvNoCC.hostPlatform.isAndroid -> (flex != null && bison != null && python != null && rsync != null); let + + # As part of building a hostPlatform=mips kernel, Linux creates and runs a + # tiny utility `arch/mips/boot/tools/relocs_main.c` for the buildPlatform. + # This utility references a glibc-specific header `byteswap.h`. There is a + # compatibility header in gnulib for most BSDs, but not for Darwin, so we + # synthesize one here. + darwin-endian-h = writeTextFile { + name = "endian-h"; + text = '' + #include <byteswap.h> + ''; + destination = "/include/endian.h"; + }; + darwin-byteswap-h = writeTextFile { + name = "byteswap-h"; + text = '' + #pragma once + #include <libkern/OSByteOrder.h> + #define bswap_16 OSSwapInt16 + #define bswap_32 OSSwapInt32 + #define bswap_64 OSSwapInt64 + ''; + destination = "/include/byteswap.h"; + }; + makeLinuxHeaders = { src, version, patches ? [] }: stdenvNoCC.mkDerivation { inherit src; @@ -25,6 +51,10 @@ let perl elf-header ] ++ lib.optionals stdenvNoCC.hostPlatform.isAndroid [ flex bison python rsync + ] ++ lib.optionals (stdenvNoCC.buildPlatform.isDarwin && + stdenvNoCC.hostPlatform.isMips) [ + darwin-endian-h + darwin-byteswap-h ]; extraIncludeDirs = lib.optionals (with stdenvNoCC.hostPlatform; isPower && is32bit && isBigEndian) ["ppc"]; |