Merge pull request #74090 from obsidiansystems/ghcjs-cross-without-cc

stdenv, haskell: bonafied GHCJS cross compilation without stdenv.cc
This commit is contained in:
John Ericson
2019-12-30 16:40:43 -08:00
committed by GitHub
13 changed files with 71 additions and 33 deletions

View File

@@ -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
@@ -131,9 +131,13 @@ let
'';
crossCabalFlags = [
"--with-ghc=${ghc.targetPrefix}ghc"
"--with-ghc=${ghcCommand}"
"--with-ghc-pkg=${ghc.targetPrefix}ghc-pkg"
"--with-gcc=${stdenv.cc.targetPrefix}cc"
# 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-ld=${stdenv.cc.bintools.targetPrefix}ld"
"--with-ar=${stdenv.cc.bintools.targetPrefix}ar"
# use the one that comes with the cross compiler.
@@ -156,7 +160,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")

View File

@@ -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];