nixpkgs/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
2024-05-06 10:59:45 -04:00

94 lines
1.8 KiB
Nix

{
lib,
mkDerivation,
include,
bsdSetupHook,
netbsdSetupHook,
makeMinimal,
install,
tsort,
lorder,
statHook,
rsync,
uudecode,
config,
genassym,
defaultMakeFlags,
common,
}:
{
path = "sys";
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
./no-dynamic-linker.patch
# multiple header dirs, see above
./sys-headers-incsdir.patch
];
postPatch =
''
substituteInPlace sys/arch/i386/stand/efiboot/Makefile.efiboot \
--replace "-nocombreloc" "-z nocombreloc"
''
+
# multiple header dirs, see above
include.postPatch;
CONFIG = "GENERIC";
propagatedBuildInputs = [ include ];
nativeBuildInputs = [
bsdSetupHook
netbsdSetupHook
makeMinimal
install
tsort
lorder
statHook
rsync
uudecode
config
genassym
];
postConfigure =
''
pushd arch/$MACHINE/conf
config $CONFIG
popd
''
# multiple header dirs, see above
+ include.postConfigure;
makeFlags = defaultMakeFlags ++ [ "FIRMWAREDIR=$(out)/libdata/firmware" ];
hardeningDisable = [ "pic" ];
MKKMOD = "no";
env.NIX_CFLAGS_COMPILE = toString [
"-Wno-error=array-parameter"
"-Wno-error=array-bounds"
"-Wa,--no-warn"
];
postBuild = ''
make -C arch/$MACHINE/compile/$CONFIG $makeFlags
'';
postInstall = ''
cp arch/$MACHINE/compile/$CONFIG/netbsd $out
'';
meta.platforms = lib.platforms.netbsd;
extraPaths = [ common ];
}