summary refs log tree commit diff
path: root/pkgs/development/compilers/bs-platform/bs-platform-62.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/bs-platform/bs-platform-62.nix')
-rw-r--r--pkgs/development/compilers/bs-platform/bs-platform-62.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/development/compilers/bs-platform/bs-platform-62.nix b/pkgs/development/compilers/bs-platform/bs-platform-62.nix
new file mode 100644
index 00000000000..d2913caaee6
--- /dev/null
+++ b/pkgs/development/compilers/bs-platform/bs-platform-62.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchFromGitHub, ninja, nodejs, python3 }:
+let
+  version = "6.2.1";
+  ocaml-version = "4.06.1";
+  src = fetchFromGitHub {
+    owner = "BuckleScript";
+    repo = "bucklescript";
+    rev = "${version}";
+    sha256 = "0zx9nq7cik0c60n3rndqfqy3vdbj5lcrx6zcqcz2d60jjxi1z32y";
+    fetchSubmodules = true;
+  };
+  ocaml =  import ./ocaml.nix {
+    bs-version = version;
+    version = ocaml-version;
+    inherit stdenv;
+    src = "${src}/ocaml";
+  };
+in
+stdenv.mkDerivation {
+  inherit src version;
+  pname = "bs-platform";
+  BS_RELEASE_BUILD = "true";
+  buildInputs = [ nodejs python3 ];
+
+  patchPhase = ''
+    sed -i 's:./configure.py --bootstrap:python3 ./configure.py --bootstrap:' ./scripts/install.js
+
+    mkdir -p ./native/${ocaml-version}/bin
+    ln -sf ${ocaml}/bin/* ./native/${ocaml-version}/bin
+
+    rm -f vendor/ninja/snapshot/ninja.linux
+    cp ${ninja}/bin/ninja vendor/ninja/snapshot/ninja.linux
+  '';
+
+  configurePhase = ''
+    node scripts/ninja.js config
+  '';
+
+  buildPhase = ''
+    node scripts/ninja.js build
+  '';
+
+  installPhase = ''
+    node scripts/install.js
+
+    mkdir -p $out/bin
+
+    cp -rf jscomp lib vendor odoc_gen native $out
+    cp bsconfig.json package.json $out
+
+    ln -s $out/lib/bsb $out/bin/bsb
+    ln -s $out/lib/bsc $out/bin/bsc
+    ln -s $out/lib/bsrefmt $out/bin/bsrefmt
+  '';
+}