From 8d2ce113d571046382c9490b1e47e14454c6469f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 20 May 2018 02:16:07 -0400 Subject: [PATCH] ghc: Handle flavors better --- pkgs/development/compilers/ghc/7.10.3.nix | 9 ++++++++- pkgs/development/compilers/ghc/8.0.2.nix | 9 ++++++++- pkgs/development/compilers/ghc/8.2.2.nix | 8 +++++++- pkgs/development/compilers/ghc/8.4.2.nix | 8 +++++++- pkgs/development/compilers/ghc/head.nix | 8 +++++++- 5 files changed, 37 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 150d14e1db46..7d2f37916323 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -24,6 +24,10 @@ , # Whether to build dynamic libs for the standard library (on the target # platform). Static libs are always built. enableShared ? true + +, # What flavour to build. An empty string indicates no + # specific flavour and falls back to ghc default values. + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" }: assert !enableIntegerSimple -> gmp != null; @@ -42,11 +46,14 @@ let }; buildMK = '' + BuildFlavour = ${ghcFlavour} + ifneq \"\$(BuildFlavour)\" \"\" + include mk/flavours/\$(BuildFlavour).mk + endif DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - BuildFlavour = perf-cross Stage1Only = YES HADDOCK_DOCS = NO '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index 60707c0288d6..b5cd111f1e51 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -23,6 +23,10 @@ , # Whether to build dynamic libs for the standard library (on the target # platform). Static libs are always built. enableShared ? true + +, # What flavour to build. An empty string indicates no + # specific flavour and falls back to ghc default values. + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" }: assert !enableIntegerSimple -> gmp != null; @@ -36,11 +40,14 @@ let "${targetPlatform.config}-"; buildMK = '' + BuildFlavour = ${ghcFlavour} + ifneq \"\$(BuildFlavour)\" \"\" + include mk/flavours/\$(BuildFlavour).mk + endif DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - BuildFlavour = perf-cross Stage1Only = YES HADDOCK_DOCS = NO '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index c0fadbb61750..4bd6889d1df8 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -25,6 +25,9 @@ # platform). Static libs are always built. enableShared ? true +, # What flavour to build. An empty string indicates no + # specific flavour and falls back to ghc default values. + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" , # Whether to backport https://phabricator.haskell.org/D4388 for # deterministic profiling symbol names, at the cost of a slightly # non-standard GHC API @@ -42,11 +45,14 @@ let "${targetPlatform.config}-"; buildMK = '' + BuildFlavour = ${ghcFlavour} + ifneq \"\$(BuildFlavour)\" \"\" + include mk/flavours/\$(BuildFlavour).mk + endif DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - BuildFlavour = perf-cross Stage1Only = YES HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/pkgs/development/compilers/ghc/8.4.2.nix b/pkgs/development/compilers/ghc/8.4.2.nix index bebc386f2243..b432682802e5 100644 --- a/pkgs/development/compilers/ghc/8.4.2.nix +++ b/pkgs/development/compilers/ghc/8.4.2.nix @@ -24,6 +24,9 @@ # platform). Static libs are always built. enableShared ? !targetPlatform.useAndroidPrebuilt +, # What flavour to build. An empty string indicates no + # specific flavour and falls back to ghc default values. + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" }: assert !enableIntegerSimple -> gmp != null; @@ -37,11 +40,14 @@ let "${targetPlatform.config}-"; buildMK = '' + BuildFlavour = ${ghcFlavour} + ifneq \"\$(BuildFlavour)\" \"\" + include mk/flavours/\$(BuildFlavour).mk + endif DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - BuildFlavour = perf-cross Stage1Only = YES HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index e0de4e7e60e6..f5a7be5156d7 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -25,6 +25,9 @@ enableShared ? !targetPlatform.useAndroidPrebuilt , version ? "8.5.20180118" +, # What flavour to build. An empty string indicates no + # specific flavour and falls back to ghc default values. + ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross" }: assert !enableIntegerSimple -> gmp != null; @@ -38,11 +41,14 @@ let "${targetPlatform.config}-"; buildMK = '' + BuildFlavour = ${ghcFlavour} + ifneq \"\$(BuildFlavour)\" \"\" + include mk/flavours/\$(BuildFlavour).mk + endif DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - BuildFlavour = perf-cross Stage1Only = YES HADDOCK_DOCS = NO BUILD_SPHINX_HTML = NO