From 4e7aa4be874d2d0f10da4eb41ef9ec14c14b72bf Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Mon, 30 Jun 2014 00:49:35 -0400 Subject: [PATCH] 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 --- .../tools/haskell/ghcjs/default.nix | 22 ++++++++++++++----- pkgs/top-level/haskell-packages.nix | 1 - 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/development/tools/haskell/ghcjs/default.nix b/pkgs/development/tools/haskell/ghcjs/default.nix index cf7c49b237a..be12c31b91d 100644 --- a/pkgs/development/tools/haskell/ghcjs/default.nix +++ b/pkgs/development/tools/haskell/ghcjs/default.nix @@ -4,9 +4,9 @@ , haskellSrcExts, haskellSrcMeta, lens, optparseApplicative_0_7_0_2 , parallel, safe, shelly, split, stringsearch, syb, systemFileio , 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 -, automake, libtool +, automake, libtool, cabalInstallGhcjs, gmp }: cabal.mkDerivation (self: rec { @@ -22,6 +22,11 @@ cabal.mkDerivation (self: rec { rev = "2daaf8fc0efd5b5906a7157a172ce77ca3b28d81"; sha256 = "0kwn3lh196rp02kz2vxd0mkqyix99xqzs4vsazv0s49ari0dc4w8"; }; + shims = fetchgit { + url = git://github.com/ghcjs/shims.git; + rev = "a6dd0202dcdb86ad63201495b8b5d9763483eb35"; + sha256 = "07cd7ijw4i62iz1xjpwilriiybpqdx246w8d3j27ny1xfsj9wnax"; + }; isLibrary = true; isExecutable = true; jailbreak = true; @@ -32,7 +37,7 @@ cabal.mkDerivation (self: rec { lens optparseApplicative_0_7_0_2 parallel safe shelly split stringsearch syb systemFileio systemFilepath tar terminfo textBinary unorderedContainers vector wlPprintText yaml - alex happy git gnumake gcc autoconf automake libtool patch + alex happy git gnumake gcc autoconf automake libtool patch gmp ]; testDepends = [ HUnit regexPosix testFramework testFrameworkHunit @@ -45,12 +50,17 @@ cabal.mkDerivation (self: rec { src-bin/Boot.hs ''; postInstall = '' + export HOME=$(pwd) cp -R ${bootSrc} ghcjs-boot cd ghcjs-boot + ( cd boot ; chmod u+w . ; ln -s .. ghcjs-boot ) chmod -R u+w . # because fetchgit made it read-only - ensureDir $out/share/ghcjs - PATH=$out/bin:${Cabal}/bin:$PATH \ - $out/bin/ghcjs-boot --init --with-cabal ${cabalInstall}/bin/cabal-js + local GHCJS_LIBDIR=$out/share/ghcjs/x86_64-linux-0.1.0-7.8.2 + ensureDir $GHCJS_LIBDIR + 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 = { homepage = "https://github.com/ghcjs/ghcjs"; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 46aac09b50c..53816711893 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -845,7 +845,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in ghcjs = callPackage ../development/tools/haskell/ghcjs { Cabal = self.Cabal_1_18_1_3; - cabalInstall = self.cabalInstallGhcjs; }; ghcjsDom = callPackage ../development/libraries/haskell/ghcjs-codemirror {};