Merge pull request #23097 from dmjio/halvm
Initial commit of HaLVM support
This commit is contained in:
@@ -66,7 +66,8 @@ let
|
||||
concatStringsSep enableFeature optionalAttrs toUpper;
|
||||
|
||||
isGhcjs = ghc.isGhcjs or false;
|
||||
packageDbFlag = if isGhcjs || versionOlder "7.6" ghc.version
|
||||
isHaLVM = ghc.isHaLVM or false;
|
||||
packageDbFlag = if isGhcjs || isHaLVM || versionOlder "7.6" ghc.version
|
||||
then "package-db"
|
||||
else "package-conf";
|
||||
|
||||
@@ -99,16 +100,15 @@ let
|
||||
"--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
|
||||
"--with-gcc=${ghc.cc}"
|
||||
"--with-ld=${ghc.ld}"
|
||||
"--hsc2hs-options=--cross-compile"
|
||||
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
|
||||
];
|
||||
] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
|
||||
|
||||
crossCabalFlagsString =
|
||||
stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
|
||||
|
||||
defaultConfigureFlags = [
|
||||
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
|
||||
"--with-gcc=$CC" # Clang won't work without that extra information.
|
||||
"--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")
|
||||
@@ -133,8 +133,9 @@ let
|
||||
|
||||
setupCompileFlags = [
|
||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
||||
(optionalString (isGhcjs || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||
(optionalString (versionOlder "7.10" ghc.version) "-threaded") # https://github.com/haskell/cabal/issues/2398
|
||||
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||
# https://github.com/haskell/cabal/issues/2398
|
||||
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
||||
];
|
||||
|
||||
isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
|
||||
@@ -319,11 +320,10 @@ stdenv.mkDerivation ({
|
||||
export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
|
||||
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
|
||||
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
|
||||
export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"
|
||||
${shellHook}
|
||||
'';
|
||||
'' + (if isHaLVM
|
||||
then ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/HaLVM-${ghc.version}"''
|
||||
else ''export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"'') + "${shellHook}";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
meta = { inherit homepage license platforms; }
|
||||
|
||||
Reference in New Issue
Block a user