From ea9a2c5ec21bf088bbdef036238fa67cdc85b073 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 24 Nov 2019 23:07:20 +0000 Subject: haskell genenric-builder: Make the C compiler optional This is GHCJS, and perhaps other obscure targets. --- pkgs/development/haskell-modules/generic-builder.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs/development/haskell-modules') diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 87d3b5ae496..d6966d69136 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -40,7 +40,7 @@ in # They must be propagated to the environment of any executable linking with the library , libraryFrameworkDepends ? [], executableFrameworkDepends ? [] , homepage ? "https://hackage.haskell.org/package/${pname}" -, platforms ? with stdenv.lib.platforms; unix ++ windows # GHC can cross-compile +, platforms ? with stdenv.lib.platforms; all # GHC can cross-compile , hydraPlatforms ? null , hyperlinkSource ? true , isExecutable ? false, isLibrary ? !isExecutable @@ -133,6 +133,7 @@ let crossCabalFlags = [ "--with-ghc=${ghc.targetPrefix}ghc" "--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg" + ] ++ optionals stdenv.hasCC [ "--with-gcc=${stdenv.cc.targetPrefix}cc" "--with-ld=${stdenv.cc.bintools.targetPrefix}ld" "--with-ar=${stdenv.cc.bintools.targetPrefix}ar" @@ -156,7 +157,9 @@ let "--libsubdir=\\$abi/\\$libname" (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}") (optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}") + ] ++ optionals stdenv.hasCC [ "--with-gcc=$CC" # Clang won't work without that extra information. + ] ++ [ "--package-db=$packageConfDir" (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}") (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names") -- cgit 1.4.1 From ad93663a485afe830b3d1edb27ae3d3471e6cf99 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Tue, 24 Dec 2019 18:17:41 -0500 Subject: ghcWithHoogle: Fix for cross Use `buildPackages.stdenv.mkDerivation` because we are making a shell script to start hoogle on the build platform. --- pkgs/development/haskell-modules/hoogle.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'pkgs/development/haskell-modules') diff --git a/pkgs/development/haskell-modules/hoogle.nix b/pkgs/development/haskell-modules/hoogle.nix index 0bb930a8bb3..0f620d46ccc 100644 --- a/pkgs/development/haskell-modules/hoogle.nix +++ b/pkgs/development/haskell-modules/hoogle.nix @@ -23,7 +23,8 @@ # This will build mmorph and monadControl, and have the hoogle installation # refer to their documentation via symlink so they are not garbage collected. -{ lib, stdenv, hoogle, writeText, ghc +{ lib, stdenv, buildPackages +, hoogle, writeText, ghc , packages }: @@ -53,7 +54,7 @@ let (map (lib.getOutput "doc") packages); in -stdenv.mkDerivation { +buildPackages.stdenv.mkDerivation { name = "hoogle-local-0.1"; buildInputs = [ghc hoogle]; -- cgit 1.4.1 From 6a23c9ddbef2bf80f28d9d2cda778f429a50b3f1 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 25 Dec 2019 13:14:48 -0500 Subject: haskell generic-builder: Fix `--with-ghc` flag for GHCJS as cross Otherwise it passes `--with-ghc=ghc`, and we do the wrong thing. --- pkgs/development/haskell-modules/generic-builder.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkgs/development/haskell-modules') diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index d6966d69136..e27769d9c76 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -131,7 +131,7 @@ let ''; crossCabalFlags = [ - "--with-ghc=${ghc.targetPrefix}ghc" + "--with-ghc=${ghcCommand}" "--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg" ] ++ optionals stdenv.hasCC [ "--with-gcc=${stdenv.cc.targetPrefix}cc" -- cgit 1.4.1 From d8dd3014120af31d4567de8247900a1088ec6e7b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 25 Dec 2019 14:34:40 -0500 Subject: haskell generic-builder: Hack so CPP without a CC works --- pkgs/development/haskell-modules/generic-builder.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pkgs/development/haskell-modules') diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index e27769d9c76..018979cf7ae 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -133,8 +133,11 @@ let crossCabalFlags = [ "--with-ghc=${ghcCommand}" "--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg" + # Pass the "wrong" C compiler rather than none at all so packages that just + # use the C preproccessor still work, see + # https://github.com/haskell/cabal/issues/6466 for details. + "--with-gcc=${(if stdenv.hasCC then stdenv else buildPackages.stdenv).cc.targetPrefix}cc" ] ++ optionals stdenv.hasCC [ - "--with-gcc=${stdenv.cc.targetPrefix}cc" "--with-ld=${stdenv.cc.bintools.targetPrefix}ld" "--with-ar=${stdenv.cc.bintools.targetPrefix}ar" # use the one that comes with the cross compiler. -- cgit 1.4.1