Merge pull request #268204 from astro/netbsd-sys

netbsd.sys: fix build
This commit is contained in:
Weijia Wang 2023-12-01 10:10:43 +01:00 committed by GitHub
commit fa0c0b006e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
"AR=${stdenv.cc.targetPrefix}ar"
];
env = lib.optionalAttrs stdenv.cc.isClang {
env = lib.optionalAttrs (stdenv.isDarwin && stdenv.cc.isClang) {
NIX_CFLAGS_COMPILE = "-Wno-implicit-function-declaration";
};

View File

@ -603,6 +603,12 @@ in makeScopeWithSplicing' {
version = "9.2";
sha256 = "03s18q8d9giipf05bx199fajc2qwikji0djz7hw63d2lya6bfnpj";
# Make the build ignore linker warnings
prePatch = ''
substituteInPlace sys/conf/Makefile.kern.inc \
--replace "-Wa,--fatal-warnings" ""
'';
patches = [
# Fix this error when building bootia32.efi and bootx64.efi:
# error: PHDR segment not covered by LOAD segment
@ -612,8 +618,13 @@ in makeScopeWithSplicing' {
./sys-headers-incsdir.patch
];
# multiple header dirs, see above
inherit (self.include) postPatch;
postPatch =
''
substituteInPlace sys/arch/i386/stand/efiboot/Makefile.efiboot \
--replace "-nocombreloc" "-z nocombreloc"
'' +
# multiple header dirs, see above
self.include.postPatch;
CONFIG = "GENERIC";
@ -634,7 +645,11 @@ in makeScopeWithSplicing' {
makeFlags = defaultMakeFlags ++ [ "FIRMWAREDIR=$(out)/libdata/firmware" ];
hardeningDisable = [ "pic" ];
MKKMOD = "no";
env.NIX_CFLAGS_COMPILE = toString [ "-Wa,--no-warn" ];
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=array-parameter"
"-Wno-error=array-bounds"
"-Wa,--no-warn"
];
postBuild = ''
make -C arch/$MACHINE/compile/$CONFIG $makeFlags