From 3cbaba6d9d51880029561a71ad69a155eb55d5d6 Mon Sep 17 00:00:00 2001 From: Vincent Laporte Date: Wed, 11 Jun 2025 04:57:16 +0200 Subject: [PATCH] ocamlPackages.bap: update to janestreet 0.17 libbap: mark as broken --- pkgs/development/libraries/libbap/default.nix | 1 + .../ocaml-modules/bap/curses_is_ncurses.patch | 4 +-- .../development/ocaml-modules/bap/default.nix | 12 +++++---- .../ocaml-modules/ppx_bap/default.nix | 22 +++++++++++----- pkgs/top-level/ocaml-packages.nix | 26 +++---------------- 5 files changed, 29 insertions(+), 36 deletions(-) diff --git a/pkgs/development/libraries/libbap/default.nix b/pkgs/development/libraries/libbap/default.nix index 89171e68b1d4..604738dbb33b 100644 --- a/pkgs/development/libraries/libbap/default.nix +++ b/pkgs/development/libraries/libbap/default.nix @@ -45,5 +45,6 @@ stdenv.mkDerivation { maintainers = [ maintainers.maurer ]; platforms = platforms.unix; license = licenses.mit; + broken = true; # Not compatible with JaneStreet libraries 0.17 }; } diff --git a/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch b/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch index 0b012848601f..19ae49b7268a 100644 --- a/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch +++ b/pkgs/development/ocaml-modules/bap/curses_is_ncurses.patch @@ -22,8 +22,8 @@ index 966c407..fba3fb4 100644 Bap_llvm_ogre_samples, Bap_llvm_ogre_types CCOpt: $cc_optimization -- CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lcurses -+ CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lncurses +- CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lcurses -lzstd ++ CCLib: $llvm_lib $cxxlibs $llvm_ldflags -lncurses -lzstd CSources: llvm_disasm.h, llvm_disasm.c, llvm_stubs.c, diff --git a/pkgs/development/ocaml-modules/bap/default.nix b/pkgs/development/ocaml-modules/bap/default.nix index 067e2bc16adb..4120f81a1a02 100644 --- a/pkgs/development/ocaml-modules/bap/default.nix +++ b/pkgs/development/ocaml-modules/bap/default.nix @@ -13,6 +13,7 @@ core_kernel, ezjsonm, fileutils, + jane_rope ? null, mmap, lwt, ocamlgraph, @@ -27,7 +28,7 @@ frontc, ounit, ppx_jane, - parsexp, + parsexp ? null, utop, libxml2, ncurses, @@ -47,12 +48,12 @@ else stdenv.mkDerivation rec { pname = "ocaml${ocaml.version}-bap"; - version = "2.5.0"; + version = "2.5.0+pr1621"; src = fetchFromGitHub { owner = "BinaryAnalysisPlatform"; repo = "bap"; - rev = "v${version}"; - sha256 = "1c30zxn0zyi0wypvjmik3fd6n6a8xjcb102qfnccn1af052bvsrd"; + rev = "65c282d94e8b7028e8a986c637db3a2378a753f6"; + hash = "sha256-LUZZOgG1T8xa5jLA/fDft8ofYb/Yf6QjTrl6AlLY7H0="; }; sigs = fetchurl { @@ -95,6 +96,7 @@ else core_kernel ezjsonm fileutils + jane_rope mmap lwt ocamlgraph @@ -132,7 +134,7 @@ else ]; preConfigure = '' - substituteInPlace oasis/elf-loader --replace bitstring.ppx ppx_bitstring + substituteInPlace oasis/monads --replace-warn core_kernel.rope jane_rope ''; configureFlags = [ diff --git a/pkgs/development/ocaml-modules/ppx_bap/default.nix b/pkgs/development/ocaml-modules/ppx_bap/default.nix index 7414253eef2e..7d2b0af24d19 100644 --- a/pkgs/development/ocaml-modules/ppx_bap/default.nix +++ b/pkgs/development/ocaml-modules/ppx_bap/default.nix @@ -2,22 +2,23 @@ lib, buildDunePackage, fetchFromGitHub, - ppx_assert, - ppx_bench, - ppx_bin_prot, - ppx_compare, - ppx_enumerate, + fetchpatch, + ppx_assert ? null, + ppx_bench ? null, + ppx_bin_prot ? null, + ppx_compare ? null, + ppx_enumerate ? null, + ppx_expect, ppx_hash, ppx_here, ppx_optcomp, ppx_sexp_conv, - ppx_sexp_value, + ppx_sexp_value ? null, }: buildDunePackage rec { pname = "ppx_bap"; version = "0.14"; - duneVersion = "3"; minimalOCamlVersion = "4.07"; @@ -28,6 +29,12 @@ buildDunePackage rec { sha256 = "1c6rcdp8bicdiwqc2mb59cl9l2vxlp3y8hmnr9x924fq7acly248"; }; + # Support ppx_expect + patches = fetchpatch { + url = "https://github.com/BinaryAnalysisPlatform/ppx_bap/commit/7f197648978758fbcbf553da50d7a9248d34f7e4.patch"; + hash = "sha256-oOdcA06mb0W5jDhF4nutEijy6yu/6kMjKOUcNxUSk6k="; + }; + buildInputs = [ ppx_optcomp ppx_sexp_value @@ -39,6 +46,7 @@ buildDunePackage rec { ppx_bin_prot ppx_compare ppx_enumerate + ppx_expect ppx_hash ppx_here ppx_sexp_conv diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index f77338b65fb5..959cd1698e94 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -80,7 +80,9 @@ let backoff = callPackage ../development/ocaml-modules/backoff { }; - bap = janeStreet_0_15.bap; + bap = callPackage ../development/ocaml-modules/bap { + inherit (pkgs.llvmPackages_14) llvm; + }; base64 = callPackage ../development/ocaml-modules/base64 { }; @@ -980,26 +982,6 @@ let zstd ; }; - - # Packages that are not part of janestreet libraries, but still depend - # on v0.15 are kept in this scope, too. - - bap = - let - ppxlib = jsDeps.ppxlib; - lwt_ppx = self.lwt_ppx.override { inherit ppxlib; }; - sedlex = self.sedlex.override { inherit ppxlib ppx_expect; }; - in - callPackage ../development/ocaml-modules/bap { - inherit (pkgs.llvmPackages_14) llvm; - ezjsonm = self.ezjsonm.override { inherit sexplib0; }; - ppx_bitstring = self.ppx_bitstring.override { inherit ppxlib; }; - ocurl = self.ocurl.override { inherit lwt_ppx; }; - piqi = self.piqi.override { inherit sedlex; }; - piqi-ocaml = self.piqi-ocaml.override { inherit piqi; }; - }; - - ppx_bap = callPackage ../development/ocaml-modules/ppx_bap { }; } )).overrideScope liftJaneStreet; @@ -1726,7 +1708,7 @@ let pprint = callPackage ../development/ocaml-modules/pprint { }; - ppx_bap = janeStreet_0_15.ppx_bap; + ppx_bap = callPackage ../development/ocaml-modules/ppx_bap { }; ppx_bitstring = callPackage ../development/ocaml-modules/bitstring/ppx.nix { };