about summary refs log tree commit diff
path: root/pkgs/os-specific/bsd
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2024-06-21 07:48:24 +0200
committerVladimír Čunát <v@cunat.cz>2024-06-21 07:48:24 +0200
commit879821772ca78519aec914983c3aa2cd77e90c1d (patch)
tree5d837f3e0f32541ab0a4919260f5b02f0a8fb919 /pkgs/os-specific/bsd
parent7154858e82d91010bb1289727b606687f32d1b92 (diff)
Revert #320852: Clean up cross bootstrapping
It rebuilt stdenv on *-darwin; we can't do that in nixpkgs master.
This reverts commit 2f20501c5f188ab0c4c430519ce77bc6b988202b, reversing
changes made to fd469c24af2e16aad2c2b4fc90fc8c74af36e773.
Diffstat (limited to 'pkgs/os-specific/bsd')
-rw-r--r--pkgs/os-specific/bsd/freebsd/default.nix62
-rw-r--r--pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix12
-rw-r--r--pkgs/os-specific/bsd/netbsd/default.nix8
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/csu.nix5
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/include.nix1
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix1
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/libc.nix6
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/librt.nix5
-rw-r--r--pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix10
-rw-r--r--pkgs/os-specific/bsd/openbsd/default.nix21
-rw-r--r--pkgs/os-specific/bsd/openbsd/pkgs/csu.nix1
-rw-r--r--pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix11
-rw-r--r--pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix1
-rw-r--r--pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix1
-rw-r--r--pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix15
15 files changed, 76 insertions, 84 deletions
diff --git a/pkgs/os-specific/bsd/freebsd/default.nix b/pkgs/os-specific/bsd/freebsd/default.nix
index cfe6080b020a0..e56c70c1d32d0 100644
--- a/pkgs/os-specific/bsd/freebsd/default.nix
+++ b/pkgs/os-specific/bsd/freebsd/default.nix
@@ -3,6 +3,7 @@
   makeScopeWithSplicing',
   generateSplicesForMkScope,
   callPackage,
+  crossLibcStdenv,
   attributePathToSplice ? [ "freebsd" ],
   branch ? "release/14.0.0",
 }:
@@ -23,30 +24,41 @@ let
       Branches can be selected by overriding the `branch` attribute on the freebsd package set.
     '';
 
-  # we do not include the branch in the splice here because the branch
-  # parameter to this file will only ever take on one value - more values
-  # are provided through overrides.
-  otherSplices = generateSplicesForMkScope attributePathToSplice;
+  # `./package-set.nix` should never know the name of the package set we
+  # are constructing; just this function is allowed to know that. This
+  # is why we:
+  #
+  #  - do the splicing for cross compilation here
+  #
+  #  - construct the *anonymized* `buildFreebsd` attribute to be passed
+  #    to `./package-set.nix`.
+  callFreeBSDWithAttrs =
+    extraArgs:
+    let
+      # we do not include the branch in the splice here because the branch
+      # parameter to this file will only ever take on one value - more values
+      # are provided through overrides.
+      otherSplices = generateSplicesForMkScope attributePathToSplice;
+    in
+    makeScopeWithSplicing' {
+      inherit otherSplices;
+      f =
+        self:
+        {
+          inherit branch;
+        }
+        // callPackage ./package-set.nix (
+          {
+            sourceData = versions.${self.branch} or (throw (badBranchError self.branch));
+            versionData = self.sourceData.version;
+            buildFreebsd = otherSplices.selfBuildHost;
+            patchesRoot = ./patches + "/${self.versionData.revision}";
+          }
+          // extraArgs
+        ) self;
+    };
 in
-# `./package-set.nix` should never know the name of the package set we
-# are constructing; just this function is allowed to know that. This
-# is why we:
-#
-#  - do the splicing for cross compilation here
-#
-#  - construct the *anonymized* `buildFreebsd` attribute to be passed
-#    to `./package-set.nix`.
-makeScopeWithSplicing' {
-  inherit otherSplices;
-  f =
-    self:
-    {
-      inherit branch;
-    }
-    // callPackage ./package-set.nix ({
-      sourceData = versions.${self.branch} or (throw (badBranchError self.branch));
-      versionData = self.sourceData.version;
-      buildFreebsd = otherSplices.selfBuildHost;
-      patchesRoot = ./patches + "/${self.versionData.revision}";
-    }) self;
+{
+  freebsd = callFreeBSDWithAttrs { };
+  freebsdCross = callFreeBSDWithAttrs { stdenv = crossLibcStdenv; };
 }
diff --git a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
index e20b94336d577..12f2c9407e3c2 100644
--- a/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/freebsd/pkgs/mkDerivation.nix
@@ -2,7 +2,7 @@
   lib,
   stdenv,
   stdenvNoCC,
-  stdenvNoLibc,
+  stdenvNoLibs,
   overrideCC,
   buildPackages,
   versionData,
@@ -28,7 +28,7 @@ lib.makeOverridable (
       if attrs.noCC or false then
         stdenvNoCC
       else if attrs.noLibc or false then
-        stdenvNoLibc
+        stdenvNoLibs
       else if attrs.noLibcxx or false then
         overrideCC stdenv buildPackages.llvmPackages.clangNoLibcxx
       else
@@ -58,9 +58,12 @@ lib.makeOverridable (
 
       HOST_SH = stdenv'.shell;
 
+      # Since STRIP below is the flag
+      STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip";
+
       makeFlags = [
         "STRIP=-s" # flag to install, not command
-      ] ++ lib.optional (!stdenv'.hostPlatform.isFreeBSD) "MK_WERROR=no";
+      ] ++ lib.optional (!stdenv.hostPlatform.isFreeBSD) "MK_WERROR=no";
 
       # amd64 not x86_64 for this on unlike NetBSD
       MACHINE_ARCH = freebsd-lib.mkBsdArch stdenv';
@@ -88,9 +91,6 @@ lib.makeOverridable (
     // lib.optionalAttrs stdenv'.hasCC {
       # TODO should CC wrapper set this?
       CPP = "${stdenv'.cc.targetPrefix}cpp";
-
-      # Since STRIP in `makeFlags` has to be a flag, not the binary itself
-      STRIPBIN = "${stdenv'.cc.bintools.targetPrefix}strip";
     }
     // lib.optionalAttrs stdenv'.isDarwin { MKRELRO = "no"; }
     // lib.optionalAttrs (stdenv'.cc.isClang or false) {
diff --git a/pkgs/os-specific/bsd/netbsd/default.nix b/pkgs/os-specific/bsd/netbsd/default.nix
index 7440666b4d795..5f5ec212f2698 100644
--- a/pkgs/os-specific/bsd/netbsd/default.nix
+++ b/pkgs/os-specific/bsd/netbsd/default.nix
@@ -1,4 +1,5 @@
 {
+  stdenv,
   lib,
   stdenvNoCC,
   makeScopeWithSplicing',
@@ -20,9 +21,7 @@ makeScopeWithSplicing' {
 
       defaultMakeFlags = [
         "MKSOFTFLOAT=${
-          if
-            stdenvNoCC.hostPlatform.gcc.float or (stdenvNoCC.hostPlatform.parsed.abi.float or "hard") == "soft"
-          then
+          if stdenv.hostPlatform.gcc.float or (stdenv.hostPlatform.parsed.abi.float or "hard") == "soft" then
             "yes"
           else
             "no"
@@ -37,6 +36,7 @@ makeScopeWithSplicing' {
       # because of the splices.
 
       mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
+        inherit stdenv stdenvNoCC;
         inherit (buildPackages.netbsd)
           netbsdSetupHook
           makeMinimal
@@ -129,7 +129,7 @@ makeScopeWithSplicing' {
       libpthread-headers = self.callPackage ./pkgs/libpthread/headers.nix { };
 
       csu = self.callPackage ./pkgs/csu.nix {
-        inherit (self) headers sys-headers ld_elf_so;
+        inherit (self) headers sys ld_elf_so;
         inherit (buildPackages.netbsd)
           netbsdSetupHook
           makeMinimal
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
index ea78f338c5339..a0d7ca419c1c4 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/csu.nix
@@ -16,12 +16,11 @@
   statHook,
   rsync,
   headers,
-  sys-headers,
+  sys,
   ld_elf_so,
 }:
 
 mkDerivation {
-  noLibc = true;
   path = "lib/csu";
   meta.platforms = lib.platforms.netbsd;
   nativeBuildInputs = [
@@ -42,7 +41,7 @@ mkDerivation {
   ];
   buildInputs = [ headers ];
   extraPaths = [
-    sys-headers.path
+    sys.path
     ld_elf_so.path
   ];
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
index a43a93847b23f..6df34b96095e7 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/include.nix
@@ -15,7 +15,6 @@
 }:
 
 mkDerivation {
-  noLibc = true;
   path = "include";
   nativeBuildInputs = [
     bsdSetupHook
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
index 4116312b9625c..7f25ce097ff0d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/ld_elf_so.nix
@@ -6,7 +6,6 @@
 }:
 
 mkDerivation {
-  noLibc = true;
   path = "libexec/ld.elf_so";
   meta.platforms = lib.platforms.netbsd;
   LIBC_PIC = "${libc}/lib/libc_pic.a";
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
index d6b14445acd46..cf71857776d83 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/libc.nix
@@ -24,7 +24,6 @@
 }:
 
 mkDerivation {
-  noLibc = true;
   path = "lib/libc";
   USE_FORT = "yes";
   MKPROFILE = "no";
@@ -95,8 +94,5 @@ mkDerivation {
     make -C $BSDSRCDIR/lib/libcrypt $makeFlags
     make -C $BSDSRCDIR/lib/libcrypt $makeFlags install
   '';
-  postPatch = ''
-    sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' \
-      $BSDSRCDIR/lib/{libc,librt}/sys/Makefile.inc
-  '';
+  inherit (librt) postPatch;
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
index 87cd3092f1b15..4e4bf0bc5ac4b 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/librt.nix
@@ -9,5 +9,8 @@ mkDerivation {
   path = "lib/librt";
   meta.platforms = lib.platforms.netbsd;
   extraPaths = [ libc.path ] ++ libc.extraPaths;
-  inherit (libc) postPatch;
+  postPatch = ''
+    sed -i 's,/usr\(/include/sys/syscall.h\),${headers}\1,g' \
+      $BSDSRCDIR/lib/{libc,librt}/sys/Makefile.inc
+  '';
 }
diff --git a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
index 5fb082e9d17f9..f4f103087587d 100644
--- a/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/netbsd/pkgs/mkDerivation.nix
@@ -2,7 +2,7 @@
   lib,
   stdenv,
   stdenvNoCC,
-  stdenvNoLibc,
+  crossLibcStdenv,
   runCommand,
   rsync,
   source,
@@ -23,13 +23,7 @@
 lib.makeOverridable (
   attrs:
   let
-    stdenv' =
-      if attrs.noCC or false then
-        stdenvNoCC
-      else if attrs.noLibc or false then
-        stdenvNoLibc
-      else
-        stdenv;
+    stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
   in
   stdenv'.mkDerivation (
     rec {
diff --git a/pkgs/os-specific/bsd/openbsd/default.nix b/pkgs/os-specific/bsd/openbsd/default.nix
index bfc88f097865f..00dba195b92f5 100644
--- a/pkgs/os-specific/bsd/openbsd/default.nix
+++ b/pkgs/os-specific/bsd/openbsd/default.nix
@@ -1,17 +1,16 @@
 {
+  stdenv,
   lib,
+  stdenvNoCC,
   makeScopeWithSplicing',
   generateSplicesForMkScope,
+  pkgs,
   buildPackages,
+  netbsd,
 }:
 
-let
-  otherSplices = generateSplicesForMkScope "openbsd";
-  buildOpenbsd = otherSplices.selfBuildHost;
-in
-
 makeScopeWithSplicing' {
-  inherit otherSplices;
+  otherSplices = generateSplicesForMkScope "openbsd";
   f = (
     self:
     lib.packagesFromDirectoryRecursive {
@@ -20,8 +19,8 @@ makeScopeWithSplicing' {
     }
     // {
       libc = self.callPackage ./pkgs/libc/package.nix {
-        inherit (self) csu include;
-        inherit (buildOpenbsd) makeMinimal;
+        inherit (self) csu include lorder;
+        inherit (buildPackages.openbsd) makeMinimal;
         inherit (buildPackages.netbsd)
           install
           gencat
@@ -31,16 +30,16 @@ makeScopeWithSplicing' {
       };
       makeMinimal = buildPackages.netbsd.makeMinimal.override { inherit (self) make-rules; };
       mkDerivation = self.callPackage ./pkgs/mkDerivation.nix {
+        inherit stdenv;
         inherit (buildPackages.netbsd) install;
-        inherit (buildPackages.buildPackages) rsync;
       };
       include = self.callPackage ./pkgs/include/package.nix {
-        inherit (buildOpenbsd) makeMinimal;
+        inherit (buildPackages.openbsd) makeMinimal;
         inherit (buildPackages.netbsd) install rpcgen mtree;
       };
       csu = self.callPackage ./pkgs/csu.nix {
         inherit (self) include;
-        inherit (buildOpenbsd) makeMinimal;
+        inherit (buildPackages.openbsd) makeMinimal;
         inherit (buildPackages.netbsd) install;
       };
       make-rules = self.callPackage ./pkgs/make-rules/package.nix { };
diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix b/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix
index 03a7180425684..a2b2153a729b1 100644
--- a/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix
+++ b/pkgs/os-specific/bsd/openbsd/pkgs/csu.nix
@@ -9,7 +9,6 @@
 }:
 
 mkDerivation {
-  noLibc = true;
   path = "lib/csu";
   nativeBuildInputs = [
     bsdSetupHook
diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix
index 03fd256eee9d7..cf233c827840a 100644
--- a/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix
+++ b/pkgs/os-specific/bsd/openbsd/pkgs/libc/package.nix
@@ -1,6 +1,6 @@
 {
   lib,
-  stdenvNoLibc,
+  stdenv,
   mkDerivation,
   bsdSetupHook,
   openbsdSetupHook,
@@ -10,6 +10,7 @@
   byacc,
   gencat,
   rpcgen,
+  lorder,
   csu,
   include,
   ctags,
@@ -18,8 +19,7 @@
   fetchpatch,
 }:
 
-mkDerivation {
-  noLibc = true;
+mkDerivation rec {
   pname = "libc";
   path = "lib/libc";
   extraPaths = [
@@ -53,6 +53,7 @@ mkDerivation {
     gencat
     rpcgen
     ctags
+    lorder
     tsort
   ];
 
@@ -68,9 +69,7 @@ mkDerivation {
 
   # Suppress lld >= 16 undefined version errors
   # https://github.com/freebsd/freebsd-src/commit/2ba84b4bcdd6012e8cfbf8a0d060a4438623a638
-  env.NIX_LDFLAGS = lib.optionalString (
-    stdenvNoLibc.hostPlatform.linker == "lld"
-  ) "--undefined-version";
+  env.NIX_LDFLAGS = lib.optionalString (stdenv.hostPlatform.linker == "lld") "--undefined-version";
 
   makeFlags = [
     "STRIP=-s" # flag to install, not command
diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix b/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix
index c923a84317682..25ff1fcbd14f6 100644
--- a/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix
+++ b/pkgs/os-specific/bsd/openbsd/pkgs/lorder.nix
@@ -8,7 +8,6 @@
 }:
 
 mkDerivation {
-  noCC = true;
   path = "usr.bin/lorder";
   nativeBuildInputs = [
     bsdSetupHook
diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix b/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix
index fefa1136eb76d..1e7c705c0dfd0 100644
--- a/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix
+++ b/pkgs/os-specific/bsd/openbsd/pkgs/make-rules/package.nix
@@ -2,6 +2,7 @@
   fetchpatch,
   lib,
   mkDerivation,
+  stdenv,
 }:
 
 mkDerivation {
diff --git a/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix b/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix
index 5d7b67502cf7a..6c5bc5cd17193 100644
--- a/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix
+++ b/pkgs/os-specific/bsd/openbsd/pkgs/mkDerivation.nix
@@ -2,7 +2,6 @@
   lib,
   stdenv,
   stdenvNoCC,
-  stdenvNoLibc,
   runCommand,
   rsync,
   source,
@@ -15,13 +14,7 @@
 lib.makeOverridable (
   attrs:
   let
-    stdenv' =
-      if attrs.noCC or false then
-        stdenvNoCC
-      else if attrs.noLibc or false then
-        stdenvNoLibc
-      else
-        stdenv;
+    stdenv' = if attrs.noCC or false then stdenvNoCC else stdenv;
   in
   stdenv'.mkDerivation (
     rec {
@@ -50,6 +43,9 @@ lib.makeOverridable (
 
       HOST_SH = stdenv'.shell;
 
+      # Since STRIP below is the flag
+      STRIPBIN = "${stdenv.cc.bintools.targetPrefix}strip";
+
       makeFlags = [
         "STRIP=-s" # flag to install, not command
         "-B"
@@ -85,9 +81,6 @@ lib.makeOverridable (
     // lib.optionalAttrs stdenv'.hasCC {
       # TODO should CC wrapper set this?
       CPP = "${stdenv'.cc.targetPrefix}cpp";
-
-      # Since STRIP in `makeFlags` has to be a flag, not the binary itself
-      STRIPBIN = "${stdenv'.cc.bintools.targetPrefix}strip";
     }
     // lib.optionalAttrs (attrs.headersOnly or false) {
       installPhase = "includesPhase";