summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/darwin/default.nix2
-rw-r--r--pkgs/stdenv/default.nix26
-rw-r--r--pkgs/stdenv/generic/common-path.nix (renamed from pkgs/stdenv/common-path.nix)0
-rw-r--r--pkgs/stdenv/generic/default.nix2
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix106
-rw-r--r--pkgs/stdenv/generic/setup.sh15
-rw-r--r--pkgs/stdenv/linux/bootstrap-files/mips64el.nix25
-rw-r--r--pkgs/stdenv/linux/default.nix8
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools-cross.nix1
-rw-r--r--pkgs/stdenv/nix/default.nix2
10 files changed, 119 insertions, 68 deletions
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index bbc15bad26203..ff56f1de02261 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -683,7 +683,7 @@ rec {
       __stdenvImpureHostDeps = commonImpureHostDeps;
       __extraImpureHostDeps = commonImpureHostDeps;
 
-      initialPath = import ../common-path.nix { inherit pkgs; };
+      initialPath = import ../generic/common-path.nix { inherit pkgs; };
       shell = "${pkgs.bash}/bin/bash";
 
       cc = pkgs."${finalLlvmPackages}".libcxxClang;
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix
index 25a593c67437c..7a2ad665e09d7 100644
--- a/pkgs/stdenv/default.nix
+++ b/pkgs/stdenv/default.nix
@@ -38,28 +38,10 @@ let
 in
   if crossSystem != localSystem || crossOverlays != [] then stagesCross
   else if config ? replaceStdenv then stagesCustom
-  else { # switch
-    i686-linux = stagesLinux;
-    x86_64-linux = stagesLinux;
-    armv5tel-linux = stagesLinux;
-    armv6l-linux = stagesLinux;
-    armv6m-linux = stagesLinux;
-    armv7a-linux = stagesLinux;
-    armv7l-linux = stagesLinux;
-    armv7r-linux = stagesLinux;
-    armv7m-linux = stagesLinux;
-    armv8a-linux = stagesLinux;
-    armv8r-linux = stagesLinux;
-    armv8m-linux = stagesLinux;
-    aarch64-linux = stagesLinux;
-    mipsel-linux = stagesLinux;
-    mips64el-linux = stagesLinux;
-    powerpc-linux = /* stagesLinux */ stagesNative;
-    powerpc64-linux = stagesLinux;
-    powerpc64le-linux = stagesLinux;
-    riscv64-linux = stagesLinux;
-    x86_64-darwin = stagesDarwin;
-    aarch64-darwin = stagesDarwin;
+  else if localSystem.isLinux then stagesLinux
+  else if localSystem.isDarwin then stagesDarwin
+  else # misc special cases
+  { # switch
     x86_64-solaris = stagesNix;
     i686-cygwin = stagesNative;
     x86_64-cygwin = stagesNative;
diff --git a/pkgs/stdenv/common-path.nix b/pkgs/stdenv/generic/common-path.nix
index 8c1acfb50dd68..8c1acfb50dd68 100644
--- a/pkgs/stdenv/common-path.nix
+++ b/pkgs/stdenv/generic/common-path.nix
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 5f49aca5aa919..4fa9ad6de2eec 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -11,6 +11,7 @@ argsStdenv@{ name ? "stdenv", preHook ? "", initialPath
 
 , shell
 , allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config
+, disallowedRequisites ? []
 
 , # The `fetchurl' to use for downloading curl and its dependencies
   # (see all-packages.nix).
@@ -97,6 +98,7 @@ let
     }
     // {
       inherit name;
+      inherit disallowedRequisites;
 
       # Nix itself uses the `system` field of a derivation to decide where to
       # build it. This is a bit confusing for cross compilation.
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index bde8735642d8c..73030e7d941e8 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -178,7 +178,7 @@ let
                             # Except when:
                             #    - static aarch64, where compilation works, but produces segfaulting dynamically linked binaries.
                             #    - static armv7l, where compilation fails.
-                            !((stdenv.hostPlatform.isAarch64 || stdenv.hostPlatform.isAarch32) && stdenv.hostPlatform.isStatic)
+                            !(stdenv.hostPlatform.isAarch && stdenv.hostPlatform.isStatic)
                           then supportedHardeningFlags
                           else lib.remove "pie" supportedHardeningFlags;
   enabledHardeningOptions =
@@ -330,6 +330,74 @@ else let
         ++ optional (elem "host"   configurePlatforms) "--host=${stdenv.hostPlatform.config}"
         ++ optional (elem "target" configurePlatforms) "--target=${stdenv.targetPlatform.config}";
 
+      cmakeFlags =
+        let
+          explicitFlags =
+            if lib.isString cmakeFlags then lib.warn
+                "String 'cmakeFlags' is deprecated and will be removed in release 23.05. Please use a list of strings. Derivation name: ${derivationArg.name}, file: ${pos.file or "unknown file"}"
+                [cmakeFlags]
+            else if cmakeFlags == null then
+              lib.warn
+                "Null 'cmakeFlags' is deprecated and will be removed in release 23.05. Please use a empty list instead '[]'. Derivation name: ${derivationArg.name}, file: ${pos.file or "unknown file"}"
+                []
+            else
+              cmakeFlags;
+
+          crossFlags = [
+            "-DCMAKE_SYSTEM_NAME=${lib.findFirst lib.isString "Generic" (lib.optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}"
+          ] ++ lib.optionals (stdenv.hostPlatform.uname.processor != null) [
+            "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}"
+          ] ++ lib.optionals (stdenv.hostPlatform.uname.release != null) [
+            "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.uname.release}"
+          ] ++ lib.optionals (stdenv.hostPlatform.isDarwin) [
+            "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
+          ] ++ lib.optionals (stdenv.buildPlatform.uname.system != null) [
+            "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}"
+          ] ++ lib.optionals (stdenv.buildPlatform.uname.processor != null) [
+            "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}"
+          ] ++ lib.optionals (stdenv.buildPlatform.uname.release != null) [
+            "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}"
+          ];
+        in
+          explicitFlags ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) crossFlags;
+
+      mesonFlags =
+        let
+          explicitFlags =
+            if lib.isString mesonFlags then lib.warn
+                "String 'mesonFlags' is deprecated and will be removed in release 23.05. Please use a list of strings. Derivation name: ${derivationArg.name}, file: ${pos.file or "unknown file"}"
+                [mesonFlags]
+            else if mesonFlags == null then
+              lib.warn
+                "Null 'mesonFlags' is deprecated and will be removed in release 23.05. Please use a empty list instead '[]'. Derivation name: ${derivationArg.name}, file: ${pos.file or "unknown file"}"
+                []
+            else
+              mesonFlags;
+
+          # See https://mesonbuild.com/Reference-tables.html#cpu-families
+          cpuFamily = platform: with platform;
+            /**/ if isAarch32 then "arm"
+            else if isAarch64 then "aarch64"
+            else if isx86_32  then "x86"
+            else if isx86_64  then "x86_64"
+            else platform.parsed.cpu.family + builtins.toString platform.parsed.cpu.bits;
+
+          crossFile = builtins.toFile "cross-file.conf" ''
+            [properties]
+            needs_exe_wrapper = true
+
+            [host_machine]
+            system = '${stdenv.targetPlatform.parsed.kernel.name}'
+            cpu_family = '${cpuFamily stdenv.targetPlatform}'
+            cpu = '${stdenv.targetPlatform.parsed.cpu.name}'
+            endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"}
+
+            [binaries]
+            llvm-config = 'llvm-config-native'
+          '';
+          crossFlags = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];
+        in crossFlags ++ explicitFlags;
+
       inherit patches;
 
       inherit doCheck doInstallCheck;
@@ -341,42 +409,6 @@ else let
       # most people won't care about these anyways
       outputHashAlgo = attrs.outputHashAlgo or "sha256";
       outputHashMode = attrs.outputHashMode or "recursive";
-    } // lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform) {
-      cmakeFlags =
-        (/**/ if lib.isString cmakeFlags then [cmakeFlags]
-         else if cmakeFlags == null      then []
-         else                                     cmakeFlags)
-      ++ [ "-DCMAKE_SYSTEM_NAME=${lib.findFirst lib.isString "Generic" (
-           lib.optional (!stdenv.hostPlatform.isRedox) stdenv.hostPlatform.uname.system)}"]
-      ++ lib.optional (stdenv.hostPlatform.uname.processor != null) "-DCMAKE_SYSTEM_PROCESSOR=${stdenv.hostPlatform.uname.processor}"
-      ++ lib.optional (stdenv.hostPlatform.uname.release != null) "-DCMAKE_SYSTEM_VERSION=${stdenv.hostPlatform.uname.release}"
-      ++ lib.optional (stdenv.hostPlatform.isDarwin) "-DCMAKE_OSX_ARCHITECTURES=${stdenv.hostPlatform.darwinArch}"
-      ++ lib.optional (stdenv.buildPlatform.uname.system != null) "-DCMAKE_HOST_SYSTEM_NAME=${stdenv.buildPlatform.uname.system}"
-      ++ lib.optional (stdenv.buildPlatform.uname.processor != null) "-DCMAKE_HOST_SYSTEM_PROCESSOR=${stdenv.buildPlatform.uname.processor}"
-      ++ lib.optional (stdenv.buildPlatform.uname.release != null) "-DCMAKE_HOST_SYSTEM_VERSION=${stdenv.buildPlatform.uname.release}";
-
-      mesonFlags = if mesonFlags == null then null else let
-        # See https://mesonbuild.com/Reference-tables.html#cpu-families
-        cpuFamily = platform: with platform;
-          /**/ if isAarch32 then "arm"
-          else if isAarch64 then "aarch64"
-          else if isx86_32  then "x86"
-          else if isx86_64  then "x86_64"
-          else platform.parsed.cpu.family + builtins.toString platform.parsed.cpu.bits;
-        crossFile = builtins.toFile "cross-file.conf" ''
-          [properties]
-          needs_exe_wrapper = true
-
-          [host_machine]
-          system = '${stdenv.targetPlatform.parsed.kernel.name}'
-          cpu_family = '${cpuFamily stdenv.targetPlatform}'
-          cpu = '${stdenv.targetPlatform.parsed.cpu.name}'
-          endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"}
-
-          [binaries]
-          llvm-config = 'llvm-config-native'
-        '';
-      in [ "--cross-file=${crossFile}" ] ++ mesonFlags;
     } // lib.optionalAttrs (enableParallelBuilding) {
       enableParallelChecking = attrs.enableParallelChecking or true;
     } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != [] || stdenv.hostPlatform.isMusl) {
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index de8d13160f932..0ba8d10182337 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -771,9 +771,18 @@ substitute() {
 }
 
 substituteInPlace() {
-    local fileName="$1"
-    shift
-    substitute "$fileName" "$fileName" "$@"
+    local -a fileNames=()
+    for arg in "$@"; do
+        if [[ "$arg" = "--"* ]]; then
+            break
+        fi
+        fileNames+=("$arg")
+        shift
+    done
+
+    for file in "${fileNames[@]}"; do
+        substitute "$file" "$file" "$@"
+    done
 }
 
 _allFlags() {
diff --git a/pkgs/stdenv/linux/bootstrap-files/mips64el.nix b/pkgs/stdenv/linux/bootstrap-files/mips64el.nix
new file mode 100644
index 0000000000000..452a247fb0b9c
--- /dev/null
+++ b/pkgs/stdenv/linux/bootstrap-files/mips64el.nix
@@ -0,0 +1,25 @@
+#
+# Files came from this Hydra build:
+#
+#   https://hydra.nixos.org/build/182757245
+#
+# Which used nixpkgs revision ef3fe254f3c59455386bc92fe84164f9679b92b1
+# to instantiate:
+#
+#   /nix/store/a2bvv663wjnyhq8m7v84aspsd3sgf9h6-stdenv-bootstrap-tools-mips64el-unknown-linux-gnuabi64.drv
+#
+# and then built:
+#
+#   /nix/store/aw3dmsrh22831l83vi3q9apg9qi3x8ms-stdenv-bootstrap-tools-mips64el-unknown-linux-gnuabi64
+#
+{
+  busybox = import <nix/fetchurl.nix> {
+    url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/busybox";
+    sha256 = "sha256-sTE58ofjqAqX3Xtq1g9wDxzIe6Vo//GHbicfqJoivDI=";
+    executable = true;
+  };
+  bootstrapTools =import <nix/fetchurl.nix> {
+    url = "http://tarballs.nixos.org/stdenv-linux/mips64el/ef3fe254f3c59455386bc92fe84164f9679b92b1/bootstrap-tools.tar.xz";
+    sha256 = "sha256-tTgjeXpd2YgnfP4JvRuO0bXd2j8GqzBcd57JI3wH9x0=";
+  };
+}
diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix
index 880286bbcd2f1..7c0209b33aedd 100644
--- a/pkgs/stdenv/linux/default.nix
+++ b/pkgs/stdenv/linux/default.nix
@@ -16,6 +16,7 @@
       armv7l-linux = import ./bootstrap-files/armv7l.nix;
       aarch64-linux = import ./bootstrap-files/aarch64.nix;
       mipsel-linux = import ./bootstrap-files/loongson2f.nix;
+      mips64el-linux = import ./bootstrap-files/mips64el.nix;
       powerpc64le-linux = import ./bootstrap-files/powerpc64le.nix;
       riscv64-linux = import ./bootstrap-files/riscv64.nix;
     };
@@ -355,9 +356,6 @@ in
       #   stage5.gcc -> stage4.coreutils -> stage3.glibc -> bootstrap
       gmp = lib.makeOverridable (super.gmp.override { stdenv = self.stdenv; }).overrideAttrs (a: { pname = "${a.pname}-stage4"; });
 
-      # coreutils gets rebuilt both here and also in the final stage; we rename this one to avoid confusion
-      coreutils = super.coreutils.overrideAttrs (a: { pname = "${a.pname}-stage4"; });
-
       gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) {
         nativeTools = false;
         nativeLibc = false;
@@ -399,7 +397,7 @@ in
       preHook = commonPreHook;
 
       initialPath =
-        ((import ../common-path.nix) {pkgs = prevStage;});
+        ((import ../generic/common-path.nix) {pkgs = prevStage;});
 
       extraNativeBuildInputs = [ prevStage.patchelf ] ++
         # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
@@ -423,6 +421,8 @@ in
         shellPackage = prevStage.bash;
       };
 
+      disallowedRequisites = [ bootstrapTools.out ];
+
       # Mainly avoid reference to bootstrap tools
       allowedRequisites = with prevStage; with lib;
         # Simple executable tools
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index 2665330206e1c..d9105c8c44993 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -23,6 +23,7 @@ in lib.mapAttrs (n: make) (with lib.systems.examples; {
   riscv64 = riscv64;
   mips64el-linux-gnuabin32 = mips64el-linux-gnuabin32;
   mips64el-linux-gnuabi64  = mips64el-linux-gnuabi64;
+  mipsel-linux-gnu         = mipsel-linux-gnu;
   powerpc64 = ppc64;
   powerpc64-musl = ppc64-musl;
   powerpc64le = powernv;
diff --git a/pkgs/stdenv/nix/default.nix b/pkgs/stdenv/nix/default.nix
index 2fb19992bc1ef..e9e9936ccd801 100644
--- a/pkgs/stdenv/nix/default.nix
+++ b/pkgs/stdenv/nix/default.nix
@@ -21,7 +21,7 @@ bootStages ++ [
         export NIX_IGNORE_LD_THROUGH_GCC=1
       '';
 
-      initialPath = (import ../common-path.nix) { pkgs = prevStage; };
+      initialPath = (import ../generic/common-path.nix) { pkgs = prevStage; };
 
       cc = import ../../build-support/cc-wrapper {
         inherit lib;