Make ghcjs build.

Note: In order to run ghcjs, you must set LD_LIBRARY_PATH=${ghcjs}/lib/ghc-7.8.2/ghcjs-0.1.0:$LD_LIBRARY_PATH so that it can find libHSghcjs-0.1.0-ghc7.8.2.so

* ghcjs itself (as opposed to ghcjs-built libraries) must be built with the non-ghcjs version of cabal.  I'm not sure whether this is strictly necessary, but it prevented an error.
* CabalGhcjs and cabalInstallGhcjs must be explicitly provided to ghcjs-boot
* Since ghcjs-boot writes to its home directory, we set the home directory to our working directory
* To enable ghcjs-boot to find a particular .h file, we must create a symlink in ghcjs-boot/boot to its parent directory
* gmp must be provided.  Adding it to the LD_LIBRARY_PATH is necessary, but I am not sure whether the uses in buildDepends and the arguments to ghcjs-boot are necessary
* If ghcjs-boot cannot find the shims package, it will attempt (and fail) to download it, so we must put it in place ahead of time
This commit is contained in:
Ryan Trinkle 2014-06-30 00:49:35 -04:00
parent 9cc408303a
commit 4e7aa4be87
2 changed files with 16 additions and 7 deletions

View File

@ -4,9 +4,9 @@
, haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2 , haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2
, parallel, safe, shelly, split, stringsearch, syb, systemFileio , parallel, safe, shelly, split, stringsearch, syb, systemFileio
, systemFilepath, tar, terminfo, textBinary, unorderedContainers , systemFilepath, tar, terminfo, textBinary, unorderedContainers
, vector, wlPprintText, yaml, fetchgit, Cabal, cabalInstall , vector, wlPprintText, yaml, fetchgit, Cabal, CabalGhcjs, cabalInstall
, regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch , regexPosix, alex, happy, git, gnumake, gcc, autoconf, patch
, automake, libtool , automake, libtool, cabalInstallGhcjs, gmp
}: }:
cabal.mkDerivation (self: rec { cabal.mkDerivation (self: rec {
@ -22,6 +22,11 @@ cabal.mkDerivation (self: rec {
rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81"; rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81";
sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8"; sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8";
}; };
shims = fetchgit {
url = git://github.com/ghcjs/shims.git;
rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35";
sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax";
};
isLibrary = true; isLibrary = true;
isExecutable = true; isExecutable = true;
jailbreak = true; jailbreak = true;
@ -32,7 +37,7 @@ cabal.mkDerivation (self: rec {
lens optparseApplicative_0_7_0_2 parallel safe shelly split lens optparseApplicative_0_7_0_2 parallel safe shelly split
stringsearch syb systemFileio systemFilepath tar terminfo textBinary stringsearch syb systemFileio systemFilepath tar terminfo textBinary
unorderedContainers vector wlPprintText yaml unorderedContainers vector wlPprintText yaml
alex happy git gnumake gcc autoconf automake libtool patch alex happy git gnumake gcc autoconf automake libtool patch gmp
]; ];
testDepends = [ testDepends = [
HUnit regexPosix testFramework testFrameworkHunit HUnit regexPosix testFramework testFrameworkHunit
@ -45,12 +50,17 @@ cabal.mkDerivation (self: rec {
src-bin/Boot.hs src-bin/Boot.hs
''; '';
postInstall = '' postInstall = ''
export HOME=$(pwd)
cp -R ${bootSrc} ghcjs-boot cp -R ${bootSrc} ghcjs-boot
cd ghcjs-boot cd ghcjs-boot
( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot )
chmod -R u+w . # because fetchgit made it read-only chmod -R u+w . # because fetchgit made it read-only
ensureDir $out/share/ghcjs local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2
PATH=$out/bin:${Cabal}/bin:$PATH \ ensureDir $GHCJS_LIBDIR
$out/bin/ghcjs-boot --init --with-cabal ${cabalInstall}/bin/cabal-js cp -R ${shims} $GHCJS_LIBDIR/shims
${cabalInstallGhcjs}/bin/cabal-js update
PATH=$out/bin:${CabalGhcjs}/bin:$PATH LD_LIBRARY_PATH=${gmp}/lib:${gcc.gcc}/lib64:$LD_LIBRARY_PATH \
env -u GHC_PACKAGE_PATH $out/bin/ghcjs-boot --init --with-cabal ${cabalInstallGhcjs}/bin/cabal-js --with-gmp-includes ${gmp}/include --with-gmp-libraries ${gmp}/lib
''; '';
meta = { meta = {
homepage = "https://github.com/ghcjs/ghcjs"; homepage = "https://github.com/ghcjs/ghcjs";

View File

@ -845,7 +845,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
ghcjs = callPackage ../development/tools/haskell/ghcjs { ghcjs = callPackage ../development/tools/haskell/ghcjs {
Cabal = self.Cabal_1_18_1_3; Cabal = self.Cabal_1_18_1_3;
cabalInstall = self.cabalInstallGhcjs;
}; };
ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {}; ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {};