summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDavid Johnson <djohnson.m@gmail.com>2017-02-04 11:19:14 -0600
committerDavid Johnson <djohnson.m@gmail.com>2017-03-10 19:31:12 -0600
commit26623240e93f8454ac69f66a3a025d98a7e94b71 (patch)
treee929462cc37cde5d489f87bcf3bbe40be5b5f601 /pkgs
parent2839b101f927be5daab7948421de00a6f6c084ae (diff)
downloadnixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.tar
nixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.gz
nixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.bz2
nixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.lz
nixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.xz
nixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.tar.zst
nixpkgs-26623240e93f8454ac69f66a3a025d98a7e94b71.zip
Init HaLVM at 2.4.0
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/ghc/7.10.3.nix1
-rw-r--r--pkgs/development/compilers/halvm/2.4.0.nix48
-rw-r--r--pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix59
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix20
-rw-r--r--pkgs/development/haskell-modules/with-packages-wrapper.nix9
-rw-r--r--pkgs/top-level/haskell-packages.nix9
6 files changed, 131 insertions, 15 deletions
diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix
index d75f5df370f..5c6b62bee6f 100644
--- a/pkgs/development/compilers/ghc/7.10.3.nix
+++ b/pkgs/development/compilers/ghc/7.10.3.nix
@@ -82,5 +82,4 @@ stdenv.mkDerivation rec {
     maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
     inherit (ghc.meta) license platforms;
   };
-
 }
diff --git a/pkgs/development/compilers/halvm/2.4.0.nix b/pkgs/development/compilers/halvm/2.4.0.nix
new file mode 100644
index 00000000000..c167f4bdd75
--- /dev/null
+++ b/pkgs/development/compilers/halvm/2.4.0.nix
@@ -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;
+  };
+}
diff --git a/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix b/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix
new file mode 100644
index 00000000000..cd7857e23de
--- /dev/null
+++ b/pkgs/development/haskell-modules/configuration-halvm-2.4.0.nix
@@ -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;
+
+}
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index e47375e71c7..64924f7252e 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -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; }
diff --git a/pkgs/development/haskell-modules/with-packages-wrapper.nix b/pkgs/development/haskell-modules/with-packages-wrapper.nix
index e04cbe08c2c..15d66bbd6dc 100644
--- a/pkgs/development/haskell-modules/with-packages-wrapper.nix
+++ b/pkgs/development/haskell-modules/with-packages-wrapper.nix
@@ -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);
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index b4226e656fd..bad483f0237 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -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.