1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 21:50:55 +00:00
nixpkgs/pkgs/development/compilers/ghcjs/default.nix

131 lines
3.8 KiB
Nix

{ mkDerivation
, test-framework
, test-framework-hunit
, test-framework-quickcheck2
, data-default
, ghc-paths
, haskell-src-exts
, haskell-src-meta
, optparse-applicative
, system-fileio
, system-filepath
, text-binary
, unordered-containers
, cabal-install
, wl-pprint-text
, base16-bytestring
, executable-path
, transformers-compat
, haddock-api
, ghcjs-prim
, regex-posix
, ghc, gmp
, jailbreak-cabal
, nodejs, stdenv, filepath, HTTP, HUnit, mtl, network, QuickCheck, random, stm
, time
, zlib, aeson, attoparsec, bzlib, hashable
, lens
, parallel, safe, shelly, split, stringsearch, syb
, tar, terminfo
, vector, yaml, fetchgit, Cabal
, alex, happy, git, gnumake, autoconf, patch
, automake, libtool
, cryptohash
, haddock, hspec, xhtml, primitive, cacert, pkgs
, coreutils
, libiconv
}:
let
version = "0.1.0";
ghcjsBoot = fetchgit {
url = git://github.com/ghcjs/ghcjs-boot.git;
rev = "d435c60b62d24b7a4117493f7aaecbfa09968fe6"; # 7.10 branch
sha256 = "07vhmjz21ccnqccms003550xacmwb08pjdkhnjcwcbl2603v4na1";
fetchSubmodules = true;
};
shims = fetchgit {
url = git://github.com/ghcjs/shims.git;
rev = "0b670ca27fff3f0bad515c37e56ccb8b4d6758fb"; # master branch
sha256 = "19zq79f2y59lw7c8m100awh3rcra5yhbsvpb5xmp3mq6grac7h08";
};
in mkDerivation (rec {
pname = "ghcjs";
inherit version;
src = fetchgit {
url = git://github.com/ghcjs/ghcjs.git;
rev = "39c1cb6d5d2551b306a7957a0e7f682f4a048490"; # master branch
sha256 = "1v2hpmhdssgf1jmchiwkvp5j8j6rw3k0hpkf326vb8l1b0kbmibr";
};
isLibrary = true;
isExecutable = true;
jailbreak = true;
doHaddock = false;
doCheck = false;
buildDepends = [
filepath HTTP mtl network random stm time zlib aeson attoparsec
bzlib data-default ghc-paths hashable haskell-src-exts haskell-src-meta
lens optparse-applicative parallel safe shelly split
stringsearch syb system-fileio system-filepath tar terminfo text-binary
unordered-containers vector wl-pprint-text yaml
alex happy git gnumake autoconf automake libtool patch gmp
base16-bytestring cryptohash executable-path haddock-api
transformers-compat QuickCheck haddock hspec xhtml
ghcjs-prim regex-posix libiconv
];
buildTools = [ nodejs git ];
testDepends = [
HUnit test-framework test-framework-hunit
];
patches = [ ./ghcjs.patch ];
postPatch = ''
substituteInPlace Setup.hs \
--replace "/usr/bin/env" "${coreutils}/bin/env"
substituteInPlace src/Compiler/Info.hs \
--replace "@PREFIX@" "$out" \
--replace "@VERSION@" "${version}"
substituteInPlace src-bin/Boot.hs \
--replace "@PREFIX@" "$out" \
--replace "@CC@" "${stdenv.cc}/bin/cc"
'';
preBuild = ''
local topDir=$out/lib/ghcjs-${version}
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
# Make the patches be relative their corresponding package's directory.
# See: https://github.com/ghcjs/ghcjs-boot/pull/12
for patch in "$topDir/ghcjs-boot/patches/"*.patch; do
echo "fixing patch: $patch"
sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
done
'';
postInstall = ''
PATH=$out/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${stdenv.cc}/lib64:$LD_LIBRARY_PATH \
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot \
--dev \
--with-cabal ${cabal-install}/bin/cabal \
--with-gmp-includes ${gmp}/include \
--with-gmp-libraries ${gmp}/lib
'';
passthru = {
isGhcjs = true;
nativeGhc = ghc;
inherit nodejs;
};
homepage = "https://github.com/ghcjs/ghcjs";
description = "A Haskell to JavaScript compiler that uses the GHC API";
license = stdenv.lib.licenses.bsd3;
platforms = ghc.meta.platforms;
maintainers = with stdenv.lib.maintainers; [ jwiegley cstrahan ];
})