Merge pull request #23097 from dmjio/halvm
Initial commit of HaLVM support
This commit is contained in:
commit
d0922896be
@ -82,5 +82,4 @@ stdenv.mkDerivation rec {
|
|||||||
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
|
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
|
||||||
inherit (ghc.meta) license platforms;
|
inherit (ghc.meta) license platforms;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
48
pkgs/development/compilers/halvm/2.4.0.nix
Normal file
48
pkgs/development/compilers/halvm/2.4.0.nix
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{ stdenv, fetchgit, bootPkgs, perl, gmp, ncurses, binutils, autoconf, alex, happy, makeStaticLibraries
|
||||||
|
, hscolour, xen, automake, gcc, git, zlib, libtool, enableIntegerSimple ? false
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation rec {
|
||||||
|
version = "2.4.0";
|
||||||
|
name = "HaLVM-${version}";
|
||||||
|
isHaLVM = true;
|
||||||
|
isGhcjs = false;
|
||||||
|
src = fetchgit {
|
||||||
|
rev = "6aa72c9b047fd8ddff857c994a5a895461fc3925";
|
||||||
|
url = "https://github.com/GaloisInc/HaLVM";
|
||||||
|
sha256 = "05cg4w6fw5ajmpmh8g2msprnygmr4isb3pphqhlddfqwyvqhl167";
|
||||||
|
};
|
||||||
|
prePatch = ''
|
||||||
|
sed -i '312 d' Makefile
|
||||||
|
sed -i '316,446 d' Makefile # Removes RPM packaging
|
||||||
|
sed -i '20 d' src/scripts/halvm-cabal.in
|
||||||
|
sed -ie 's|ld |${binutils}/bin/ld |g' src/scripts/ldkernel.in
|
||||||
|
'';
|
||||||
|
configureFlags = stdenv.lib.optional (!enableIntegerSimple) [ "--enable-gmp" ];
|
||||||
|
propagatedNativeBuildInputs = [ alex happy ];
|
||||||
|
buildInputs =
|
||||||
|
let haskellPkgs = [ alex happy bootPkgs.hscolour bootPkgs.cabal-install bootPkgs.haddock bootPkgs.hpc
|
||||||
|
]; in [ bootPkgs.ghc
|
||||||
|
automake perl git binutils
|
||||||
|
autoconf xen zlib ncurses.dev
|
||||||
|
libtool gmp ] ++ haskellPkgs;
|
||||||
|
preConfigure = ''
|
||||||
|
autoconf
|
||||||
|
patchShebangs .
|
||||||
|
'';
|
||||||
|
hardeningDisable = ["all"];
|
||||||
|
postInstall = "$out/bin/halvm-ghc-pkg recache";
|
||||||
|
passthru = {
|
||||||
|
inherit bootPkgs;
|
||||||
|
cross.config = "halvm";
|
||||||
|
cc = "${gcc}/bin/gcc";
|
||||||
|
ld = "${binutils}/bin/ld";
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "http://github.com/GaloisInc/HaLVM";
|
||||||
|
description = "The Haskell Lightweight Virtual Machine (HaLVM): GHC running on Xen";
|
||||||
|
maintainers = with stdenv.lib.maintainers; [ dmjio ];
|
||||||
|
inherit (bootPkgs.ghc.meta) license platforms;
|
||||||
|
};
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
with import ./lib.nix { inherit pkgs; };
|
||||||
|
|
||||||
|
self: super: {
|
||||||
|
|
||||||
|
# Suitable LLVM version.
|
||||||
|
llvmPackages = pkgs.llvmPackages_35;
|
||||||
|
|
||||||
|
# Disable GHC 8.0.x core libraries.
|
||||||
|
array = null;
|
||||||
|
base = null;
|
||||||
|
binary = null;
|
||||||
|
bytestring = null;
|
||||||
|
Cabal = null;
|
||||||
|
containers = null;
|
||||||
|
deepseq = null;
|
||||||
|
directory = null;
|
||||||
|
filepath = null;
|
||||||
|
ghc-boot = null;
|
||||||
|
ghc-boot-th = null;
|
||||||
|
ghc-prim = null;
|
||||||
|
ghci = null;
|
||||||
|
haskeline = null;
|
||||||
|
hoopl = null;
|
||||||
|
hpc = null;
|
||||||
|
integer-gmp = null;
|
||||||
|
pretty = null;
|
||||||
|
process = null;
|
||||||
|
rts = null;
|
||||||
|
template-haskell = null;
|
||||||
|
terminfo = null;
|
||||||
|
time = null;
|
||||||
|
transformers = null;
|
||||||
|
unix = null;
|
||||||
|
xhtml = null;
|
||||||
|
|
||||||
|
# cabal-install can use the native Cabal library.
|
||||||
|
cabal-install = super.cabal-install.override { Cabal = null; };
|
||||||
|
|
||||||
|
# jailbreak-cabal can use the native Cabal library.
|
||||||
|
jailbreak-cabal = super.jailbreak-cabal.override { Cabal = null; };
|
||||||
|
|
||||||
|
# https://github.com/bmillwood/applicative-quoters/issues/6
|
||||||
|
applicative-quoters = appendPatch super.applicative-quoters (pkgs.fetchpatch {
|
||||||
|
url = "https://patch-diff.githubusercontent.com/raw/bmillwood/applicative-quoters/pull/7.patch";
|
||||||
|
sha256 = "026vv2k3ks73jngwifszv8l59clg88pcdr4mz0wr0gamivkfa1zy";
|
||||||
|
});
|
||||||
|
|
||||||
|
# https://github.com/christian-marie/xxhash/issues/3
|
||||||
|
xxhash = doJailbreak super.xxhash;
|
||||||
|
|
||||||
|
# https://github.com/Deewiant/glob/issues/8
|
||||||
|
Glob = doJailbreak super.Glob;
|
||||||
|
|
||||||
|
# http://hub.darcs.net/dolio/vector-algorithms/issue/9#comment-20170112T145715
|
||||||
|
vector-algorithms = dontCheck super.vector-algorithms;
|
||||||
|
|
||||||
|
}
|
@ -66,7 +66,8 @@ let
|
|||||||
concatStringsSep enableFeature optionalAttrs toUpper;
|
concatStringsSep enableFeature optionalAttrs toUpper;
|
||||||
|
|
||||||
isGhcjs = ghc.isGhcjs or false;
|
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"
|
then "package-db"
|
||||||
else "package-conf";
|
else "package-conf";
|
||||||
|
|
||||||
@ -99,16 +100,15 @@ let
|
|||||||
"--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
|
"--with-ghc-pkg=${ghc.cross.config}-ghc-pkg"
|
||||||
"--with-gcc=${ghc.cc}"
|
"--with-gcc=${ghc.cc}"
|
||||||
"--with-ld=${ghc.ld}"
|
"--with-ld=${ghc.ld}"
|
||||||
"--hsc2hs-options=--cross-compile"
|
|
||||||
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
|
"--with-hsc2hs=${nativeGhc}/bin/hsc2hs"
|
||||||
];
|
] ++ (if isHaLVM then [] else ["--hsc2hs-options=--cross-compile"]);
|
||||||
|
|
||||||
crossCabalFlagsString =
|
crossCabalFlagsString =
|
||||||
stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
|
stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
|
||||||
|
|
||||||
defaultConfigureFlags = [
|
defaultConfigureFlags = [
|
||||||
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
|
"--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"
|
"--package-db=$packageConfDir"
|
||||||
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
|
(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")
|
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
|
||||||
@ -133,8 +133,9 @@ let
|
|||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
(optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir")
|
||||||
(optionalString (isGhcjs || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||||
(optionalString (versionOlder "7.10" ghc.version) "-threaded") # https://github.com/haskell/cabal/issues/2398
|
# https://github.com/haskell/cabal/issues/2398
|
||||||
|
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
||||||
];
|
];
|
||||||
|
|
||||||
isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
|
isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
|
||||||
@ -319,11 +320,10 @@ stdenv.mkDerivation ({
|
|||||||
export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
|
export NIX_${ghcCommandCaps}="${ghcEnv}/bin/${ghcCommand}"
|
||||||
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
|
export NIX_${ghcCommandCaps}PKG="${ghcEnv}/bin/${ghcCommand}-pkg"
|
||||||
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
|
export NIX_${ghcCommandCaps}_DOCDIR="${ghcEnv}/share/doc/ghc/html"
|
||||||
export NIX_${ghcCommandCaps}_LIBDIR="${ghcEnv}/lib/${ghcCommand}-${ghc.version}"
|
'' + (if isHaLVM
|
||||||
${shellHook}
|
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; }
|
meta = { inherit homepage license platforms; }
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
assert ghcLibdir != null -> (ghc.isGhcjs or false);
|
assert ghcLibdir != null -> (ghc.isGhcjs or false);
|
||||||
|
|
||||||
# This wrapper works only with GHC 6.12 or later.
|
# This wrapper works only with GHC 6.12 or later.
|
||||||
assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
|
assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs || ghc.isHaLVM;
|
||||||
|
|
||||||
# It's probably a good idea to include the library "ghc-paths" in the
|
# It's probably a good idea to include the library "ghc-paths" in the
|
||||||
# compiler environment, because we have a specially patched version of
|
# compiler environment, because we have a specially patched version of
|
||||||
@ -33,13 +33,14 @@ assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
|
|||||||
|
|
||||||
let
|
let
|
||||||
isGhcjs = ghc.isGhcjs or false;
|
isGhcjs = ghc.isGhcjs or false;
|
||||||
ghc761OrLater = isGhcjs || lib.versionOlder "7.6.1" ghc.version;
|
isHaLVM = ghc.isHaLVM or false;
|
||||||
|
ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
|
||||||
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
||||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||||
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
crossPrefix = if (ghc.cross or null) != null then "${ghc.cross.config}-" else "";
|
||||||
ghcCommand = "${crossPrefix}${ghcCommand'}";
|
ghcCommand = "${crossPrefix}${ghcCommand'}";
|
||||||
ghcCommandCaps= lib.toUpper ghcCommand';
|
ghcCommandCaps= lib.toUpper ghcCommand';
|
||||||
libDir = "$out/lib/${ghcCommand}-${ghc.version}";
|
libDir = if isHaLVM then "$out/lib/HaLVM-${ghc.version}" else "$out/lib/${ghcCommand}-${ghc.version}";
|
||||||
docDir = "$out/share/doc/ghc/html";
|
docDir = "$out/share/doc/ghc/html";
|
||||||
packageCfgDir = "${libDir}/package.conf.d";
|
packageCfgDir = "${libDir}/package.conf.d";
|
||||||
paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
|
paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);
|
||||||
|
@ -79,6 +79,10 @@ in rec {
|
|||||||
ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix {
|
ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix {
|
||||||
bootPkgs = packages.ghc802;
|
bootPkgs = packages.ghc802;
|
||||||
};
|
};
|
||||||
|
ghcHaLVM240 = callPackage ../development/compilers/halvm/2.4.0.nix rec {
|
||||||
|
bootPkgs = packages.ghc802;
|
||||||
|
inherit (bootPkgs) hscolour alex happy;
|
||||||
|
};
|
||||||
|
|
||||||
jhc = callPackage ../development/compilers/jhc {
|
jhc = callPackage ../development/compilers/jhc {
|
||||||
inherit (packages.ghc763) ghcWithPackages;
|
inherit (packages.ghc763) ghcWithPackages;
|
||||||
@ -100,6 +104,7 @@ in rec {
|
|||||||
in pkgs.recurseIntoAttrs (integerSimpleGhcs // {
|
in pkgs.recurseIntoAttrs (integerSimpleGhcs // {
|
||||||
ghcHEAD = integerSimpleGhcs.ghcHEAD.override { selfPkgs = packages.integer-simple.ghcHEAD; };
|
ghcHEAD = integerSimpleGhcs.ghcHEAD.override { selfPkgs = packages.integer-simple.ghcHEAD; };
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
packages = {
|
packages = {
|
||||||
@ -167,6 +172,10 @@ in rec {
|
|||||||
ghc = compiler.ghcjsHEAD;
|
ghc = compiler.ghcjsHEAD;
|
||||||
compilerConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
compilerConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { };
|
||||||
};
|
};
|
||||||
|
ghcHaLVM240 = callPackage ../development/haskell-modules {
|
||||||
|
ghc = compiler.ghcHaLVM240;
|
||||||
|
compilerConfig = callPackage ../development/haskell-modules/configuration-halvm-2.4.0.nix { };
|
||||||
|
};
|
||||||
|
|
||||||
# The integer-simple attribute set contains package sets for all the GHC compilers
|
# The integer-simple attribute set contains package sets for all the GHC compilers
|
||||||
# using integer-simple instead of integer-gmp.
|
# using integer-simple instead of integer-gmp.
|
||||||
|
Loading…
Reference in New Issue
Block a user