about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix')
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix72
1 files changed, 72 insertions, 0 deletions
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
new file mode 100644
index 0000000000000..ba458ef5c712f
--- /dev/null
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/sys/base.nix
@@ -0,0 +1,72 @@
+{ 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 ];
+
+}