2016-11-18 15:13:56 +00:00
{ 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
, callPackage
, bootPkgs , gmp
, jailbreak-cabal
, runCommand
, 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 , fetchFromGitHub , Cabal
, alex , happy , git , gnumake , autoconf , patch
, automake , libtool
, cryptohash
, haddock , hspec , xhtml , primitive , cacert , pkgs
, coreutils
, libiconv
, version ? " 0 . 2 . 0 "
, ghcjsSrc ? fetchFromGitHub {
owner = " g h c j s " ;
repo = " g h c j s " ;
rev = " 6 8 9 c 7 7 5 3 f 5 0 3 5 3 d d 0 5 6 0 6 e d 7 9 c 5 1 c d 5 a 9 4 d 3 9 2 2 a " ;
sha256 = " 0 7 6 0 2 0 a 9 g j v 8 l d j 5 c k m 4 3 s b z q 9 s 6 c 5 x j 6 l p d 8 v 2 8 y b p i a m a 3 m 6 b 4 " ;
}
, ghcjsBootSrc ? fetchgit {
url = git://github.com/ghcjs/ghcjs-boot.git ;
rev = " 8 c 5 4 9 9 3 1 d a 2 7 b a 9 e 6 0 7 f 7 7 1 9 5 2 0 8 e c 1 5 6 c 8 4 0 c 8 a " ;
sha256 = " 0 y g 9 b n a b j a 3 9 q y s h 9 p g 1 3 3 5 q b v b c 0 r 2 m d w 6 c k y 9 4 p 7 k a v a c n d f d v " ;
fetchSubmodules = true ;
}
, ghcjsBoot ? import ./ghcjs-boot.nix {
inherit runCommand ;
src = ghcjsBootSrc ;
}
, shims ? import ./shims.nix { inherit fetchFromGitHub ; }
# This is the list of the Stage 1 packages that are built into a booted ghcjs installation
# It can be generated with the command:
# nix-shell -p haskell.packages.ghcjs.ghc --command "ghcjs-pkg list | sed -n 's/^ \(.*\)-\([0-9.]*\)$/\1_\2/ p' | sed 's/\./_/g' | sed 's/^\([^_]*\)\(.*\)$/ \"\1\"/'"
, stage1Packages ? [
" a r r a y "
" b a s e "
" b i n a r y "
" b y t e s t r i n g "
" c o n t a i n e r s "
" d e e p s e q "
" d i r e c t o r y "
" f i l e p a t h "
" g h c - b o o t "
" g h c - b o o t - t h "
" g h c - p r i m "
" g h c i "
" g h c j s - p r i m "
" g h c j s - t h "
" i n t e g e r - g m p "
" p r e t t y "
" p r i m i t i v e "
" p r o c e s s "
" r t s "
" t e m p l a t e - h a s k e l l "
" t i m e "
" t r a n s f o r m e r s "
" u n i x "
]
2016-11-21 09:13:09 +00:00
, stage2 ? import ./stage2.nix
2016-11-18 15:13:56 +00:00
} :
let
inherit ( bootPkgs ) ghc ;
in mkDerivation ( rec {
pname = " g h c j s " ;
inherit version ;
src = ghcjsSrc ;
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 " / u s r / b i n / e n v " " ${ coreutils } / b i n / e n v "
substituteInPlace src/Compiler/Info.hs \
- - replace " @ P R E F I X @ " " $ o u t " \
- - replace " @ V E R S I O N @ " " ${ version } "
substituteInPlace src-bin/Boot.hs \
- - replace " @ P R E F I X @ " " $ o u t " \
- - replace " @ C C @ " " ${ stdenv . cc } / b i n / c c "
'' ;
preBuild = ''
export HOME = " $ T M P "
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 " $ t o p D i r / g h c j s - b o o t / p a t c h e s / " * . patch ; do
echo " f i x i n g p a t c h : $ p a t c h "
sed - i - e ' s @ \ ( a \ | b \ ) /boot / [ ^ / ] \ + @ \ 1 @ g' $ patch
done
'' ;
# We build with --quick so we can build stage 2 packages separately.
# This is necessary due to: https://github.com/haskell/cabal/commit/af19fb2c2d231d8deff1cb24164a2bf7efb8905a
# Cabal otherwise fails to build: http://hydra.nixos.org/build/31824079/nixlog/1/raw
postInstall = ''
PATH = $ out/bin : $ PATH LD_LIBRARY_PATH = $ { gmp . out } /lib : $ { stdenv . cc } /lib64 : $ LD_LIBRARY_PATH \
env - u GHC_PACKAGE_PATH $ out/bin/ghcjs-boot \
- - dev \
- - quick \
- - with-cabal $ { cabal-install } /bin/cabal \
- - with-gmp-includes $ { gmp . dev } /include \
- - with-gmp-libraries $ { gmp . out } /lib
'' ;
passthru = let
ghcjsNodePkgs = callPackage ../../../top-level/node-packages.nix {
generated = ./node-packages-generated.nix ;
self = ghcjsNodePkgs ;
} ;
in {
inherit bootPkgs ;
isCross = true ;
isGhcjs = true ;
inherit nodejs ghcjsBoot ;
inherit ( ghcjsNodePkgs ) " s o c k e t . i o " ;
inherit stage1Packages ;
2016-11-21 09:13:09 +00:00
mkStage2 = stage2 {
2016-11-18 15:13:56 +00:00
inherit ghcjsBoot ;
} ;
} ;
homepage = " h t t p s : / / g i t h u b . c o m / g h c j s / g h c j s " ;
description = " A H a s k e l l t o J a v a S c r i p t c o m p i l e r t h a t u s e s t h e G H C A P I " ;
license = stdenv . lib . licenses . bsd3 ;
platforms = ghc . meta . platforms ;
maintainers = with stdenv . lib . maintainers ; [ jwiegley cstrahan ] ;
2016-12-22 09:56:33 +00:00
broken = true ; # http://hydra.nixos.org/build/45110274
2016-11-18 15:13:56 +00:00
} )