3
0
Fork 0
forked from mirrors/nixpkgs

Init HaLVM at 2.4.0

This commit is contained in:
David Johnson 2017-02-04 11:19:14 -06:00
parent 2839b101f9
commit 26623240e9
6 changed files with 131 additions and 15 deletions

View file

@ -82,5 +82,4 @@ stdenv.mkDerivation rec {
maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
inherit (ghc.meta) license platforms;
};
}

View 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;
};
}

View file

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

View file

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

View file

@ -8,7 +8,7 @@
assert ghcLibdir != null -> (ghc.isGhcjs or false);
# 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
# compiler environment, because we have a specially patched version of
@ -33,13 +33,14 @@ assert lib.versionOlder "6.12" ghc.version || ghc.isGhcjs;
let
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";
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 "";
ghcCommand = "${crossPrefix}${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";
packageCfgDir = "${libDir}/package.conf.d";
paths = lib.filter (x: x ? isHaskellLibrary) (lib.closePropagation packages);

View file

@ -79,6 +79,10 @@ in rec {
ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix {
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 {
inherit (packages.ghc763) ghcWithPackages;
@ -100,6 +104,7 @@ in rec {
in pkgs.recurseIntoAttrs (integerSimpleGhcs // {
ghcHEAD = integerSimpleGhcs.ghcHEAD.override { selfPkgs = packages.integer-simple.ghcHEAD; };
});
};
packages = {
@ -167,6 +172,10 @@ in rec {
ghc = compiler.ghcjsHEAD;
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
# using integer-simple instead of integer-gmp.