From 331186b9ac7edc9e9aea1fc692da8880a549e33f Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Sun, 3 Jan 2021 10:14:22 +0100 Subject: [PATCH] =?UTF-8?q?ocamlPackages.bitstring:=203.1.1=20=E2=86=92=20?= =?UTF-8?q?4.0.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ocamlPackages.ppx_bitsring: init at 4.0.1 --- pkgs/development/ocaml-modules/bap/default.nix | 7 ++++++- .../ocaml-modules/bitstring/default.nix | 13 +++++++------ .../ocaml-modules/bitstring/ppx.nix | 18 ++++++++++++++++++ pkgs/top-level/ocaml-packages.nix | 2 ++ 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 pkgs/development/ocaml-modules/bitstring/ppx.nix diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix index 66b1dd67a9f2..e860ad13d405 100644 --- a/pkgs/development/ocaml-modules/bap/default.nix +++ b/pkgs/development/ocaml-modules/bap/default.nix @@ -2,6 +2,7 @@ , ocaml, findlib, ocamlbuild, ocaml_oasis, bitstring, camlzip, cmdliner, core_kernel, ezjsonm, fileutils, ocaml_lwt, ocamlgraph, ocurl, re, uri, zarith, piqi, piqi-ocaml, uuidm, llvm, frontc, ounit, ppx_jane, parsexp, utop, libxml2, + ppx_bitstring, ppx_tools_versioned, which, makeWrapper, writeText , z3 @@ -40,7 +41,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ which makeWrapper ]; buildInputs = [ ocaml findlib ocamlbuild ocaml_oasis - llvm ppx_tools_versioned + llvm ppx_bitstring ppx_tools_versioned z3 utop libxml2 ]; @@ -63,6 +64,10 @@ stdenv.mkDerivation rec { patches = [ ./dont-add-curses.patch ]; + preConfigure = '' + substituteInPlace oasis/elf --replace bitstring.ppx ppx_bitstring + ''; + configureFlags = [ "--enable-everything ${disableIda}" "--with-llvm-config=${llvm}/bin/llvm-config" ]; BAPBUILDFLAGS = "-j $(NIX_BUILD_CORES)"; diff --git a/pkgs/development/ocaml-modules/bitstring/default.nix b/pkgs/development/ocaml-modules/bitstring/default.nix index 386503039e05..583017d9ddec 100644 --- a/pkgs/development/ocaml-modules/bitstring/default.nix +++ b/pkgs/development/ocaml-modules/bitstring/default.nix @@ -1,20 +1,21 @@ -{ stdenv, fetchFromGitHub, buildDunePackage, ppx_tools_versioned, ounit }: +{ lib, fetchFromGitHub, buildDunePackage, stdlib-shims }: buildDunePackage rec { pname = "bitstring"; - version = "3.1.1"; + version = "4.0.1"; + + useDune2 = true; src = fetchFromGitHub { owner = "xguerin"; repo = pname; rev = "v${version}"; - sha256 = "1ys8xx174jf8v5sm0lbxvzhdlcs5p0fhy1gvf58gad2g4gvgpvxc"; + sha256 = "1z7jmgljvp52lvn3ml2cp6gssxqp4sikwyjf6ym97cycbcw0fjjm"; }; - buildInputs = [ ppx_tools_versioned ounit ]; - doCheck = true; + propagatedBuildInputs = [ stdlib-shims ]; - meta = with stdenv.lib; { + meta = with lib; { description = "This library adds Erlang-style bitstrings and matching over bitstrings as a syntax extension and library for OCaml"; homepage = "https://github.com/xguerin/bitstring"; license = licenses.lgpl21Plus; diff --git a/pkgs/development/ocaml-modules/bitstring/ppx.nix b/pkgs/development/ocaml-modules/bitstring/ppx.nix new file mode 100644 index 000000000000..ee0a8c51f732 --- /dev/null +++ b/pkgs/development/ocaml-modules/bitstring/ppx.nix @@ -0,0 +1,18 @@ +{ lib, buildDunePackage, ocaml +, bitstring, ppxlib +, ounit +}: + +buildDunePackage rec { + pname = "ppx_bitstring"; + inherit (bitstring) version useDune2 src; + + buildInputs = [ bitstring ppxlib ]; + + doCheck = lib.versionAtLeast ocaml.version "4.08"; + checkInputs = [ ounit ]; + + meta = bitstring.meta // { + description = "Bitstrings and bitstring matching for OCaml - PPX extension"; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 0615fe128bb4..b123658a3ffb 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -851,6 +851,8 @@ let posix-types = callPackage ../development/ocaml-modules/posix/types.nix { }; + ppx_bitstring = callPackage ../development/ocaml-modules/bitstring/ppx.nix { }; + ppxfind = callPackage ../development/ocaml-modules/ppxfind { }; ppxlib = callPackage ../development/ocaml-modules/ppxlib { };