nixpkgs/pkgs/development/compilers/ghcjs/default.nix

92 lines
3.3 KiB
Nix
Raw Normal View History

{ nodejs, cabal, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, time
, zlib, aeson, attoparsec, bzlib, dataDefault, ghcPaths, hashable
2014-12-27 21:51:39 +00:00
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative
, parallel, safe, shelly, split, stringsearch, syb, systemFileio
, systemFilepath, tar, terminfo, textBinary, unorderedContainers
2014-12-27 23:48:12 +00:00
, vector, wlPprintText, yaml, fetchgit, Cabal, cabalInstall
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
2014-12-27 23:48:12 +00:00
, automake, libtool, gmp, base16Bytestring
2014-10-09 15:54:27 +01:00
, cryptohash, executablePath, transformersCompat, haddockApi
, haddock, hspec, xhtml, primitive, cacert, pkgs, ghc
2014-12-12 01:53:25 +00:00
, coreutils
2014-12-27 23:48:12 +00:00
, ghcjsPrim
}:
2014-12-12 01:53:25 +00:00
let
version = "0.1.0";
2014-12-12 01:53:25 +00:00
libDir = "share/ghcjs/${pkgs.stdenv.system}-${version}-${ghc.ghc.version}/ghcjs";
ghcjsBoot = fetchgit {
url = git://github.com/ghcjs/ghcjs-boot.git;
2014-12-28 00:51:21 +00:00
rev = "5c7a71472d5a797e895914d3b82cea447a058793";
sha256 = "0dp97bgbnlr3sd9yfnk27p6dfv46fi26sn6y6qv1wxs5i29kmjav";
fetchSubmodules = true;
};
shims = fetchgit {
url = git://github.com/ghcjs/shims.git;
2014-12-31 06:15:13 +00:00
rev = "99bbd4bed584ec42bfcc5ea61c3808a2c670053d";
sha256 = "1my3gqkln7hgm0bpy32pnhwjfza096alh0n9x9ny8xfpxhmzz4h6";
};
2014-12-12 01:53:25 +00:00
in cabal.mkDerivation (self: rec {
pname = "ghcjs";
inherit version;
src = fetchgit {
url = git://github.com/ghcjs/ghcjs.git;
2014-12-31 06:15:13 +00:00
rev = "4b9461e8be646d5152a0ae7ece5b3616bf938637";
sha256 = "19g62j1kkdwcgp0042ppmskwbvfk7qkf1fjs8bpjc6wwd19ipiar";
2014-12-12 01:53:25 +00:00
};
isLibrary = true;
isExecutable = true;
jailbreak = true;
noHaddock = true;
doCheck = false;
buildDepends = [
filepath HTTP mtl network random stm time zlib aeson attoparsec
bzlib dataDefault ghcPaths hashable haskellSrcExts haskellSrcMeta
2014-12-27 21:51:39 +00:00
lens optparseApplicative parallel safe shelly split
stringsearch syb systemFileio systemFilepath tar terminfo textBinary
unorderedContainers vector wlPprintText yaml
alex happy git gnumake gcc autoconf automake libtool patch gmp
2014-11-17 06:08:11 +00:00
base16Bytestring cryptohash executablePath haddockApi
transformersCompat QuickCheck haddock hspec xhtml
2014-11-17 06:08:11 +00:00
ghcjsPrim regexPosix
];
buildTools = [ nodejs git ];
testDepends = [
HUnit testFramework testFrameworkHunit
];
2014-12-12 01:53:25 +00:00
patches = [ ./ghcjs.patch ];
postPatch = ''
substituteInPlace Setup.hs --replace "/usr/bin/env" "${coreutils}/bin/env"
substituteInPlace src/Compiler/Info.hs --replace "@PREFIX@" "$out"
substituteInPlace src-bin/Boot.hs --replace "@PREFIX@" "$out"
'';
2014-12-25 02:58:45 +00:00
preBuild = ''
2014-12-12 01:53:25 +00:00
local topDir=$out/${libDir}
mkdir -p $topDir
cp -r ${ghcjsBoot} $topDir/ghcjs-boot
chmod -R u+w $topDir/ghcjs-boot
cp -r ${shims} $topDir/shims
chmod -R u+w $topDir/shims
2014-12-25 02:58:45 +00:00
'';
postInstall = ''
PATH=$out/bin:${Cabal}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.cc}/lib64:$LD_LIBRARY_PATH \
2014-12-12 01:53:25 +00:00
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \
--dev \
2014-12-27 23:48:12 +00:00
--with-cabal ${cabalInstall}/bin/cabal \
2014-12-12 01:53:25 +00:00
--with-gmp-includes ${gmp}/include \
--with-gmp-libraries ${gmp}/lib
'';
2014-12-12 01:53:25 +00:00
passthru = {
inherit libDir;
};
meta = {
homepage = "https://github.com/ghcjs/ghcjs";
description = "GHCJS is a Haskell to JavaScript compiler that uses the GHC API";
license = self.stdenv.lib.licenses.bsd3;
platforms = self.ghc.meta.platforms;
maintainers = [ self.stdenv.lib.maintainers.jwiegley ];
};
})