From 77752c6c086512a7c1eb066edcef731696fa2a8e Mon Sep 17 00:00:00 2001 From: Marek Fajkus Date: Fri, 20 Dec 2019 15:39:39 +0100 Subject: bs-platform: 6.2.1 -> 7.0.1 --- .../compilers/bs-platform/bs-platform-62.nix | 55 ---------------------- .../compilers/bs-platform/build-bs-platform.nix | 50 ++++++++++++++++++++ pkgs/development/compilers/bs-platform/default.nix | 27 ++++++++--- pkgs/development/compilers/bs-platform/ocaml.nix | 4 +- 4 files changed, 72 insertions(+), 64 deletions(-) delete mode 100644 pkgs/development/compilers/bs-platform/bs-platform-62.nix create mode 100644 pkgs/development/compilers/bs-platform/build-bs-platform.nix (limited to 'pkgs/development/compilers/bs-platform') diff --git a/pkgs/development/compilers/bs-platform/bs-platform-62.nix b/pkgs/development/compilers/bs-platform/bs-platform-62.nix deleted file mode 100644 index d2913caaee646..0000000000000 --- a/pkgs/development/compilers/bs-platform/bs-platform-62.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ 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 - ''; -} diff --git a/pkgs/development/compilers/bs-platform/build-bs-platform.nix b/pkgs/development/compilers/bs-platform/build-bs-platform.nix new file mode 100644 index 0000000000000..03e01a7a0da5e --- /dev/null +++ b/pkgs/development/compilers/bs-platform/build-bs-platform.nix @@ -0,0 +1,50 @@ +# This file is based on https://github.com/turboMaCk/bs-platform.nix/blob/master/build-bs-platform.nix +# to make potential future updates simpler + +{ stdenv, fetchFromGitHub, ninja, runCommand, nodejs, python3, + ocaml-version, version, src, + ocaml ? (import ./ocaml.nix { + version = ocaml-version; + inherit stdenv; + src = "${src}/ocaml"; + }), + custom-ninja ? (ninja.overrideAttrs (attrs: { + src = runCommand "ninja-patched-source" {} '' + mkdir -p $out + tar zxvf ${src}/vendor/ninja.tar.gz -C $out + ''; + patches = []; + })) +}: +stdenv.mkDerivation { + inherit src version; + pname = "bs-platform"; + BS_RELEASE_BUILD = "true"; + buildInputs = [ nodejs python3 custom-ninja ]; + + 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 ${custom-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 + ''; +} diff --git a/pkgs/development/compilers/bs-platform/default.nix b/pkgs/development/compilers/bs-platform/default.nix index 59a47bdab70cb..7abf7b306a554 100644 --- a/pkgs/development/compilers/bs-platform/default.nix +++ b/pkgs/development/compilers/bs-platform/default.nix @@ -1,15 +1,28 @@ -{ stdenv, fetchFromGitHub, ninja, nodejs, python3, ... }: +{ stdenv, runCommand, fetchFromGitHub, ninja, nodejs, python3, ... }: let + build-bs-platform = import ./build-bs-platform.nix; +in +(build-bs-platform { + inherit stdenv runCommand fetchFromGitHub ninja nodejs python3; + version = "7.0.1"; + ocaml-version = "4.06.1"; + + src = fetchFromGitHub { + owner = "BuckleScript"; + repo = "bucklescript"; + rev = "52770839e293ade2bcf187f2639000ca0a9a1d46"; + sha256 = "0s7g2zfhshsilv9zyp0246bypg34d294z27alpwz03ws9608yr7k"; + fetchSubmodules = true; + }; +}).overrideAttrs (attrs: { meta = with stdenv.lib; { description = "A JavaScript backend for OCaml focused on smooth integration and clean generated code."; homepage = https://bucklescript.github.io; license = licenses.lgpl3; maintainers = with maintainers; [ turbomack gamb anmonteiro ]; platforms = platforms.all; + # Currently there is an issue with aarch build in hydra + # https://github.com/BuckleScript/bucklescript/issues/4091 + badPlatforms = platforms.aarch64; }; -in -{ - bs-platform-621 = import ./bs-platform-62.nix { - inherit stdenv fetchFromGitHub ninja nodejs python3; - } // { inherit meta; }; -} +}) diff --git a/pkgs/development/compilers/bs-platform/ocaml.nix b/pkgs/development/compilers/bs-platform/ocaml.nix index 1f2fdd571f3d3..9aa34d02b362c 100644 --- a/pkgs/development/compilers/bs-platform/ocaml.nix +++ b/pkgs/development/compilers/bs-platform/ocaml.nix @@ -1,7 +1,7 @@ -{ stdenv, src, version, bs-version }: +{ stdenv, src, version }: stdenv.mkDerivation rec { inherit src version; - name = "ocaml-${version}+bs-${bs-version}"; + name = "ocaml-${version}+bs"; configurePhase = '' ./configure -prefix $out ''; -- cgit 1.4.1