2015-03-13 04:20:56 +01: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
2016-09-04 11:29:49 +02:00
, callPackage
2015-03-13 04:20:56 +01:00
2016-02-21 19:15:04 +01:00
, bootPkgs , gmp
2015-03-13 04:20:56 +01:00
, jailbreak-cabal
2016-02-18 04:07:32 +01:00
, runCommand
2015-03-13 04:20:56 +01:00
, 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
2015-09-22 22:53:44 +02:00
, vector , yaml , fetchgit , fetchFromGitHub , Cabal
2015-03-13 04:20:56 +01:00
, alex , happy , git , gnumake , autoconf , patch
, automake , libtool
, cryptohash
, haddock , hspec , xhtml , primitive , cacert , pkgs
2014-12-12 02:53:25 +01:00
, coreutils
2015-03-13 04:20:56 +01:00
, libiconv
2015-10-16 21:58:44 +02:00
2016-02-24 22:27:03 +01:00
, ghcjsBootSrc ? fetchgit {
url = git://github.com/ghcjs/ghcjs-boot.git ;
2016-04-23 04:49:00 +02:00
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 " ;
2016-02-24 22:27:03 +01:00
fetchSubmodules = true ;
}
, ghcjsBoot ? import ./ghcjs-boot.nix {
inherit runCommand ;
src = ghcjsBootSrc ;
}
2015-10-16 21:58:44 +02:00
, shims ? import ./shims.nix { inherit fetchFromGitHub ; }
2014-08-26 19:35:29 +02:00
} :
2016-02-21 19:15:04 +01:00
let
inherit ( bootPkgs ) ghc ;
version = " 0 . 2 . 0 " ;
in mkDerivation ( rec {
2014-12-12 02:53:25 +01:00
pname = " g h c j s " ;
inherit version ;
2015-09-22 22:53:44 +02:00
src = fetchFromGitHub {
2015-10-05 06:20:22 +02:00
owner = " g h c j s " ;
2015-09-22 22:53:44 +02:00
repo = " g h c j s " ;
2016-04-16 07:55:56 +02:00
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 " ;
2014-12-12 02:53:25 +01:00
} ;
isLibrary = true ;
isExecutable = true ;
jailbreak = true ;
2015-03-13 04:20:56 +01:00
doHaddock = false ;
2014-12-12 02:53:25 +01:00
doCheck = false ;
2014-08-26 19:35:29 +02:00
buildDepends = [
filepath HTTP mtl network random stm time zlib aeson attoparsec
2015-03-13 04:20:56 +01:00
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
2014-08-26 19:35:29 +02:00
] ;
buildTools = [ nodejs git ] ;
testDepends = [
2015-03-13 04:20:56 +01:00
HUnit test-framework test-framework-hunit
2014-08-26 19:35:29 +02:00
] ;
2014-12-12 02:53:25 +01:00
patches = [ ./ghcjs.patch ] ;
postPatch = ''
2015-05-06 21:56:02 +02:00
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 } "
2015-03-13 04:20:56 +01:00
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 "
2014-08-26 19:35:29 +02:00
'' ;
2014-12-25 03:58:45 +01:00
preBuild = ''
2016-07-27 17:44:39 +02:00
export HOME = " $ T M P "
2015-05-06 21:56:02 +02:00
local topDir = $ out/lib/ghcjs- $ { version }
2014-12-12 02:53:25 +01:00
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
2015-03-13 04:20:56 +01:00
# Make the patches be relative their corresponding package's directory.
# See: https://github.com/ghcjs/ghcjs-boot/pull/12
2015-06-16 12:32:46 +02:00
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
2015-03-13 04:20:56 +01:00
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
2014-12-25 03:58:45 +01:00
'' ;
2016-02-18 04:07:32 +01:00
# 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
2014-12-25 03:58:45 +01:00
postInstall = ''
2015-10-15 17:43:23 +02:00
PATH = $ out/bin : $ PATH LD_LIBRARY_PATH = $ { gmp . out } /lib : $ { stdenv . cc } /lib64 : $ LD_LIBRARY_PATH \
2014-12-12 02:53:25 +01:00
env - u GHC_PACKAGE_PATH $ out/bin/ghcjs-boot \
- - dev \
2016-02-18 04:07:32 +01:00
- - quick \
2015-03-13 04:20:56 +01:00
- - with-cabal $ { cabal-install } /bin/cabal \
2015-10-15 17:43:23 +02:00
- - with-gmp-includes $ { gmp . dev } /include \
- - with-gmp-libraries $ { gmp . out } /lib
2014-08-26 19:35:29 +02:00
'' ;
2016-03-02 01:06:29 +01:00
passthru = let
2016-09-04 11:29:49 +02:00
ghcjsNodePkgs = callPackage ../../../top-level/node-packages.nix {
2016-03-02 01:06:29 +01:00
generated = ./node-packages-generated.nix ;
self = ghcjsNodePkgs ;
} ;
in {
2016-02-21 19:15:04 +01:00
inherit bootPkgs ;
2016-02-19 17:40:33 +01:00
isCross = true ;
2015-03-13 04:20:56 +01:00
isGhcjs = true ;
2016-02-18 04:07:32 +01:00
inherit nodejs ghcjsBoot ;
2016-03-02 01:06:29 +01:00
inherit ( ghcjsNodePkgs ) " s o c k e t . i o " ;
2016-07-27 20:28:31 +02:00
# 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 "
" r t s "
" 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 - p r i m "
" g h c j s - p r i m "
" i n t e g e r - g m p "
" o l d - l o c a l e "
" p r e t t y "
" p r i m i t i v e "
" p r o c e s 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-07-26 22:58:56 +02:00
mkStage2 = import ./stage2.nix {
inherit ghcjsBoot ;
} ;
2014-12-12 02:53:25 +01:00
} ;
2015-03-13 04:20:56 +01:00
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 " ;
2015-04-30 17:05:14 +02:00
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 " ;
2015-03-13 04:20:56 +01:00
license = stdenv . lib . licenses . bsd3 ;
platforms = ghc . meta . platforms ;
2015-04-14 13:34:29 +02:00
maintainers = with stdenv . lib . maintainers ; [ jwiegley cstrahan ] ;
2014-08-26 19:35:29 +02:00
} )