about summary refs log tree commit diff
path: root/pkgs/development/compilers/ghcjs-ng
diff options
context:
space:
mode:
authorWill Fancher <elvishjerricco@gmail.com>2018-05-12 01:06:47 -0400
committerWill Fancher <elvishjerricco@gmail.com>2018-05-12 01:54:42 -0400
commitc41675bce0ce3eb4d79180c804892e8e3c268e55 (patch)
tree5a2c8fcd3833c71867e7591475dc97ef9f1ede77 /pkgs/development/compilers/ghcjs-ng
parent0a77a728954460725a7346d6f180283048ed77c2 (diff)
downloadnixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.tar
nixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.tar.gz
nixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.tar.bz2
nixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.tar.lz
nixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.tar.xz
nixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.tar.zst
nixlib-c41675bce0ce3eb4d79180c804892e8e3c268e55.zip
GHCJS 8.2
Diffstat (limited to 'pkgs/development/compilers/ghcjs-ng')
-rw-r--r--pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix6
-rw-r--r--pkgs/development/compilers/ghcjs-ng/8.2/git.json6
-rw-r--r--pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix168
-rw-r--r--pkgs/development/compilers/ghcjs-ng/README.md20
-rw-r--r--pkgs/development/compilers/ghcjs-ng/common-overrides.nix8
-rw-r--r--pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix44
-rw-r--r--pkgs/development/compilers/ghcjs-ng/default.nix77
-rw-r--r--pkgs/development/compilers/ghcjs-ng/mk-stage0.nix25
8 files changed, 354 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix b/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix
new file mode 100644
index 000000000000..72066ee17018
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/8.2/dep-overrides.nix
@@ -0,0 +1,6 @@
+{ haskellLib }:
+
+let inherit (haskellLib) dontHaddock;
+in self: super: {
+  ghcjs = dontHaddock super.ghcjs;
+}
diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/git.json b/pkgs/development/compilers/ghcjs-ng/8.2/git.json
new file mode 100644
index 000000000000..efe7794a103e
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/8.2/git.json
@@ -0,0 +1,6 @@
+{
+  "url": "https://github.com/ghcjs/ghcjs",
+  "rev": "0cff73c3ee13b464adba90f308b77751c75b9f26",
+  "sha256": "1shg34zi6ryaihar62qdkkalv8dsrsqbv58jzkhk9in38sdfkjxv",
+  "fetchSubmodules": true
+}
diff --git a/pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix b/pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix
new file mode 100644
index 000000000000..0680ff156e14
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/8.2/stage0.nix
@@ -0,0 +1,168 @@
+{ callPackage, configuredSrc }:
+
+{
+
+  ghcjs = callPackage
+    ({ mkDerivation, aeson, array, attoparsec, base, base16-bytestring
+    , base64-bytestring, binary, bytestring, Cabal, containers
+    , cryptohash, data-default, deepseq, directory, executable-path
+    , filepath, ghc-api-ghcjs, ghc-boot, ghc-paths, ghci-ghcjs
+    , ghcjs-th, haddock-api-ghcjs, hashable, haskell-src-exts
+    , haskell-src-meta, http-types, HUnit, lens, lifted-base, mtl
+    , network, optparse-applicative, parallel, parsec, process, random
+    , regex-posix, safe, shelly, split, stdenv, stringsearch, syb
+    , system-fileio, system-filepath, tar, template-haskell
+    , template-haskell-ghcjs, terminfo, test-framework
+    , test-framework-hunit, text, time, transformers
+    , transformers-compat, unix, unix-compat, unordered-containers
+    , vector, wai, wai-app-static, wai-extra, wai-websockets, warp
+    , webdriver, websockets, wl-pprint-text, yaml
+    }:
+    mkDerivation {
+      pname = "ghcjs";
+      version = "8.2.0.1";
+      src = configuredSrc + /.;
+      isLibrary = true;
+      isExecutable = true;
+      enableSeparateDataOutput = true;
+      setupHaskellDepends = [
+        base Cabal containers directory filepath process template-haskell
+        transformers
+      ];
+      libraryHaskellDepends = [
+        aeson array attoparsec base base16-bytestring base64-bytestring
+        binary bytestring Cabal containers cryptohash data-default deepseq
+        directory filepath ghc-api-ghcjs ghc-boot ghc-paths ghci-ghcjs
+        ghcjs-th hashable haskell-src-exts haskell-src-meta lens mtl
+        optparse-applicative parallel parsec process regex-posix safe split
+        stringsearch syb template-haskell template-haskell-ghcjs text time
+        transformers unordered-containers vector wl-pprint-text yaml
+      ];
+      executableHaskellDepends = [
+        aeson base binary bytestring Cabal containers directory
+        executable-path filepath ghc-api-ghcjs ghc-boot haddock-api-ghcjs
+        lens mtl optparse-applicative process shelly system-fileio
+        system-filepath tar terminfo text time transformers
+        transformers-compat unix unix-compat unordered-containers vector
+        yaml
+      ];
+      testHaskellDepends = [
+        aeson base bytestring data-default deepseq directory http-types
+        HUnit lens lifted-base network optparse-applicative process random
+        shelly system-fileio system-filepath test-framework
+        test-framework-hunit text time transformers unordered-containers
+        wai wai-app-static wai-extra wai-websockets warp webdriver
+        websockets yaml
+      ];
+      description = "Haskell to JavaScript compiler";
+      license = stdenv.lib.licenses.mit;
+    }) {};
+
+  ghc-api-ghcjs = callPackage
+    ({ mkDerivation, array, base, binary, bytestring, containers
+    , deepseq, directory, filepath, ghc-boot, ghc-boot-th, ghci-ghcjs
+    , hoopl, hpc, process, stdenv, template-haskell-ghcjs, terminfo
+    , time, transformers, unix
+    }:
+    mkDerivation {
+      pname = "ghc-api-ghcjs";
+      version = "8.2.2";
+      src = configuredSrc + /lib/ghc-api-ghcjs;
+      libraryHaskellDepends = [
+        array base binary bytestring containers deepseq directory filepath
+        ghc-boot ghc-boot-th ghci-ghcjs hoopl hpc process
+        template-haskell-ghcjs terminfo time transformers unix
+      ];
+      homepage = "http://www.haskell.org/ghc/";
+      description = "The GHC API (customized for GHCJS)";
+      license = stdenv.lib.licenses.bsd3;
+    }) {};
+
+  ghci-ghcjs = callPackage
+    ({ mkDerivation, array, base, binary, bytestring, containers
+    , deepseq, filepath, ghc-boot, ghc-boot-th, stdenv
+    , template-haskell-ghcjs, transformers, unix
+    }:
+    mkDerivation {
+      pname = "ghci-ghcjs";
+      version = "8.2.2";
+      src = configuredSrc + /lib/ghci-ghcjs;
+      libraryHaskellDepends = [
+        array base binary bytestring containers deepseq filepath ghc-boot
+        ghc-boot-th template-haskell-ghcjs transformers unix
+      ];
+      description = "The library supporting GHC's interactive interpreter (customized for GHCJS)";
+      license = stdenv.lib.licenses.bsd3;
+    }) {};
+
+  ghcjs-th = callPackage
+    ({ mkDerivation, base, binary, bytestring, containers, ghc-prim
+    , ghci-ghcjs, stdenv, template-haskell-ghcjs
+    }:
+    mkDerivation {
+      pname = "ghcjs-th";
+      version = "0.1.0.0";
+      src = configuredSrc + /lib/ghcjs-th;
+      libraryHaskellDepends = [
+        base binary bytestring containers ghc-prim ghci-ghcjs
+        template-haskell-ghcjs
+      ];
+      homepage = "http://github.com/ghcjs";
+      license = stdenv.lib.licenses.mit;
+    }) {};
+
+  haddock-api-ghcjs = callPackage
+    ({ mkDerivation, array, base, bytestring, Cabal, containers, deepseq
+    , directory, filepath, ghc-api-ghcjs, ghc-boot, ghc-paths
+    , haddock-library-ghcjs, hspec, hspec-discover, QuickCheck, stdenv
+    , transformers, xhtml
+    }:
+    mkDerivation {
+      pname = "haddock-api-ghcjs";
+      version = "2.18.1";
+      src = configuredSrc + /lib/haddock-api-ghcjs;
+      enableSeparateDataOutput = true;
+      libraryHaskellDepends = [
+        array base bytestring Cabal containers deepseq directory filepath
+        ghc-api-ghcjs ghc-boot ghc-paths haddock-library-ghcjs transformers
+        xhtml
+      ];
+      testHaskellDepends = [
+        base containers ghc-api-ghcjs hspec QuickCheck
+      ];
+      testToolDepends = [ hspec-discover ];
+      homepage = "http://www.haskell.org/haddock/";
+      description = "A documentation-generation tool for Haskell libraries (customized for GHCJS)";
+      license = stdenv.lib.licenses.bsd3;
+    }) {};
+
+  haddock-library-ghcjs = callPackage
+    ({ mkDerivation, base, base-compat, bytestring, deepseq, hspec
+    , hspec-discover, QuickCheck, stdenv, transformers
+    }:
+    mkDerivation {
+      pname = "haddock-library-ghcjs";
+      version = "1.4.4";
+      src = configuredSrc + /lib/haddock-library-ghcjs;
+      libraryHaskellDepends = [ base bytestring deepseq transformers ];
+      testHaskellDepends = [
+        base base-compat bytestring deepseq hspec QuickCheck transformers
+      ];
+      testToolDepends = [ hspec-discover ];
+      homepage = "http://www.haskell.org/haddock/";
+      description = "Library exposing some functionality of Haddock";
+      license = stdenv.lib.licenses.bsd3;
+    }) {};
+
+  template-haskell-ghcjs = callPackage
+    ({ mkDerivation, base, ghc-boot-th, pretty, stdenv }:
+    mkDerivation {
+      pname = "template-haskell-ghcjs";
+      version = "2.12.0.0";
+      src = configuredSrc + /lib/template-haskell-ghcjs;
+      libraryHaskellDepends = [ base ghc-boot-th pretty ];
+      description = "Support library for Template Haskell (customized for GHCJS)";
+      license = stdenv.lib.licenses.bsd3;
+    }) {};
+
+}
diff --git a/pkgs/development/compilers/ghcjs-ng/README.md b/pkgs/development/compilers/ghcjs-ng/README.md
new file mode 100644
index 000000000000..3e1598c83b05
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/README.md
@@ -0,0 +1,20 @@
+New build system for GHCJS 8.2
+---
+
+`ghcjs-8.2` reworked the build system, and now comes with its own
+small package set of dependencies. This involves autogenerating
+several sources and cabal files, based on a GHC
+checkout. `callCabal2nix` is off limits, since we don't like "import
+from derivation" in nixpkgs. So there is a derivation that builds the
+nix expression that should be checked in whenever GHCJS is updated.
+
+Updating
+---
+
+```
+$ nix-prefetch-git https://github.com/ghcjs/ghcjs --rev refs/heads/ghc-8.2 \
+  | jq '{ url, rev, fetchSubmodules, sha256 }' \
+  > 8.2/git.json
+$ cat $(nix-build ../../../.. -A haskell.compiler.ghcjs82.genStage0 --no-out-link) > 8.2/stage0.nix
+```
+
diff --git a/pkgs/development/compilers/ghcjs-ng/common-overrides.nix b/pkgs/development/compilers/ghcjs-ng/common-overrides.nix
new file mode 100644
index 000000000000..172a48a5a654
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/common-overrides.nix
@@ -0,0 +1,8 @@
+{ haskellLib, alex, happy }:
+
+let inherit (haskellLib) addBuildTools appendConfigureFlag dontHaddock doJailbreak;
+in self: super: {
+  ghc-api-ghcjs = addBuildTools super.ghc-api-ghcjs [alex happy];
+  ghcjs = appendConfigureFlag (doJailbreak super.ghcjs) "-fno-wrapper-install";
+  haddock-library-ghcjs = dontHaddock super.haddock-library-ghcjs;
+}
diff --git a/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix
new file mode 100644
index 000000000000..b9435b311572
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/configured-ghcjs-src.nix
@@ -0,0 +1,44 @@
+{ perl
+, autoconf
+, automake
+, python3
+, gcc
+, cabal-install
+, gmp
+, runCommand
+
+, ghc
+, happy
+, alex
+
+, ghcjsSrc
+}:
+
+runCommand "configured-ghcjs-src" {
+  buildInputs = [
+    perl
+    autoconf
+    automake
+    python3
+    ghc
+    happy
+    alex
+    cabal-install
+  ];
+  inherit ghcjsSrc;
+} ''
+  export HOME=$(pwd)
+  cp -r "$ghcjsSrc" "$out"
+  chmod -R +w "$out"
+  cd "$out"
+
+  # TODO: Find a better way to avoid impure version numbers
+  sed -i 's/RELEASE=NO/RELEASE=YES/' ghc/configure.ac
+
+  # TODO: How to actually fix this?
+  # Seems to work fine and produce the right files.
+  touch ghc/includes/ghcautoconf.h
+
+  patchShebangs .
+  ./utils/makePackages.sh copy
+''
diff --git a/pkgs/development/compilers/ghcjs-ng/default.nix b/pkgs/development/compilers/ghcjs-ng/default.nix
new file mode 100644
index 000000000000..c2fb6a03c6b1
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/default.nix
@@ -0,0 +1,77 @@
+{ stdenv
+, callPackage
+, fetchgit
+, ghcjsSrcJson ? null
+, ghcjsSrc ? fetchgit (builtins.fromJSON (builtins.readFile ghcjsSrcJson))
+, bootPkgs
+, alex
+, happy
+, stage0
+, haskellLib
+, cabal-install
+, nodejs
+, makeWrapper
+, xorg
+, gmp
+, lib
+, ghcjsDepOverrides ? (_:_:{})
+}:
+
+let
+  passthru = {
+    configuredSrc = callPackage ./configured-ghcjs-src.nix {
+      inherit ghcjsSrc alex happy;
+      inherit (bootPkgs) ghc;
+    };
+    genStage0 = callPackage ./mk-stage0.nix { inherit (passthru) configuredSrc; };
+    bootPkgs = bootPkgs.extend (lib.foldr lib.composeExtensions (_:_:{}) [
+      (self: _: import stage0 {
+        inherit (passthru) configuredSrc;
+        inherit (self) callPackage;
+      })
+
+      (callPackage ./common-overrides.nix { inherit haskellLib alex happy; })
+      ghcjsDepOverrides
+    ]);
+
+    targetPrefix = "";
+    inherit (passthru.bootPkgs.ghcjs) version;
+    isGhcjs = true;
+
+    # Relics of the old GHCJS build system
+    stage1Packages = [];
+    mkStage2 = _: {};
+  };
+
+  libexec =
+    if builtins.compareVersions passthru.bootPkgs.ghcjs.version "8.3" <= 0
+      then "${passthru.bootPkgs.ghcjs}/bin"
+      else "${passthru.bootPkgs.ghcjs}/libexec/${stdenv.system}-${passthru.bootPkgs.ghc.name}/${passthru.bootPkgs.ghcjs.name}";
+
+in stdenv.mkDerivation {
+    name = "ghcjs";
+    src = passthru.configuredSrc;
+    nativeBuildInputs = [passthru.bootPkgs.ghcjs passthru.bootPkgs.ghc cabal-install nodejs makeWrapper xorg.lndir gmp];
+    phases = ["unpackPhase" "buildPhase"];
+    buildPhase = ''
+      export HOME=$TMP
+      cd lib/boot
+
+      mkdir -p $out/bin
+      mkdir -p $out/libexec
+      lndir ${libexec} $out/bin
+
+      wrapProgram $out/bin/ghcjs --add-flags "-B$out/libexec"
+      wrapProgram $out/bin/haddock-ghcjs --add-flags "-B$out/libexec"
+      wrapProgram $out/bin/ghcjs-pkg --add-flags "--global-package-db=$out/libexec/package.conf.d"
+
+      env PATH=$out/bin:$PATH $out/bin/ghcjs-boot -j $NIX_BUILD_CORES --with-ghcjs-bin $out/bin
+    '';
+
+    enableParallelBuilding = true;
+
+    inherit passthru;
+
+    meta.platforms = passthru.bootPkgs.ghc.meta.platforms;
+  }
+
diff --git a/pkgs/development/compilers/ghcjs-ng/mk-stage0.nix b/pkgs/development/compilers/ghcjs-ng/mk-stage0.nix
new file mode 100644
index 000000000000..f45ebb4511d6
--- /dev/null
+++ b/pkgs/development/compilers/ghcjs-ng/mk-stage0.nix
@@ -0,0 +1,25 @@
+{ configuredSrc
+, runCommand
+, cabal2nix
+, yq
+}:
+
+runCommand "stage0.nix" {
+  buildInputs = [cabal2nix yq];
+} ''
+  (
+    printf '{ callPackage, configuredSrc }:\n\n{\n\n'
+    yq '.packages | .[]' ${configuredSrc}/stack.yaml -r | sed 's|^\.$|./.|' | sed 's|^\.||' | while read f; do
+      printf '  %s = callPackage\n' \
+        "$(find ${configuredSrc}/$f -name "*.cabal" -maxdepth 1 \
+          | xargs basename \
+          | sed 's/.cabal$//')"
+      printf '(%s) {};' \
+        "$(cabal2nix ${configuredSrc}/$f \
+          | sed 's|${configuredSrc}/|configuredSrc + |g')" \
+        | sed 's/^/    /'
+      printf '\n\n'
+    done
+    printf '}\n'
+  ) > $out
+''