From f4f56c7af274170b68f93a9b0561f674a07b5add Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 11 Feb 2024 18:06:01 +0100 Subject: [PATCH] haskell.compiler: no dynamic way without enableShared/enableProfiledLibs This disables building dynamic libraries for GHC 9.4.x and before, when enableShared and enableProfiledLibs are set to false. Currently this only disables dynamic linking of GHC itself, but still creates dynamic libraries. The hadrian-based GHC 9.6+ already disable building dynamic libraries via the no_dynamic_libs transformer in this case. The reason for this happening before was, that the default was assumed to be "v p dyn", of which "p" was taken away when profiled libs were disabled. But this would unconditionally enable the dyn way. Using the BUILD_PROF_LIBS flag in this case will let GHC's config.mk.in script make the proper decisions about which GhcLibWays to build. --- pkgs/development/compilers/ghc/8.10.7.nix | 2 +- pkgs/development/compilers/ghc/9.0.2.nix | 2 +- pkgs/development/compilers/ghc/9.2.5.nix | 2 +- pkgs/development/compilers/ghc/9.2.6.nix | 2 +- pkgs/development/compilers/ghc/9.2.7.nix | 2 +- pkgs/development/compilers/ghc/9.2.8.nix | 2 +- pkgs/development/compilers/ghc/9.4.5.nix | 2 +- pkgs/development/compilers/ghc/9.4.6.nix | 2 +- pkgs/development/compilers/ghc/9.4.7.nix | 2 +- pkgs/development/compilers/ghc/9.4.8.nix | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index c49c274c67d4..4a770d993a67 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -103,7 +103,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + lib.optionalString enableRelocatedStaticLibs '' GhcLibHcOpts += -fPIC GhcRtsHcOpts += -fPIC diff --git a/pkgs/development/compilers/ghc/9.0.2.nix b/pkgs/development/compilers/ghc/9.0.2.nix index bdfff2b795a4..175d1fe2450b 100644 --- a/pkgs/development/compilers/ghc/9.0.2.nix +++ b/pkgs/development/compilers/ghc/9.0.2.nix @@ -105,7 +105,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.2.5.nix b/pkgs/development/compilers/ghc/9.2.5.nix index 034a09511b2b..6c86e05ebbd4 100644 --- a/pkgs/development/compilers/ghc/9.2.5.nix +++ b/pkgs/development/compilers/ghc/9.2.5.nix @@ -105,7 +105,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.2.6.nix b/pkgs/development/compilers/ghc/9.2.6.nix index 83cd1e051c6a..6ff58f087f8a 100644 --- a/pkgs/development/compilers/ghc/9.2.6.nix +++ b/pkgs/development/compilers/ghc/9.2.6.nix @@ -105,7 +105,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.2.7.nix b/pkgs/development/compilers/ghc/9.2.7.nix index 4bf7252643de..f605bfda1981 100644 --- a/pkgs/development/compilers/ghc/9.2.7.nix +++ b/pkgs/development/compilers/ghc/9.2.7.nix @@ -105,7 +105,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.2.8.nix b/pkgs/development/compilers/ghc/9.2.8.nix index 0d469f733525..72cfdd242f42 100644 --- a/pkgs/development/compilers/ghc/9.2.8.nix +++ b/pkgs/development/compilers/ghc/9.2.8.nix @@ -105,7 +105,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.4.5.nix b/pkgs/development/compilers/ghc/9.4.5.nix index 9670d4a4fd57..298af6596e71 100644 --- a/pkgs/development/compilers/ghc/9.4.5.nix +++ b/pkgs/development/compilers/ghc/9.4.5.nix @@ -107,7 +107,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.4.6.nix b/pkgs/development/compilers/ghc/9.4.6.nix index f971f4e5a309..310787e477b2 100644 --- a/pkgs/development/compilers/ghc/9.4.6.nix +++ b/pkgs/development/compilers/ghc/9.4.6.nix @@ -107,7 +107,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.4.7.nix b/pkgs/development/compilers/ghc/9.4.7.nix index ac060dce91d0..e87f8fc3a907 100644 --- a/pkgs/development/compilers/ghc/9.4.7.nix +++ b/pkgs/development/compilers/ghc/9.4.7.nix @@ -107,7 +107,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell. diff --git a/pkgs/development/compilers/ghc/9.4.8.nix b/pkgs/development/compilers/ghc/9.4.8.nix index db79b72830d5..5ac2b60b1cd7 100644 --- a/pkgs/development/compilers/ghc/9.4.8.nix +++ b/pkgs/development/compilers/ghc/9.4.8.nix @@ -107,7 +107,7 @@ let Stage1Only = ${if targetPlatform.system == hostPlatform.system then "NO" else "YES"} CrossCompilePrefix = ${targetPrefix} '' + lib.optionalString (!enableProfiledLibs) '' - GhcLibWays = "v dyn" + BUILD_PROF_LIBS = NO '' + # -fexternal-dynamic-refs apparently (because it's not clear from the documentation) # makes the GHC RTS able to load static libraries, which may be needed for TemplateHaskell.