about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorgithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2023-12-02 00:02:46 +0000
committerGitHub <noreply@github.com>2023-12-02 00:02:46 +0000
commit69b4efbbbe65a6141750b20bd9bb8c68529661c0 (patch)
tree1395754c9d9cc142a58d87b5269b7b081d9ef988 /pkgs/development/compilers
parente4f5cbeca56dfa81e3c86dae39af356ecce10f16 (diff)
parent5d5c0a00c7c07dad5ef1adf767f949233a44e1c5 (diff)
downloadnixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.tar
nixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.tar.gz
nixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.tar.bz2
nixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.tar.lz
nixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.tar.xz
nixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.tar.zst
nixlib-69b4efbbbe65a6141750b20bd9bb8c68529661c0.zip
Merge staging-next into staging
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/gcc/default.nix90
1 files changed, 47 insertions, 43 deletions
diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix
index 01f172513080..57141ba23e2e 100644
--- a/pkgs/development/compilers/gcc/default.nix
+++ b/pkgs/development/compilers/gcc/default.nix
@@ -259,7 +259,6 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
     else [ "out" "lib" "man" "info" ];
 
   setOutputFlags = false;
-  NIX_NO_SELF_RPATH = true;
 
   libc_dev = stdenv.cc.libc_dev;
 
@@ -353,44 +352,55 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
   # https://gcc.gnu.org/PR109898
   enableParallelInstalling = false;
 
-  # https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
-
-  # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
-  # library headers and binaries, regarless of the language being compiled.
-  #
-  # Note: When building the Java AWT GTK peer, the build system doesn't honor
-  # `--with-gmp' et al., e.g., when building
-  # `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
-  # them to $CPATH and $LIBRARY_PATH in this case.
-  #
-  # Likewise, the LTO code doesn't find zlib.
-  #
-  # Cross-compiling, we need gcc not to read ./specs in order to build the g++
-  # compiler (after the specs for the cross-gcc are created). Having
-  # LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
-
-  CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
-    ++ optional (zlib != null) zlib
-    ++ optional langJava boehmgc
-    ++ optionals javaAwtGtk xlibs
-    ++ optionals javaAwtGtk [ gmp mpfr ]
-  ));
-
-  LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (
-    optional (zlib != null) zlib
-    ++ optional langJava boehmgc
-    ++ optionals javaAwtGtk xlibs
-    ++ optionals javaAwtGtk [ gmp mpfr ]
-  ));
-
-  inherit (callFile ./common/extra-target-flags.nix { })
-    EXTRA_FLAGS_FOR_TARGET
-    EXTRA_LDFLAGS_FOR_TARGET
-    ;
+  env = mapAttrs (_: v: toString v) ({
+
+    NIX_NO_SELF_RPATH = true;
+
+    # https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
+    ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
+
+    # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
+    # library headers and binaries, regarless of the language being compiled.
+    #
+    # Note: When building the Java AWT GTK peer, the build system doesn't honor
+    # `--with-gmp' et al., e.g., when building
+    # `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
+    # them to $CPATH and $LIBRARY_PATH in this case.
+    #
+    # Likewise, the LTO code doesn't find zlib.
+    #
+    # Cross-compiling, we need gcc not to read ./specs in order to build the g++
+    # compiler (after the specs for the cross-gcc are created). Having
+    # LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
+
+    CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
+      ++ optional (zlib != null) zlib
+      ++ optional langJava boehmgc
+      ++ optionals javaAwtGtk xlibs
+      ++ optionals javaAwtGtk [ gmp mpfr ]
+    ));
+
+    LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (
+      optional (zlib != null) zlib
+      ++ optional langJava boehmgc
+      ++ optionals javaAwtGtk xlibs
+      ++ optionals javaAwtGtk [ gmp mpfr ]
+    ));
+
+    inherit (callFile ./common/extra-target-flags.nix { })
+      EXTRA_FLAGS_FOR_TARGET
+      EXTRA_LDFLAGS_FOR_TARGET
+      ;
+  } // optionalAttrs is7 {
+    NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
+  } // optionalAttrs (!atLeast7) {
+    inherit langJava;
+  } // optionalAttrs atLeast6 {
+    NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
+  });
 
   passthru = {
-    inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
+    inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD langJava version;
     isGNU = true;
   } // lib.optionalAttrs (!atLeast12) {
     hardeningUnsupportedFlags = lib.optionals is48 [ "stackprotector" ] ++ [ "fortify3" ];
@@ -411,17 +421,11 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
   } // lib.optionalAttrs (!atLeast11) {
     badPlatforms = if !(is48 || is49) then [ "aarch64-darwin" ] else lib.platforms.darwin;
   };
-} // optionalAttrs is7 {
-  env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
 } // lib.optionalAttrs (!atLeast10 && stdenv.hostPlatform.isDarwin) {
   # GCC <10 requires default cctools `strip` instead of `llvm-strip` used by Darwin bintools.
   preBuild = ''
     makeFlagsArray+=('STRIP=${lib.getBin darwin.cctools-port}/bin/${stdenv.cc.targetPrefix}strip')
   '';
-} // optionalAttrs (!atLeast7) {
-  env.langJava = langJava;
-} // optionalAttrs atLeast6 {
-  NIX_LDFLAGS = lib.optionalString  hostPlatform.isSunOS "-lm";
 } // optionalAttrs (!atLeast8) {
   doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
 } // optionalAttrs enableMultilib {