From 92ec26ce8d59d6856fb4f5ee4d1b74c654ca6eda Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 19 Nov 2023 01:33:38 +0100 Subject: [PATCH 1/3] cvs: fix CFLAGS only on darwin Fixes build for pkgsCross.x86_64-netbsd.netbsd.sys --- pkgs/applications/version-management/cvs/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/version-management/cvs/default.nix b/pkgs/applications/version-management/cvs/default.nix index 4ee553c6c4be..20a38f9f8e8c 100644 --- a/pkgs/applications/version-management/cvs/default.nix +++ b/pkgs/applications/version-management/cvs/default.nix @@ -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"; }; From 26b585aa7b1291580fd2152f5c1295731ced6b9a Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 20 Nov 2023 00:55:06 +0100 Subject: [PATCH 2/3] netbsd.sys: make compiler and linker warnings non-fatal --- pkgs/os-specific/bsd/netbsd/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index 5012a0c7d3c7..fc6dfa834926 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -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 @@ -634,7 +640,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 From 32ec12551fba06ca890566bf85b1e3d569fe49a7 Mon Sep 17 00:00:00 2001 From: Astro Date: Mon, 20 Nov 2023 03:20:50 +0100 Subject: [PATCH 3/3] netbsd.sys: patch nocombreloc linker flag --- pkgs/os-specific/bsd/netbsd/default.nix | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix index fc6dfa834926..c44936ddcb47 100644 --- a/pkgs/os-specific/bsd/netbsd/default.nix +++ b/pkgs/os-specific/bsd/netbsd/default.nix @@ -618,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";